From 3147b4e9ea16cf468cc19897449d454910bcc7e6 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 1 Jun 2025 22:38:03 +0530 Subject: [PATCH 1/4] test: add test cases for blas/base/dtrmv --- 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: 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 --- --- .../dtrmv/test/fixtures/column_major_ox.json | 16 +++++++ .../dtrmv/test/fixtures/row_major_ox.json | 16 +++++++ .../blas/base/dtrmv/test/test.ndarray.js | 44 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json diff --git a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json new file mode 100644 index 000000000000..ac7488470fb1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 2, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 2.0, 2.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, 0.0, 1.0, 4.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json new file mode 100644 index 000000000000..2d728e26a2a1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 2, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 2.0, 1.0, 1.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, 0.0, 1.0, 4.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrmv/test/test.ndarray.js index c149073ce62c..cad6540ecf9e 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrmv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dtrmv/test/test.ndarray.js @@ -40,6 +40,7 @@ var rutu = require( './fixtures/row_major_u_t_u.json' ); var rxt = require( './fixtures/row_major_xt.json' ); var rxn = require( './fixtures/row_major_xn.json' ); var roa = require( './fixtures/row_major_oa.json' ); +var rox = require( './fixtures/row_major_ox.json' ); var rsa1sa2 = require( './fixtures/row_major_sa1_sa2.json' ); var rsa1nsa2 = require( './fixtures/row_major_sa1n_sa2.json' ); var rsa1sa2n = require( './fixtures/row_major_sa1_sa2n.json' ); @@ -57,6 +58,7 @@ var cutu = require( './fixtures/column_major_u_t_u.json' ); var cxt = require( './fixtures/column_major_xt.json' ); var cxn = require( './fixtures/column_major_xn.json' ); var coa = require( './fixtures/column_major_oa.json' ); +var cox = require( './fixtures/column_major_ox.json' ); var csa1sa2 = require( './fixtures/column_major_sa1_sa2.json' ); var csa1nsa2 = require( './fixtures/column_major_sa1n_sa2.json' ); var csa1sa2n = require( './fixtures/column_major_sa1_sa2n.json' ); @@ -938,6 +940,48 @@ tape( 'the function supports a negative `x` stride (column-major)', function tes t.end(); }); +tape( 'the function supports an `x` offset (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rox; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrmv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` offset (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cox; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrmv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports complex access patterns (row-major)', function test( t ) { var expected; var data; From 14afc952a9b339ea9646c8b9eadaffae7e6589ad Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Tue, 3 Jun 2025 11:42:33 +0530 Subject: [PATCH 2/4] chore: change test structure Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../dtrmv/test/fixtures/column_major_ox.json | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json index ac7488470fb1..c2e9d726668a 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json +++ b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json @@ -1,16 +1,21 @@ { "order": "column-major", + "uplo": "lower", "trans": "no-transpose", "diag": "unit", - "uplo": "lower", - "strideX": 1, - "offsetA": 0, - "offsetX": 2, + "N": 3, + "A": [ 1.0, 2.0, 2.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 ], + "A_mat": [ + [ 1.0, 2.0, 2.0 ], + [ 0.0, 1.0, 1.0 ], + [ 0.0, 0.0, 1.0 ] + ], "LDA": 3, "strideA1": 1, "strideA2": 3, - "N": 3, - "A": [ 1.0, 2.0, 2.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 ], + "offsetA": 0, "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "strideX": 1, + "offsetX": 2, "x_out": [ 0.0, 0.0, 1.0, 4.0, 7.0 ] } From 2e7608bdcbb88b9bc4c8ebe51c0b14a07ec82114 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Tue, 3 Jun 2025 11:44:18 +0530 Subject: [PATCH 3/4] chore: change test structure Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../base/dtrmv/test/fixtures/row_major_ox.json | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json index 2d728e26a2a1..f08489a505cb 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json +++ b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/row_major_ox.json @@ -1,16 +1,21 @@ { "order": "row-major", + "uplo": "lower", "trans": "no-transpose", "diag": "unit", - "uplo": "lower", - "strideX": 1, - "offsetA": 0, - "offsetX": 2, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 2.0, 1.0, 1.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 2.0, 1.0, 0.0 ], + [ 2.0, 1.0, 1.0 ] + ], "LDA": 3, "strideA1": 3, "strideA2": 1, - "N": 3, - "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 2.0, 1.0, 1.0 ], + "offsetA": 0, "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "strideX": 1, + "offsetX": 2, "x_out": [ 0.0, 0.0, 1.0, 4.0, 7.0 ] } From 0402e3f6a0ad8a093d2c6a4711e101591e4e3b82 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 7 Jun 2025 19:12:31 +0530 Subject: [PATCH 4/4] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../blas/base/dtrmv/test/fixtures/column_major_ox.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json index c2e9d726668a..8ff7cf3d1cfc 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json +++ b/lib/node_modules/@stdlib/blas/base/dtrmv/test/fixtures/column_major_ox.json @@ -6,9 +6,9 @@ "N": 3, "A": [ 1.0, 2.0, 2.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 ], "A_mat": [ - [ 1.0, 2.0, 2.0 ], - [ 0.0, 1.0, 1.0 ], - [ 0.0, 0.0, 1.0 ] + [ 1.0, 0.0, 0.0 ], + [ 2.0, 1.0, 0.0 ], + [ 2.0, 1.0, 1.0 ] ], "LDA": 3, "strideA1": 1,