From fcb71c8ddf5bffb4d403bae826f7ecfe89540bf3 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Fri, 23 Aug 2024 14:31:20 +0530 Subject: [PATCH] test: add test suite for stpmv --- .../blas/base/stpmv/docs/types/test.ts | 42 +- .../column_major_complex_access_pattern.json | 14 + .../test/fixtures/column_major_l_nt_nu.json | 14 + .../test/fixtures/column_major_l_nt_u.json | 14 + .../test/fixtures/column_major_l_t_nu.json | 14 + .../test/fixtures/column_major_l_t_u.json | 14 + .../stpmv/test/fixtures/column_major_oap.json | 14 + .../stpmv/test/fixtures/column_major_ox.json | 14 + .../stpmv/test/fixtures/column_major_sap.json | 14 + .../test/fixtures/column_major_sapn.json | 14 + .../test/fixtures/column_major_u_nt_nu.json | 14 + .../test/fixtures/column_major_u_nt_u.json | 14 + .../test/fixtures/column_major_u_t_nu.json | 14 + .../test/fixtures/column_major_u_t_u.json | 14 + .../stpmv/test/fixtures/column_major_xn.json | 14 + .../stpmv/test/fixtures/column_major_xp.json | 14 + .../row_major_complex_access_pattern.json | 14 + .../test/fixtures/row_major_l_nt_nu.json | 14 + .../stpmv/test/fixtures/row_major_l_nt_u.json | 14 + .../stpmv/test/fixtures/row_major_l_t_nu.json | 14 + .../stpmv/test/fixtures/row_major_l_t_u.json | 14 + .../stpmv/test/fixtures/row_major_oap.json | 14 + .../stpmv/test/fixtures/row_major_ox.json | 14 + .../stpmv/test/fixtures/row_major_sap.json | 14 + .../stpmv/test/fixtures/row_major_sapn.json | 14 + .../test/fixtures/row_major_u_nt_nu.json | 14 + .../stpmv/test/fixtures/row_major_u_nt_u.json | 14 + .../stpmv/test/fixtures/row_major_u_t_nu.json | 14 + .../stpmv/test/fixtures/row_major_u_t_u.json | 14 + .../stpmv/test/fixtures/row_major_xn.json | 14 + .../stpmv/test/fixtures/row_major_xp.json | 14 + .../@stdlib/blas/base/stpmv/test/test.js | 82 ++ .../blas/base/stpmv/test/test.ndarray.js | 940 ++++++++++++++++++ .../blas/base/stpmv/test/test.stpmv.js | 697 +++++++++++++ 34 files changed, 2160 insertions(+), 21 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_complex_access_pattern.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_oap.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_ox.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sap.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sapn.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xn.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xp.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_complex_access_pattern.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_oap.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_ox.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sap.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sapn.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xn.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xp.json create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/stpmv/test/test.stpmv.js diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/stpmv/docs/types/test.ts index 4cb29e583ee..69af3cb705d 100644 --- a/lib/node_modules/@stdlib/blas/base/stpmv/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/stpmv/docs/types/test.ts @@ -23,16 +23,16 @@ import stpmv = require( './index' ); // The function returns a Float32Array... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectType Float32Array } // The compiler throws an error if the function is provided a first argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 10, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError stpmv( true, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError @@ -46,8 +46,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a second argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 'row-major', 10, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError stpmv( 'row-major', true, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError @@ -61,8 +61,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a third argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 'row-major', 'upper', 10, 'unit', 10, AP, x, 1 ); // $ExpectError stpmv( 'row-major', 'upper', true, 'unit', 10, AP, x, 1 ); // $ExpectError @@ -76,8 +76,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a fourth argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 'row-major', 'upper', 'no-transpose', 10, 10, AP, x, 1 ); // $ExpectError stpmv( 'row-major', 'upper', 'no-transpose', true, 10, AP, x, 1 ); // $ExpectError @@ -91,8 +91,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a fifth argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 'row-major', 'upper', 'no-transpose', 'unit', '10', AP, x, 1 ); // $ExpectError stpmv( 'row-major', 'upper', 'no-transpose', 'unit', true, AP, x, 1 ); // $ExpectError @@ -119,7 +119,7 @@ import stpmv = require( './index' ); stpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, ( x: number ): number => x, x, 1 ); // $ExpectError } -// The compiler throws an error if the function is provided an seventh argument which is not a Float32Array... +// The compiler throws an error if the function is provided a seventh argument which is not a Float32Array... { const AP = new Float32Array( 55 ); @@ -134,10 +134,10 @@ import stpmv = require( './index' ); stpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, ( x: number ): number => x, 1 ); // $ExpectError } -// The compiler throws an error if the function is provided a eighth argument which is not a number... +// The compiler throws an error if the function is provided an eighth argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, '10' ); // $ExpectError stpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, true ); // $ExpectError @@ -151,8 +151,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided an unsupported number of arguments... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv(); // $ExpectError stpmv( 'row-major' ); // $ExpectError @@ -167,16 +167,16 @@ import stpmv = require( './index' ); // Attached to main export is an `ndarray` method which returns a Float32Array... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectType Float32Array } // The compiler throws an error if the function is provided a first argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 10, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError stpmv.ndarray( true, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError @@ -190,8 +190,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a second argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 10, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError stpmv.ndarray( 'row-major', true, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError @@ -205,8 +205,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a third argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 10, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', true, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError @@ -220,8 +220,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a fourth argument which is not a string... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 10, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', 'no-transpose', true, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError @@ -235,8 +235,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a fifth argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', '10', AP, 1, 0, x, 1, 0 ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', true, AP, 1, 0, x, 1, 0 ); // $ExpectError @@ -265,8 +265,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a seventh argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, '10', 0, x, 1, 0 ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, true, 0, x, 1, 0 ); // $ExpectError @@ -280,8 +280,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided an eighth argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, '10', x, 1, 0 ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, true, x, 1, 0 ); // $ExpectError @@ -310,8 +310,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided a tenth argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, '10', 0 ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, true, 0 ); // $ExpectError @@ -325,8 +325,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided an eleventh argument which is not a number... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, '10' ); // $ExpectError stpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, true ); // $ExpectError @@ -340,8 +340,8 @@ import stpmv = require( './index' ); // The compiler throws an error if the function is provided an unsupported number of arguments... { - const x = new Float32Array( 10 ); const AP = new Float32Array( 55 ); + const x = new Float32Array( 10 ); stpmv.ndarray(); // $ExpectError stpmv.ndarray( 'row-major', 'upper' ); // $ExpectError diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 00000000000..01cc55ae264 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": -2, + "offsetX": 5, + "strideAP": -2, + "offsetAP": 11, + "N": 3, + "AP": [ 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ], + "x_out": [ 0.0, 3.0, 0.0, 8.0, 0.0, 14.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_nu.json new file mode 100644 index 00000000000..e35f3375eb0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_u.json new file mode 100644 index 00000000000..7b29a3371e3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 2.0, 1.0, 1.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_nu.json new file mode 100644 index 00000000000..f6c7efdc047 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 23.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_u.json new file mode 100644 index 00000000000..7f571c393b2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_l_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_oap.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_oap.json new file mode 100644 index 00000000000..82c23f3d92b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_oap.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideAP": 2, + "offsetAP": 7, + "strideX": 1, + "offsetX": 0, + "N": 3, + "AP": [ 999, 999, 999, 999, 999, 999, 999, 1, 999, 2, 999, 3, 999, 4, 999, 5, 999, 6 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_ox.json new file mode 100644 index 00000000000..14ccaec2ee5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_ox.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, 0.0, 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sap.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sap.json new file mode 100644 index 00000000000..1bb840281a5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sap.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 2, + "offsetAP": 1, + "N": 3, + "AP": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sapn.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sapn.json new file mode 100644 index 00000000000..f6f810e4c1d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_sapn.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": -2, + "offsetAP": 11, + "N": 3, + "AP": [ 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_nu.json new file mode 100644 index 00000000000..c621fb61f1b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 4.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 23.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_u.json new file mode 100644 index 00000000000..ffacc5aef02 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_nu.json new file mode 100644 index 00000000000..777eafea429 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 4.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_u.json new file mode 100644 index 00000000000..056272e6b7d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_u_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xn.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xn.json new file mode 100644 index 00000000000..73cb7c4e803 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xn.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": -1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 3.0, 2.0, 1.0 ], + "x_out": [ 10.0, 4.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xp.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xp.json new file mode 100644 index 00000000000..19bf4a38f00 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/column_major_xp.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 2, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ], + "x_out": [ 1.0, 0.0, 4.0, 0.0, 10.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 00000000000..e338e7f340b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 2, + "offsetX": 1, + "strideAP": -2, + "offsetAP": 10, + "N": 3, + "AP": [ 1.0, 0.0, 4.0, 0.0, 3.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ], + "x_out": [ 0.0, 14.0, 0.0, 14.0, 0.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_nu.json new file mode 100644 index 00000000000..df5e2230a8f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 8.0, 32.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_u.json new file mode 100644 index 00000000000..4ed4aa133fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 2.0, 1.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_nu.json new file mode 100644 index 00000000000..24e005f3a23 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 17.0, 21.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_u.json new file mode 100644 index 00000000000..90af9a19d70 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_l_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 4.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_oap.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_oap.json new file mode 100644 index 00000000000..5680582d918 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_oap.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideAP": 2, + "offsetAP": 6, + "strideX": 1, + "offsetX": 0, + "N": 3, + "AP": [ 999, 999, 999, 999, 999, 999, 1, 999, 2, 999, 4, 999, 3, 999, 5, 999, 6, 999 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_ox.json new file mode 100644 index 00000000000..64e8de1ab2e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_ox.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 4.0, 1.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, 0.0, 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sap.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sap.json new file mode 100644 index 00000000000..444a19fb7d1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sap.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 2, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 4.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sapn.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sapn.json new file mode 100644 index 00000000000..b27f3bad342 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_sapn.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": -2, + "offsetAP": 10, + "N": 3, + "AP": [ 1.0, 0.0, 4.0, 0.0, 3.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_nu.json new file mode 100644 index 00000000000..2b3d75672bb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 23.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_u.json new file mode 100644 index 00000000000..a91c7d3b78c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_nu.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_nu.json new file mode 100644 index 00000000000..18f81f46fa6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_u.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_u.json new file mode 100644 index 00000000000..052268b1780 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_u_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xn.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xn.json new file mode 100644 index 00000000000..5d59b8a7503 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xn.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": -1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xp.json b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xp.json new file mode 100644 index 00000000000..34345f902ef --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/fixtures/row_major_xp.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 2, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ], + "x_out": [ 1.0, 0.0, 4.0, 0.0, 10.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/test.js b/lib/node_modules/@stdlib/blas/base/stpmv/test/test.js new file mode 100644 index 00000000000..9cc9fc894c4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var stpmv = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof stpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof stpmv.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var stpmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( stpmv, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var stpmv; + var main; + + main = require( './../lib/stpmv.js' ); + + stpmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( stpmv, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/stpmv/test/test.ndarray.js new file mode 100644 index 00000000000..e978503e1d3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/test.ndarray.js @@ -0,0 +1,940 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float32Array = require( '@stdlib/array/float32' ); +var stpmv = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var rlntnu = require( './fixtures/row_major_l_nt_nu.json' ); +var rltnu = require( './fixtures/row_major_l_t_nu.json' ); +var rlntu = require( './fixtures/row_major_l_nt_u.json' ); +var rltu = require( './fixtures/row_major_l_t_u.json' ); +var runtnu = require( './fixtures/row_major_u_nt_nu.json' ); +var runtu = require( './fixtures/row_major_u_nt_u.json' ); +var rutnu = require( './fixtures/row_major_u_t_nu.json' ); +var rutu = require( './fixtures/row_major_u_t_u.json' ); +var rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var rsap = require( './fixtures/row_major_sap.json' ); +var rsapn = require( './fixtures/row_major_sapn.json' ); +var roap = require( './fixtures/row_major_oap.json' ); +var rcap = require( './fixtures/row_major_complex_access_pattern.json' ); + +var clntnu = require( './fixtures/column_major_l_nt_nu.json' ); +var cltnu = require( './fixtures/column_major_l_t_nu.json' ); +var clntu = require( './fixtures/column_major_l_nt_u.json' ); +var cltu = require( './fixtures/column_major_l_t_u.json' ); +var cuntnu = require( './fixtures/column_major_u_nt_nu.json' ); +var cuntu = require( './fixtures/column_major_u_nt_u.json' ); +var cutnu = require( './fixtures/column_major_u_t_nu.json' ); +var cutu = require( './fixtures/column_major_u_t_u.json' ); +var cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var csap = require( './fixtures/column_major_sap.json' ); +var csapn = require( './fixtures/column_major_sapn.json' ); +var coap = require( './fixtures/column_major_oap.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof stpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 11', function test( t ) { + t.strictEqual( stpmv.length, 11, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( value, data.uplo, data.trans, data.diag, data.N, new Float32Array( data.AP ), data.strideAP, data.offsetAP, new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( data.order, value, data.trans, data.diag, data.N, new Float32Array( data.AP ), data.strideAP, data.offsetAP, new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( data.order, data.uplo, value, data.diag, data.N, new Float32Array( data.AP ), data.strideAP, data.offsetAP, new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( data.order, data.uplo, data.trans, value, data.N, new Float32Array( data.AP ), data.strideAP, data.offsetAP, new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + -1, + -2, + -3 + ]; + + 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() { + stpmv( data.order, data.uplo, data.trans, data.diag, value, new Float32Array( data.AP ), data.strideAP, data.offsetAP, new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventh argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + 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() { + stpmv( data.order, data.uplo, data.trans, data.diag, data.N, new Float32Array( data.AP ), value, data.offsetAP, new Float32Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + 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() { + stpmv( data.order, data.uplo, data.trans, data.diag, data.N, new Float32Array( data.AP ), data.strideAP, data.offsetAP, new Float32Array( data.x ), value, data.offsetX ); + }; + } +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input vector', function test( t ) { + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxp; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxp; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 a negative `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxn; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxn; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying an `x` offset (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rox; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying an `x` offset (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cox; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying a stride for `AP` (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rsap; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying a stride for `AP` (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = csap; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying a negative stride for `AP` (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rsapn; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying a negative stride for `AP` (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = csapn; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying an offset for `AP` (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = roap; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 specifying an offset for `AP` (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = coap; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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; + var out; + var ap; + var x; + + data = rcap; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ccap; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/stpmv/test/test.stpmv.js b/lib/node_modules/@stdlib/blas/base/stpmv/test/test.stpmv.js new file mode 100644 index 00000000000..dd8a7e2d5ce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/stpmv/test/test.stpmv.js @@ -0,0 +1,697 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float32Array = require( '@stdlib/array/float32' ); +var stpmv = require( './../lib/stpmv.js' ); + + +// FIXTURES // + +var rlntnu = require( './fixtures/row_major_l_nt_nu.json' ); +var rltnu = require( './fixtures/row_major_l_t_nu.json' ); +var rlntu = require( './fixtures/row_major_l_nt_u.json' ); +var rltu = require( './fixtures/row_major_l_t_u.json' ); +var runtnu = require( './fixtures/row_major_u_nt_nu.json' ); +var runtu = require( './fixtures/row_major_u_nt_u.json' ); +var rutnu = require( './fixtures/row_major_u_t_nu.json' ); +var rutu = require( './fixtures/row_major_u_t_u.json' ); +var rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); + +var clntnu = require( './fixtures/column_major_l_nt_nu.json' ); +var cltnu = require( './fixtures/column_major_l_t_nu.json' ); +var clntu = require( './fixtures/column_major_l_nt_u.json' ); +var cltu = require( './fixtures/column_major_l_t_u.json' ); +var cuntnu = require( './fixtures/column_major_u_nt_nu.json' ); +var cuntu = require( './fixtures/column_major_u_nt_u.json' ); +var cutnu = require( './fixtures/column_major_u_t_nu.json' ); +var cutu = require( './fixtures/column_major_u_t_u.json' ); +var cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof stpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( stpmv.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( value, data.uplo, data.trans, data.diag, data.N, new Float32Array( data.AP ), new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( data.order, value, data.trans, data.diag, data.N, new Float32Array( data.AP ), new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( data.order, data.uplo, value, data.diag, data.N, new Float32Array( data.AP ), new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + stpmv( data.order, data.uplo, data.trans, value, data.N, new Float32Array( data.AP ), new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + -1, + -2, + -3 + ]; + + 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() { + stpmv( data.order, data.uplo, data.trans, data.diag, value, new Float32Array( data.AP ), new Float32Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + 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() { + stpmv( data.order, data.uplo, data.trans, data.diag, data.N, new Float32Array( data.AP ), new Float32Array( data.x ), value ); + }; + } +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutnu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input vector', function test( t ) { + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutu; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxp; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxp; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxn; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxn; + + ap = new Float32Array( data.AP ); + x = new Float32Array( data.x ); + + expected = new Float32Array( data.x_out ); + + out = stpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +});