Skip to content

test: migrate blas/base/dspmv to ULP-based assertions - #15320

Open
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-dspmv
Open

Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-dspmv

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for blas/base/dspmv from relative tolerance testing to ULP difference testing, replacing the rtol * EPS * abs( expected ) comparisons in the isApprox helper with @stdlib/assert/is-almost-same-value. The idiom mirrors the already-migrated sibling package blas/base/dsymv.

Files changed: test/test.dspmv.js and test/test.ndarray.js. No non-test files are modified, and no test fixtures, expected values, or test cases were added, removed, or altered.

Every fixture-driven comparison in this package resolves exactly (ULP = 0), matching the result for the sibling packed/full-storage pair blas/base/dsymv. Bounds were determined by computing, for every compared element, the ULP difference between the actual and expected values via @stdlib/number/float64/base/ulp-difference, confirming a difference of 0 in every case.

test/test.dspmv.js and test/test.ndarray.js (all 10 fixture-driven assertions across both files):

Test ULP Previous rtol
row-major, sx=1, sy=1 0 2.0
column-major, sx=1, sy=1 0 2.0
row-major, sx=1, sy=2 0 2.0
column-major, sx=1, sy=2 0 2.0
row-major, sx=1, sy=-1 0 2.0
column-major, sx=1, sy=-1 0 2.0
row-major, sx=-1, sy=1 0 2.0
column-major, sx=-1, sy=1 0 2.0
complex access patterns (row-major) 0 2.0
complex access patterns (column-major) 0 2.0

Tests using exact assertions (t.strictEqual/t.deepEqual) were left unchanged. blas/base/dspmv has no native (test.native.js) test file.

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?

None.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

The bounds above were measured directly (not just probed via test runs): for each fixture, the actual output was computed by requiring the package's lib/dspmv.js and lib/ndarray.js implementations directly and diffing against the expected fixture values with @stdlib/number/float64/base/ulp-difference. The full JavaScript test suite (test/test.dspmv.js, test/test.ndarray.js, test/test.js) was then run twice at ULP = 0 with identical, fully passing results (97, 97, and 5 assertions respectively), confirming determinism.

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

This PR was authored by Claude Code. The migration follows the idiom established in the already-migrated blas/base/dsymv, and the ULP bounds were measured empirically (via direct ULP-difference computation against the fixtures) rather than guessed.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_017ehfiwCH2DcnegSenmXrSc


Generated by Claude Code

Resolves a part of #11352.

Migrates the tests for `blas/base/dspmv` from relative tolerance
testing to ULP difference testing, replacing the
`rtol * EPS * abs( expected )` comparisons in the `isApprox` helper
with `@stdlib/assert/is-almost-same-value`. The idiom mirrors the
already-migrated sibling package `blas/base/dsymv`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ehfiwCH2DcnegSenmXrSc

---
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: skipped
  - 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: na
  - 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
---
@stdlib-bot stdlib-bot added BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Good First PR A pull request resolving a Good First Issue. labels Sep 18, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/base/dspmv $\\color{green}428/428$
$\\color{green}+100.00\\%$
$\\color{green}47/47$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}428/428$
$\\color{green}+100.00\\%$

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

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Sep 22, 2026
@kgryte
kgryte marked this pull request as ready for review September 22, 2026 01:44
@kgryte
kgryte requested a review from a team September 22, 2026 01:44
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 22, 2026

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

ULP values need to be inlined.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Sep 22, 2026

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). Good First PR A pull request resolving a Good First Issue. Needs Changes Pull request which needs changes before being merged. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants