From 74adb8f78ed48494c383b614c26dc7d9c55c0883 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 06:29:10 +0000 Subject: [PATCH 1/2] test: migrate `blas/base/dspmv` to ULP-based assertions Replace the relative tolerance comparisons in the `blas/base/dspmv` tests with ULP difference testing via `@stdlib/assert/is-almost-same-value`. The `isApprox` test helper now accepts a maximum allowed ULP difference, and each affected test declares the minimum required ULP value. Across the full fixture set, every returned element matches its expected value exactly, and so the measured minimum ULP bound is zero. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01L18jqCswnBquJvPsWGZHnB --- .../blas/base/dspmv/test/test.dspmv.js | 67 ++++++++++++------- .../blas/base/dspmv/test/test.ndarray.js | 67 ++++++++++++------- 2 files changed, 88 insertions(+), 46 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js index 7328a8656fe9..f3f6406aaaf5 100644 --- a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js +++ b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js @@ -24,9 +24,8 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var ones = require( '@stdlib/array/ones' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var dspmv = require( './../lib/dspmv.js' ); @@ -54,22 +53,14 @@ var cxnyn = require( './fixtures/column_major_xnyn.json' ); * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = abs( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -198,10 +189,13 @@ tape( 'the function throws an error if provided an invalid tenth argument', func tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (row-major, sx=1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxpyp.AP ); x = new Float64Array( rxpyp.x ); y = new Float64Array( rxpyp.y ); @@ -210,7 +204,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxpyp.order, rxpyp.uplo, rxpyp.N, rxpyp.alpha, ap, x, rxpyp.strideX, rxpyp.beta, y, rxpyp.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -218,10 +212,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (column-major, sx=1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxpyp.AP ); x = new Float64Array( cxpyp.x ); y = new Float64Array( cxpyp.y ); @@ -230,7 +227,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxpyp.order, cxpyp.uplo, cxpyp.N, cxpyp.alpha, ap, x, cxpyp.strideX, cxpyp.beta, y, cxpyp.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -238,10 +235,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (row-major, sx=1, sy=2)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxoyt.AP ); x = new Float64Array( rxoyt.x ); y = new Float64Array( rxoyt.y ); @@ -250,7 +250,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxoyt.order, rxoyt.uplo, rxoyt.N, rxoyt.alpha, ap, x, rxoyt.strideX, rxoyt.beta, y, rxoyt.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -258,10 +258,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (column-major, sx=1, sy=2)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxoyt.AP ); x = new Float64Array( cxoyt.x ); y = new Float64Array( cxoyt.y ); @@ -270,7 +273,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxoyt.order, cxoyt.uplo, cxoyt.N, cxoyt.alpha, ap, x, cxoyt.strideX, cxoyt.beta, y, cxoyt.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -278,10 +281,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (row-major, sx=1, sy=-1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxpyn.AP ); x = new Float64Array( rxpyn.x ); y = new Float64Array( rxpyn.y ); @@ -290,7 +296,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxpyn.order, rxpyn.uplo, rxpyn.N, rxpyn.alpha, ap, x, rxpyn.strideX, rxpyn.beta, y, rxpyn.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -298,10 +304,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (column-major, sx=1, sy=-1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxpyn.AP ); x = new Float64Array( cxpyn.x ); y = new Float64Array( cxpyn.y ); @@ -310,7 +319,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxpyn.order, cxpyn.uplo, cxpyn.N, cxpyn.alpha, ap, x, cxpyn.strideX, cxpyn.beta, y, cxpyn.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -318,10 +327,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (row-major, sx=-1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxnyp.AP ); x = new Float64Array( rxnyp.x ); y = new Float64Array( rxnyp.y ); @@ -330,7 +342,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxnyp.order, rxnyp.uplo, rxnyp.N, rxnyp.alpha, ap, x, rxnyp.strideX, rxnyp.beta, y, rxnyp.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -338,10 +350,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix supplied in packed form (column-major, sx=-1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxnyp.AP ); x = new Float64Array( cxnyp.x ); y = new Float64Array( cxnyp.y ); @@ -350,7 +365,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxnyp.order, cxnyp.uplo, cxnyp.N, cxnyp.alpha, ap, x, cxnyp.strideX, cxnyp.beta, y, cxnyp.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -526,10 +541,13 @@ tape( 'when `α` is zero, the function scales the second input vector (column-ma tape( 'the function supports complex access patterns (row-major)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxnyn.AP.slice( rxnyn.offsetAP ) ); x = new Float64Array( rxnyn.x ); y = new Float64Array( rxnyn.y ); @@ -538,7 +556,7 @@ tape( 'the function supports complex access patterns (row-major)', function test out = dspmv( rxnyn.order, rxnyn.uplo, rxnyn.N, rxnyn.alpha, ap, x, rxnyn.strideX, rxnyn.beta, y, rxnyn.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -546,10 +564,13 @@ tape( 'the function supports complex access patterns (row-major)', function test tape( 'the function supports complex access patterns (column-major)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxnyn.AP.slice( cxnyn.offsetAP ) ); x = new Float64Array( cxnyn.x ); y = new Float64Array( cxnyn.y ); @@ -558,7 +579,7 @@ tape( 'the function supports complex access patterns (column-major)', function t out = dspmv( cxnyn.order, cxnyn.uplo, cxnyn.N, cxnyn.alpha, ap, x, cxnyn.strideX, cxnyn.beta, y, cxnyn.strideY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js index e02d81ec309e..0d4386a86cf4 100644 --- a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js @@ -24,9 +24,8 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var ones = require( '@stdlib/array/ones' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var dspmv = require( './../lib/ndarray.js' ); @@ -54,22 +53,14 @@ var cxnyn = require( './fixtures/column_major_xnyn.json' ); * @param {Object} t - test object * @param {Collection} actual - actual values * @param {Collection} expected - expected values -* @param {number} rtol - relative tolerance +* @param {NonNegativeInteger} ulp - maximum allowed ULP difference */ -function isApprox( t, actual, expected, rtol ) { - var delta; - var tol; +function isApprox( t, actual, expected, ulp ) { var i; t.strictEqual( actual.length, expected.length, 'returns expected value' ); for ( i = 0; i < expected.length; i++ ) { - if ( actual[ i ] === expected[ i ] ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } else { - delta = abs( actual[ i ] - expected[ i ] ); - tol = rtol * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' ); } } @@ -198,10 +189,13 @@ tape( 'the function throws an error if provided an invalid twelfth argument', fu tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (row-major, sx=1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxpyp.AP ); x = new Float64Array( rxpyp.x ); y = new Float64Array( rxpyp.y ); @@ -210,7 +204,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxpyp.order, rxpyp.uplo, rxpyp.N, rxpyp.alpha, ap, rxpyp.offsetAP, x, rxpyp.strideX, rxpyp.offsetX, rxpyp.beta, y, rxpyp.strideY, rxpyp.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -218,10 +212,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (column-major, sx=1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxpyp.AP ); x = new Float64Array( cxpyp.x ); y = new Float64Array( cxpyp.y ); @@ -230,7 +227,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxpyp.order, cxpyp.uplo, cxpyp.N, cxpyp.alpha, ap, cxpyp.offsetAP, x, cxpyp.strideX, cxpyp.offsetX, cxpyp.beta, y, cxpyp.strideY, cxpyp.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -238,10 +235,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (row-major, sx=1, sy=2)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxoyt.AP ); x = new Float64Array( rxoyt.x ); y = new Float64Array( rxoyt.y ); @@ -250,7 +250,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxoyt.order, rxoyt.uplo, rxoyt.N, rxoyt.alpha, ap, rxoyt.offsetAP, x, rxoyt.strideX, rxoyt.offsetX, rxoyt.beta, y, rxoyt.strideY, rxoyt.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -258,10 +258,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (column-major, sx=1, sy=2)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxoyt.AP ); x = new Float64Array( cxoyt.x ); y = new Float64Array( cxoyt.y ); @@ -270,7 +273,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxoyt.order, cxoyt.uplo, cxoyt.N, cxoyt.alpha, ap, cxoyt.offsetAP, x, cxoyt.strideX, cxoyt.offsetX, cxoyt.beta, y, cxoyt.strideY, cxoyt.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -278,10 +281,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (row-major, sx=1, sy=-1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxpyn.AP ); x = new Float64Array( rxpyn.x ); y = new Float64Array( rxpyn.y ); @@ -290,7 +296,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxpyn.order, rxpyn.uplo, rxpyn.N, rxpyn.alpha, ap, rxpyn.offsetAP, x, rxpyn.strideX, rxpyn.offsetX, rxpyn.beta, y, rxpyn.strideY, rxpyn.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -298,10 +304,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (column-major, sx=1, sy=-1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxpyn.AP ); x = new Float64Array( cxpyn.x ); y = new Float64Array( cxpyn.y ); @@ -310,7 +319,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxpyn.order, cxpyn.uplo, cxpyn.N, cxpyn.alpha, ap, cxpyn.offsetAP, x, cxpyn.strideX, cxpyn.offsetX, cxpyn.beta, y, cxpyn.strideY, cxpyn.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -318,10 +327,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (row-major, sx=-1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxnyp.AP ); x = new Float64Array( rxnyp.x ); y = new Float64Array( rxnyp.y ); @@ -330,7 +342,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( rxnyp.order, rxnyp.uplo, rxnyp.N, rxnyp.alpha, ap, rxnyp.offsetAP, x, rxnyp.strideX, rxnyp.offsetX, rxnyp.beta, y, rxnyp.strideY, rxnyp.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -338,10 +350,13 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `n` element vectors, and `A` is an `n` by `n` symmetric matrix supplied in packed form (column-major, sx=-1, sy=1)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxnyp.AP ); x = new Float64Array( cxnyp.x ); y = new Float64Array( cxnyp.y ); @@ -350,7 +365,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y out = dspmv( cxnyp.order, cxnyp.uplo, cxnyp.N, cxnyp.alpha, ap, cxnyp.offsetAP, x, cxnyp.strideX, cxnyp.offsetX, cxnyp.beta, y, cxnyp.strideY, cxnyp.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -526,10 +541,13 @@ tape( 'when `α` is zero, the function scales the second input vector (column-ma tape( 'the function supports complex access patterns (row-major)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( rxnyn.AP ); x = new Float64Array( rxnyn.x ); y = new Float64Array( rxnyn.y ); @@ -538,7 +556,7 @@ tape( 'the function supports complex access patterns (row-major)', function test out = dspmv( rxnyn.order, rxnyn.uplo, rxnyn.N, rxnyn.alpha, ap, rxnyn.offsetAP, x, rxnyn.strideX, rxnyn.offsetX, rxnyn.beta, y, rxnyn.strideY, rxnyn.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); @@ -546,10 +564,13 @@ tape( 'the function supports complex access patterns (row-major)', function test tape( 'the function supports complex access patterns (column-major)', function test( t ) { var expected; var out; + var ULP; var ap; var x; var y; + ULP = 0; + ap = new Float64Array( cxnyn.AP ); x = new Float64Array( cxnyn.x ); y = new Float64Array( cxnyn.y ); @@ -558,7 +579,7 @@ tape( 'the function supports complex access patterns (column-major)', function t out = dspmv( cxnyn.order, cxnyn.uplo, cxnyn.N, cxnyn.alpha, ap, cxnyn.offsetAP, x, cxnyn.strideX, cxnyn.offsetX, cxnyn.beta, y, cxnyn.strideY, cxnyn.offsetY ); t.strictEqual( out, y, 'returns expected value' ); - isApprox( t, y, expected, 2.0 ); + isApprox( t, y, expected, ULP ); t.end(); }); From 7a36f0fa12d389a2abcf62a7237dd66b86c8d02a Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 14 Oct 2026 11:59:13 +0200 Subject: [PATCH 2/2] Apply batched suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js | 1 - lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js index f3f6406aaaf5..d10b11036f68 100644 --- a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js +++ b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.dspmv.js @@ -36,7 +36,6 @@ var rxpyp = require( './fixtures/row_major_xpyp.json' ); var rxnyp = require( './fixtures/row_major_xnyp.json' ); var rxpyn = require( './fixtures/row_major_xpyn.json' ); var rxnyn = require( './fixtures/row_major_xnyn.json' ); - var cxoyt = require( './fixtures/column_major_xoyt.json' ); var cxpyp = require( './fixtures/column_major_xpyp.json' ); var cxnyp = require( './fixtures/column_major_xnyp.json' ); diff --git a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js index 0d4386a86cf4..e31c27022ba9 100644 --- a/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dspmv/test/test.ndarray.js @@ -36,7 +36,6 @@ var rxpyp = require( './fixtures/row_major_xpyp.json' ); var rxnyp = require( './fixtures/row_major_xnyp.json' ); var rxpyn = require( './fixtures/row_major_xpyn.json' ); var rxnyn = require( './fixtures/row_major_xnyn.json' ); - var cxoyt = require( './fixtures/column_major_xoyt.json' ); var cxpyp = require( './fixtures/column_major_xpyp.json' ); var cxnyp = require( './fixtures/column_major_xnyp.json' );