Skip to content

feat: add blas/ext/base/zcartesian-square - #11830

Merged
kgryte merged 17 commits into
stdlib-js:developfrom
headlessNode:blas/zcartesian-square
Jul 26, 2026
Merged

kgryte merged 17 commits into
stdlib-js:developfrom
headlessNode:blas/zcartesian-square

Conversation

@headlessNode

Copy link
Copy Markdown
Member

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 status: passed
  • 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: missing_dependencies
  • task: lint_c_examples status: missing_dependencies
  • task: lint_c_benchmarks status: missing_dependencies
  • 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 ---

Resolves stdlib-js/metr-issue-tracker#493.

Description

What is the purpose of this pull request?

This pull request:

  • add blas/ext/base/zcartesian-square

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

Primarily written by Claude Code.


@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
    status: passed
  - 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: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - 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
---
@stdlib-bot stdlib-bot added the BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). label Apr 28, 2026
@headlessNode headlessNode added Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. labels Apr 28, 2026
@stdlib-bot

stdlib-bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/zcartesian-square $\\color{green}492/492$
$\\color{green}+0.00\\%$
$\\color{green}39/39$
$\\color{green}+0.00\\%$
$\\color{green}4/4$
$\\color{green}+0.00\\%$
$\\color{green}492/492$
$\\color{green}+0.00\\%$

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

@kgryte

kgryte commented Jun 1, 2026

Copy link
Copy Markdown
Member

@headlessNode Now that we've sorted out the other Cartesian square packages, would it make sense to go ahead and get this one over the finish line?

headlessNode and others added 2 commits June 1, 2026 23:24
---
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: na
  - task: lint_repl_help
    status: passed
  - 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
---
@headlessNode
headlessNode marked this pull request as ready for review June 1, 2026 18:55
@headlessNode
headlessNode requested a review from a team June 1, 2026 18:55
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 1, 2026
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jun 1, 2026
@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Jun 6, 2026
headlessNode and others added 3 commits June 6, 2026 11:22
---
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: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - 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: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - 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
---
@headlessNode headlessNode removed the Needs Changes Pull request which needs changes before being merged. label Jun 6, 2026
@headlessNode
headlessNode requested a review from kgryte June 6, 2026 06:33
@headlessNode headlessNode added the Needs Review A pull request which needs code review. label Jun 6, 2026
headlessNode and others added 2 commits July 23, 2026 17:56
---
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: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: passed
  - 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: missing_dependencies
  - 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
---
@headlessNode

Copy link
Copy Markdown
Member Author

@kgryte Ready for review.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jul 25, 2026
Comment thread lib/node_modules/@stdlib/blas/ext/base/zcartesian-square/lib/ndarray.js Outdated
Comment thread lib/node_modules/@stdlib/blas/ext/base/zcartesian-square/lib/ndarray.js Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/blas/ext/base/zcartesian-square/src/main.c
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/blas/ext/base/zcartesian-square/src/main.c

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

Other the question regarding implementation performance for column-major in the JS implementation, this is looking good.

@kgryte

This comment was marked as outdated.

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jul 25, 2026
@stdlib-bot

This comment was marked as outdated.

@stdlib-bot

This comment was marked as outdated.

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jul 25, 2026
@kgryte

kgryte commented Jul 25, 2026

Copy link
Copy Markdown
Member

/stdlib todo

[TODO]: Add lint support for enforcing header filename conventions

A package's primary header file and its include guard needs to match the package name, except for being in snakecase, rather than kebabcase.

We have this convention, it is so that end users have a consistent rule for how to convert a package name to a header include path. If packages are allowed to deviate from that convention, end users would need to explicitly look up the include path for each package they wanted to use, which just creates unnecessary friction.

We should both (a) document and (b) create a lint rule for enforcing filenames and potentially support separate linting for enforcing include guards (although this may be tied to us getting clang linting up and running).

When linting filenames, we'd need to distinguish between the main include and additional includes which are intended to be private. For the latter, these are allowed to have any name (e.g., see ndarray/base/unary). What should be the case is that if a package has an include folder, there should always be a header file having a path matching the package name, with the file basename being the base package name converted to snakecase. I cannot think of an exception to this rule. And if we ever needed to make an exception, we could consider, at some point in the future, adding an associated config option to a package's package.json which allows disabling the lint rule.

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jul 25, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

@kgryte, the following issue has been created: #13658

Please make any subsequent edits to the issue itself rather than by updating the todo comment.

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jul 25, 2026
headlessNode and others added 3 commits July 26, 2026 12:19
---
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: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - 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
---
@headlessNode

Copy link
Copy Markdown
Member Author

@kgryte Fixed. Ran the benchmarks, came out in favor of manual loops + reinterpretation.

@headlessNode headlessNode added the Needs Review A pull request which needs code review. label Jul 26, 2026
Comment thread lib/node_modules/@stdlib/blas/ext/base/zcartesian-square/lib/ndarray.js Outdated
Co-authored-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
@headlessNode

Copy link
Copy Markdown
Member Author

Btw for double and single-precision packages as well, the manual loops are faster.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jul 26, 2026
@kgryte

kgryte commented Jul 26, 2026

Copy link
Copy Markdown
Member

Btw for double and single-precision packages as well, the manual loops are faster.

For real-valued, this I would find surprising.

@kgryte

kgryte commented Jul 26, 2026

Copy link
Copy Markdown
Member

Btw for double and single-precision packages as well, the manual loops are faster.

If you are running against the JS implementations of dfill and dcopy, these are effectively the same as manual loops, so perf should be within noise.

If you are running against the add-ons of dfill and dcopy, I am not surprised, at least for smaller array sizes, where crossing over from JS to C has perf overhead.

Regardless, for real-valued, calling into dfill and dcopy should lead to smaller bundle sizes (in the long run). For complex-valued, that trade-off is not as obvious due to the extra reinterpretation boilerplate.

Comment thread lib/node_modules/@stdlib/blas/ext/base/zcartesian-square/lib/ndarray.js Outdated
kgryte added 2 commits July 26, 2026 02:46
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
@kgryte
kgryte merged commit a7865fd into stdlib-js:develop Jul 26, 2026
13 checks 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. 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/zcartesian-square

3 participants