Skip to content

feat: add blas/ext/base/gvander#10934

Open
headlessNode wants to merge 13 commits intostdlib-js:developfrom
headlessNode:gvander
Open

feat: add blas/ext/base/gvander#10934
headlessNode wants to merge 13 commits intostdlib-js:developfrom
headlessNode:gvander

Conversation

@headlessNode
Copy link
Copy Markdown
Member

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

Description

What is the purpose of this pull request?

This pull request:

  • add blas/ext/base/gvander

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

@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 Mar 14, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Mar 14, 2026

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/gvander $\color{red}555/557$
$\color{green}+-0.00%$
$\color{red}68/69$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{red}555/557$
$\color{green}+-0.00%$

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

@headlessNode headlessNode added Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. labels Mar 14, 2026
@headlessNode headlessNode requested a review from kgryte March 14, 2026 16:12
---
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: 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: 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 removed the Needs Changes Pull request which needs changes before being merged. label Mar 20, 2026
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Mar 21, 2026
---
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: 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 headlessNode requested a review from kgryte March 22, 2026 16:13
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Apr 7, 2026
Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment on lines +142 to +148
io = offsetOut + ( i1*strideOut2 );
ix = offsetX;
for ( i0 = 0; i0 < S0; i0++ ) {
out[ io ] = out[ io+strideOut2 ] * x[ ix ];
ix += sx;
io += strideOut1;
}
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 you can improve the cache locality of these loops. Namely, by always walking backward. Right now, you (1) start at the beginning of a column, (2) march to the end, (3) move to the previous column, and (4) repeat. Better would be to start at the end of a column, march to the beginning, and then move to the end of the previous column. When you do it this way, you can use the do# variables and avoid the need for doing multiplication AND addition to compute offsets.

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.

Doing it as described will then make these loops the exact opposite of the mode > 0 case where, e.g., io -= do0 and io -= do1, etc.

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment on lines +104 to +114
io = offsetOut + ( ( S0-1 ) * strideOut2 );
for ( i1 = 0; i1 < S1; i1++ ) {
out[ io ] = 1.0;
io -= do0;
for ( i0 = 1; i0 < S0; i0++ ) {
out[ io ] = out[ io+do0 ] * x[ ix ];
io -= do0;
}
ix += sx;
io += do1;
}
Copy link
Copy Markdown
Member

@kgryte kgryte Apr 7, 2026

Choose a reason for hiding this comment

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

Similar to the comment below. Currently, you are going to the end of a row, working back to the beginning, and then moving to the next row. Better would be start at the end of the last row, work back to the beginning, and move to the end of the previous row.

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.

Doing it this way should simplify your increment update logic.

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.

All relevant changes to base.js will need to be propagated here.

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Left another round of comments.

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 7, 2026

For METR,

review_time: 30 mins

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Apr 7, 2026
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. Needs Changes Pull request which needs changes before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add blas/ext/base/gvander

3 participants