Skip to content

Commit 981c7ba

Browse files
committed
fix: add missing checks for N and address failing tests stemming from refactoring
Previous refactorings extracted out the `alpha*N` computation. In general, this improves accuracy; however, ORS and pairwise summation are still off, just less off than before, due to castrophic cancellation. --- 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: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e030bba commit 981c7ba

File tree

78 files changed

+135
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+135
-63
lines changed

lib/node_modules/@stdlib/blas/ext/base/dapxsum/test/test.dapxsum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
6161

6262
x = new Float64Array( [ 1.0, 1e100, 1.0, -1.0e100 ] );
6363
v = dapxsum( x.length, 5.0, x, 1 );
64-
t.strictEqual( v, 12.0, 'returns expected value' );
64+
t.strictEqual( v, 22.0, 'returns expected value' );
6565

6666
t.end();
6767
});

lib/node_modules/@stdlib/blas/ext/base/dapxsum/test/test.dapxsum.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
179179

180180
x = new Float64Array( [ 1.0, 1.0e100, 1.0, -1.0e100 ] );
181181
v = dapxsum( x.length, 5.0, x, 1 );
182-
t.strictEqual( v, 12.0, 'returns expected value' );
182+
t.strictEqual( v, 22.0, 'returns expected value' );
183183

184184
t.end();
185185
});

lib/node_modules/@stdlib/blas/ext/base/dapxsum/test/test.ndarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
6161

6262
x = new Float64Array( [ 1.0, 1.0e100, 1.0, -1.0e100 ] );
6363
v = dapxsum( x.length, 5.0, x, 1, 0 );
64-
t.strictEqual( v, 12.0, 'returns expected value' );
64+
t.strictEqual( v, 22.0, 'returns expected value' );
6565

6666
t.end();
6767
});

lib/node_modules/@stdlib/blas/ext/base/dapxsum/test/test.ndarray.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
7070

7171
x = new Float64Array( [ 1.0, 1.0e100, 1.0, -1.0e100 ] );
7272
v = dapxsum( x.length, 5.0, x, 1, 0 );
73-
t.strictEqual( v, 12.0, 'returns expected value' );
73+
t.strictEqual( v, 22.0, 'returns expected value' );
7474

7575
t.end();
7676
});

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/lib/ndarray.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ var dsumkbn = require( '@stdlib/blas/ext/base/dsumkbn' ).ndarray;
5252
* // returns 25.0
5353
*/
5454
function dapxsumkbn( N, alpha, x, strideX, offsetX ) {
55+
if ( N <= 0 ) {
56+
return 0.0;
57+
}
5558
return ( N * alpha ) + dsumkbn( N, x, strideX, offsetX );
5659
}
5760

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@ double API_SUFFIX(stdlib_strided_dapxsumkbn)( const CBLAS_INT N, const double al
5353
* @param offsetX starting index
5454
*/
5555
double API_SUFFIX(stdlib_strided_dapxsumkbn_ndarray)( const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
56+
if ( N <= 0 ) {
57+
return 0.0;
58+
}
5659
return ( N * alpha ) + API_SUFFIX(stdlib_strided_dsumkbn_ndarray)( N, X, strideX, offsetX );
5760
}

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/test/test.dapxsumkbn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
6161

6262
x = new Float64Array( [ 1.0, 1e100, 1.0, -1.0e100 ] );
6363
v = dapxsumkbn( x.length, 5.0, x, 1 );
64-
t.strictEqual( v, 12.0, 'returns expected value' );
64+
t.strictEqual( v, 22.0, 'returns expected value' );
6565

6666
t.end();
6767
});

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/test/test.dapxsumkbn.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
179179

180180
x = new Float64Array( [ 1.0, 1.0e100, 1.0, -1.0e100 ] );
181181
v = dapxsumkbn( x.length, 5.0, x, 1 );
182-
t.strictEqual( v, 12.0, 'returns expected value' );
182+
t.strictEqual( v, 22.0, 'returns expected value' );
183183

184184
t.end();
185185
});

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/test/test.ndarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
6161

6262
x = new Float64Array( [ 1.0, 1.0e100, 1.0, -1.0e100 ] );
6363
v = dapxsumkbn( x.length, 5.0, x, 1, 0 );
64-
t.strictEqual( v, 12.0, 'returns expected value' );
64+
t.strictEqual( v, 22.0, 'returns expected value' );
6565

6666
t.end();
6767
});

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/test/test.ndarray.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ tape( 'the function adds a constant and calculates the sum of all strided array
7070

7171
x = new Float64Array( [ 1.0, 1.0e100, 1.0, -1.0e100 ] );
7272
v = dapxsumkbn( x.length, 5.0, x, 1, 0 );
73-
t.strictEqual( v, 12.0, 'returns expected value' );
73+
t.strictEqual( v, 22.0, 'returns expected value' );
7474

7575
t.end();
7676
});

0 commit comments

Comments
 (0)