Skip to content

feat: add blas/ext/base/ndarray/dapx - #14424

Merged
kgryte merged 5 commits into
stdlib-js:developfrom
ujjwalv01:feat-blas-ext-base-ndarray-dapx
Oct 15, 2026
Merged

kgryte merged 5 commits into
stdlib-js:developfrom
ujjwalv01:feat-blas-ext-base-ndarray-dapx

Conversation

@ujjwalv01

Copy link
Copy Markdown
Member

Resolves a part of #14404

Description

What is the purpose of this pull request?

This pull request:

  • Implements the ndarray API wrapper for @stdlib/blas/ext/base/dapx (adds a scalar constant to each element in a one-dimensional double-precision floating-point ndarray).
  • Ensures consistency with the canonical scalar-operation examples and tests used across the @stdlib/blas/ext/base packages.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

I used an AI assistant to research existing ndarray packages to ensure consistency with canonical example arrays (e.g., [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] for scalar operations) and to help scaffold the tests and benchmarks. All changes were manually verified and aligned with the blas/ext/base/dapx reference tests.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). label Aug 19, 2026
@stdlib-bot

stdlib-bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/ndarray/dapx $\\color{green}120/120$
$\\color{green}+0.00\\%$
$\\color{green}3/3$
$\\color{green}+0.00\\%$
$\\color{green}1/1$
$\\color{green}+0.00\\%$
$\\color{green}120/120$
$\\color{green}+0.00\\%$

The above coverage report was generated for the changes in this PR.

@ujjwalv01
ujjwalv01 marked this pull request as ready for review August 19, 2026 22:36
@ujjwalv01
ujjwalv01 requested a review from a team August 19, 2026 22:36
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 19, 2026

@0PrashantYadav0 0PrashantYadav0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes are required as of now.

Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/docs/types/index.d.ts Outdated
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/docs/repl.txt
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/docs/repl.txt
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/lib/main.js
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/lib/main.js
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/README.md
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/lib/index.js
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/lib/index.js
@0PrashantYadav0 0PrashantYadav0 added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Aug 20, 2026
@ujjwalv01

Copy link
Copy Markdown
Member Author

Hi @0PrashantYadav0

I've applied the suggestions, but the CI is failing with a data type cast error. It seems that passing a plain array to @stdlib/ndarray/array infers it as a generic dtype, and casting from generic to float64 is not allowed under the default safe casting mode;

To fix this, should I wrap the input in a Float64Array like this?
var x = array( new Float64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ), { 'dtype': 'float64' });

Or would you prefer I add 'ndmin': 1, 'cast': 'unsafe' to the options? LMK which pattern, or anything else, is preferred;

@0PrashantYadav0

Copy link
Copy Markdown
Member

Agreed, var x = array( new Float64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ) ); makes much more sense. I considered this approach initially but held off because it requires multiple passes. Before we move forward with this change, let's get @kgryte 's review.

Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/docs/types/index.d.ts Outdated
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/lib/index.js Outdated
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/lib/main.js Outdated
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/test/test.js
Comment thread lib/node_modules/@stdlib/blas/ext/base/ndarray/dapx/README.md Outdated

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left initial comments.

@kgryte kgryte added the Feature Issue or pull request for adding a new feature. label Oct 15, 2026
@kgryte
kgryte merged commit e148971 into stdlib-js:develop Oct 15, 2026
13 checks passed
@kgryte kgryte added difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. review: 3 and removed Needs Changes Pull request which needs changes before being merged. labels Oct 15, 2026
@ujjwalv01 ujjwalv01 mentioned this pull request Oct 15, 2026
2 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Feature Issue or pull request for adding a new feature. review: 3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants