Skip to content

feat: add blas/ext/base/ndarray/zxsa#12407

Merged
kgryte merged 1 commit into
stdlib-js:developfrom
anandkaranubc:feat/ndarray-zxsa
May 31, 2026
Merged

feat: add blas/ext/base/ndarray/zxsa#12407
kgryte merged 1 commit into
stdlib-js:developfrom
anandkaranubc:feat/ndarray-zxsa

Conversation

@anandkaranubc
Copy link
Copy Markdown
Contributor

Resolves stdlib-js/metr-issue-tracker#677

Description

What is the purpose of this pull request?

This pull request:

  • adds blas/ext/base/ndarray/zxsa

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.".

Used Cursor+VS Code code-generation tools to help assist with the feature.


@stdlib-js/reviewers

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: passed
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@anandkaranubc anandkaranubc requested a review from a team May 31, 2026 21:50
@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 May 31, 2026
@anandkaranubc anandkaranubc added Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. METR Pull request associated with the METR project. labels May 31, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/ndarray/zxsa $\color{green}122/122$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}122/122$
$\color{green}+100.00\%$

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

@kgryte kgryte removed the Needs Review A pull request which needs code review. label May 31, 2026
var xbuf;
var x;

xbuf = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0, 2.0, 1.0 ] );
Copy link
Copy Markdown
Member

@kgryte kgryte May 31, 2026

Choose a reason for hiding this comment

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

Aside: these tests are harder to review for the following reasons:

  1. You have moved everything to a single line, so visually grouping related elements takes more work.
  2. You have omitted the element comments, so the reviewer needs to mentally keep track of which elements are indexed.
  3. You have included non-sentinel values for those elements which are not indexed, which means that the reviewer needs to actually visually inspect the expected output, as it is not obvious which values are modified and which are not.
  4. You are forcing the reviewer to maintain a lot of mental state to determine whether tests are properly implemented, which leads the reviewer to put a lot of faith in hoping that test failures will have snuffed out mistakes and increases the likelihood of mistakes slipping through.

In general, you should strive to make the tests as obvious as possible. Otherwise, it just creates a drag on reviews and a burden on future readers.

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.

In short, there is a reason why we do things like

var x = [
    1, // 0
    1, // 0
    0,
    0,
    2, // 1
    2, // 1
    0,
    0,
    3, // 2
    3, // 2
    ...
];

Yes, it creates more bookkeeping for the test author, and, yes, it increases likelihood of copy-paste mistakes, as happened in a couple of your recent PRs, but it also makes for much easier review and helps future readers quickly intuit expected behavior.

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.

cc @batpigandme this is something we should probably document.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that, @kgryte. I will definitely keep that in mind for future PRs and create another one for updating the existing packages. Apologies!

@kgryte kgryte merged commit 0cefffd into stdlib-js:develop May 31, 2026
104 checks passed
@anandkaranubc anandkaranubc deleted the feat/ndarray-zxsa branch May 31, 2026 22:21
t.strictEqual( actual, x, 'returns expected value' );

expected = new Complex128Array( [ -7.0, 1.0, -2.0, -5.0, -1.0, 0.0, -6.0, -3.0, -3.0, 1.0 ] );
t.deepEqual( xbuf, expected, 'returns expected value' );
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.

Actually, now that I look at these tests, this is wrong. t.deepEqual does not work the way you are expecting, as it doesn't know anything about accessor arrays.

You need to use isSameComplex128Array.

@anandkaranubc Mind fixing this across the various complex number packages you have added?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, fixing in #12408

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Creating another one :)

batpigandme added a commit to batpigandme/stdlib that referenced this pull request Jun 1, 2026
The whitespace linter doc covered JSON fixture matrices but left
the JavaScript test array case unaddressed. Strided test arrays
present a distinct problem: flat single-line arrays force the
reviewer to count strides, map storage positions to logical
indices, and visually diff input against expected to find what
changed.

Document three moves anchored on kgryte review in PR stdlib-js#12407:
break arrays one element per line, annotate indexed slots with
trailing index comments (// 0, // 1, ...), and use sentinel zero
values for non-indexed positions. Also add a matching heuristic
bullet to the reviewer guidance section.

Ref: stdlib-js#12407 (comment)

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: skipped
  - task: lint_markdown_docs
    status: skipped
  - task: lint_markdown
    status: skipped
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
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). Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add blas/ext/base/ndarray/zxsa

3 participants