Skip to content

Conversation

@nakul-krishnakumar
Copy link
Member

Resolves None.

Description

What is the purpose of this pull request?

This pull request:

  • Adds blas/ext/base/drssors.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • None.

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

None.


@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: passed
  - task: lint_c_examples
    status: passed
  - task: lint_c_benchmarks
    status: passed
  - 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
---
…hmark name

---
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: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - 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: na
  - task: lint_license_headers
    status: passed
---
@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 Dec 16, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 16, 2025

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/drssors $\color{red}393/404$
$\color{green}+0.00%$
$\color{red}19/23$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{red}393/404$
$\color{green}+0.00%$

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

@kgryte kgryte added the Feature Issue or pull request for adding a new feature. label Dec 16, 2025
Signed-off-by: Nakul Krishnakumar <[email protected]>
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Dec 27, 2025

# drssors

> Calculate the [residual sum of squares][wikipedia-residual-sum-of-squares] of two double-precision floating-point strided arrays, ignoring `NaN` values and using an ordinary recursive summation.
Copy link
Member

Choose a reason for hiding this comment

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

@nakul-krishnakumar If this package is supposed to ignore NaN values, it is misnamed. It should be dnanrssors. For drssors, we shouldn't have any special NaN handling.

Accordingly, in order to avoid unnecessary work, I suggest simply renaming this package (and all aliases) from drssors to dnanrssors.

y = new Float64Array( [ -1.0e-15, -1.0e-15, -1.0e-15, -1.0e-15 ] );

z = drssors( x.length, x, 1, y, 1 );
t.strictEqual( z, 1.6e-29, 'returns expected value' );
Copy link
Member

Choose a reason for hiding this comment

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

These expected values were computed how? Did you test against a reference implementation? Calculate by hand? Something else?

In general, we prefer avoiding magic numbers in test cases. For example, if computed by hand, one might add a comment like

// Test against textbook formula: ( (1+1) + (1+1) + (1+1) + (1+1) )^2 * (10^-15)^2

Otherwise, future readers are liable to simply assume that you either made the numbers up or you simply performed a circular test (i.e., the "expected" value is computed the implementation you are wanting to test). TL;DR: test cases should be generated independently of the implementation, and, where possible, we should document how they were computed, if it is not immediately obvious or the implementation cannot be inlined.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kgryte These were actually calculated using a reference implementation, from next time I will make sure to properly document the computation. Thank you for the suggestion :)

var y;
var z;

x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 0.0, 3.0 ] );
Copy link
Member

Choose a reason for hiding this comment

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

Your implementation is designed to ignore NaN values, and yet your tests do not test for this behavior at all. They all contain only non-NaN values. You should study stats/strided for how we test against nan* and non-nan variants.

Copy link
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 initial comments.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Dec 27, 2025
@nakul-krishnakumar
Copy link
Member Author

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jan 10, 2026
@stdlib-bot
Copy link
Contributor

/stdlib update-copyright-years

@nakul-krishnakumar, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jan 10, 2026
@kgryte
Copy link
Member

kgryte commented Jan 10, 2026

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Jan 10, 2026
@kgryte kgryte added Needs Review A pull request which needs code review. and removed Needs Changes Pull request which needs changes before being merged. labels Jan 10, 2026
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Jan 10, 2026
@kgryte kgryte added the bot: Update Copyright Years Pull request needing the copyright years of its files updated. label Jan 10, 2026
@stdlib-bot stdlib-bot added bot: In Progress Pull request is currently awaiting automation. and removed bot: Update Copyright Years Pull request needing the copyright years of its files updated. labels Jan 10, 2026
@kgryte
Copy link
Member

kgryte commented Jan 10, 2026

@nakul-krishnakumar Lint failures.

@nakul-krishnakumar
Copy link
Member Author

This PR is WIP.

@nakul-krishnakumar nakul-krishnakumar marked this pull request as draft January 10, 2026 12:36
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Jan 10, 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). bot: In Progress Pull request is currently awaiting automation. Feature Issue or pull request for adding a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants