From f2df170c27a4360e02192993eab65f4626c84abc Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 19 Apr 2025 17:20:17 +0530 Subject: [PATCH 1/2] test: add test cases for blas/base/dsyr --- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dsyr/lib/ndarray.js | 6 +++ .../blas/base/dsyr/test/test.ndarray.js | 46 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js index 490056e2b0e9..4c9bea5e504e 100644 --- a/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js @@ -64,6 +64,12 @@ function dsyr( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offse if ( strideX === 0 ) { throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) ); } + if ( strideA1 === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideA1 ) ); + } + if ( strideA2 === 0 ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideA2 ) ); + } if ( N === 0 || alpha === 0.0 ) { return A; } diff --git a/lib/node_modules/@stdlib/blas/base/dsyr/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dsyr/test/test.ndarray.js index 81213d71812b..fb06e5cc56f2 100644 --- a/lib/node_modules/@stdlib/blas/base/dsyr/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dsyr/test/test.ndarray.js @@ -139,6 +139,52 @@ tape( 'the function throws an error if provided an invalid fifth argument', func } }); +tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dsyr( data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, new Float64Array( data.A ), value, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dsyr( data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, new Float64Array( data.A ), data.strideA1, value, data.offsetA ); + }; + } +}); + tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (row-major, upper)', function test( t ) { var expected; var data; From 8623826c62a175b388197fcbb62362e4dab36b27 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 20 Apr 2025 11:49:34 +0530 Subject: [PATCH 2/2] chore: add jsdoc --- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js index 4c9bea5e504e..b45322084a3c 100644 --- a/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js @@ -43,6 +43,8 @@ var base = require( './base.js' ); * @throws {TypeError} first argument must specify whether to reference the lower or upper triangular matrix * @throws {RangeError} second argument must be a nonnegative integer * @throws {RangeError} fifth argument must be non-zero +* @throws {RangeError} eighth argument must be non-zero +* @throws {RangeError} ninth argument must be non-zero * @returns {Float64Array} `A` * * @example