Skip to content

refactor!: update blas/ext/base/dnannsumkbn to use separate output arrays - #16995

Open
ujjwalv01 wants to merge 2 commits into
stdlib-js:developfrom
ujjwalv01:refactor-blas-ext-base-dnannsumkbn
Open

ujjwalv01 wants to merge 2 commits into
stdlib-js:developfrom
ujjwalv01:refactor-blas-ext-base-dnannsumkbn

Conversation

@ujjwalv01

Copy link
Copy Markdown
Member

Progresses #16965.

Description

What is the purpose of this pull request?

This pull request:

  • refactors blas/ext/base/dnannsumkbn to write the sum and the number of non-NaN elements to separate single-element arrays rather than a packed two-element out array, following the convention used by lapack/base/dladiv and lapack/base/dlassq.
  • changes the signature to dnannsumkbn( N, x, strideX, sum, count ) and dnannsumkbn.ndarray( N, x, strideX, offsetX, sum, offsetSum, count, offsetCount ), where sum is a Float64Array and count is an Int32Array, each containing a single element. The functions now return void.
  • updates the native add-on, tests, benchmarks, examples, README, REPL text, TypeScript declarations, and the blas/ext/base namespace declarations accordingly.
  • updates the internal caller blas/ext/base/dnannsum to call the new signature. Its own API is unchanged.

The C APIs are unchanged, as they already return the sum and write the count through a pointer.

The underlying algorithm is unchanged, and all previously expected values are retained in the tests.

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?

The C APIs already use a pointer for the count (CBLAS_INT *n), so I left them as they are. Should they instead change to void with two output pointers (double *sum, CBLAS_INT *count);?

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 claude code for refactored tests generation, reviewed them myself;


@stdlib-js/reviewers

…arrays

BREAKING CHANGE: use separate output arrays

To migrate, users should replace the `out` and `strideOut` arguments with a single-element `sum` array and a single-element `count` array (an `Int32Array`).
@ujjwalv01
ujjwalv01 requested a review from a team November 29, 2026 19:43
@stdlib-bot stdlib-bot added BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Needs Review A pull request which needs code review. labels Nov 29, 2026
@stdlib-bot

stdlib-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base $\\color{red}173066/207619$
$\\color{green}+0.00\\%$
$\\color{red}3063/3438$
$\\color{green}+0.00\\%$
$\\color{red}20/1722$
$\\color{green}+0.00\\%$
$\\color{red}173066/207619$
$\\color{green}+0.00\\%$
blas/ext/base/dnannsum $\\color{green}371/371$
$\\color{green}+0.00\\%$
$\\color{green}13/13$
$\\color{green}+0.00\\%$
$\\color{green}4/4$
$\\color{green}+0.00\\%$
$\\color{green}371/371$
$\\color{green}+0.00\\%$
blas/ext/base/dnannsumkbn $\\color{red}471/474$
$\\color{green}+0.00\\%$
$\\color{red}36/37$
$\\color{green}+0.00\\%$
$\\color{green}4/4$
$\\color{green}+0.00\\%$
$\\color{red}471/474$
$\\color{green}+0.00\\%$

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

This branch has not been deployed

No deployments
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). Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants