From 0b7ede835f183e61884ccac5f021bb88af1874e7 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 31 May 2026 15:29:26 -0700 Subject: [PATCH] test: add element comments and sentinel values to `blas/ext/base/ndarray/zxsa` --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/ext/base/ndarray/zxsa/test/test.js | 104 ++++++++++++++++-- 1 file changed, 96 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/zxsa/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/zxsa/test/test.js index 1df839a15d18..0a1807250b53 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/zxsa/test/test.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/zxsa/test/test.js @@ -60,7 +60,18 @@ tape( 'the function subtracts a scalar constant from each element', function tes var xbuf; var x; - xbuf = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0, 2.0, 1.0 ] ); + xbuf = new Complex128Array([ + -2.0, // 0 + 1.0, // 0 + 3.0, // 1 + -5.0, // 1 + 4.0, // 2 + 0.0, // 2 + -1.0, // 3 + -3.0, // 3 + 2.0, // 4 + 1.0 // 4 + ]); x = vector( xbuf, 5, 1, 0 ); alpha = scalar2ndarray( new Complex128( 5.0, 0.0 ), { 'dtype': 'complex128' @@ -69,7 +80,18 @@ tape( 'the function subtracts a scalar constant from each element', function tes actual = zxsa( [ x, alpha ] ); t.strictEqual( actual, x, 'returns expected value' ); - expected = new Complex128Array( [ -7.0, 1.0, -2.0, -5.0, -1.0, 0.0, -6.0, -3.0, -3.0, 1.0 ] ); + expected = new Complex128Array([ + -7.0, // 0 + 1.0, // 0 + -2.0, // 1 + -5.0, // 1 + -1.0, // 2 + 0.0, // 2 + -6.0, // 3 + -3.0, // 3 + -3.0, // 4 + 1.0 // 4 + ]); t.deepEqual( xbuf, expected, 'returns expected value' ); t.end(); @@ -82,7 +104,16 @@ tape( 'the function supports an input ndarray having a non-unit stride', functio var xbuf; var x; - xbuf = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); + xbuf = new Complex128Array([ + -2.0, // 0 + 1.0, // 0 + 0.0, + 0.0, + 4.0, // 1 + 0.0, // 1 + 0.0, + 0.0 + ]); x = vector( xbuf, 2, 2, 0 ); alpha = scalar2ndarray( new Complex128( 5.0, 0.0 ), { 'dtype': 'complex128' @@ -91,7 +122,16 @@ tape( 'the function supports an input ndarray having a non-unit stride', functio actual = zxsa( [ x, alpha ] ); t.strictEqual( actual, x, 'returns expected value' ); - expected = new Complex128Array( [ -7.0, 1.0, 3.0, -5.0, -1.0, 0.0, -1.0, -3.0 ] ); + expected = new Complex128Array([ + -7.0, // 0 + 1.0, // 0 + 0.0, + 0.0, + -1.0, // 1 + 0.0, // 1 + 0.0, + 0.0 + ]); t.deepEqual( xbuf, expected, 'returns expected value' ); t.end(); @@ -104,7 +144,18 @@ tape( 'the function supports an input ndarray having a negative stride', functio var xbuf; var x; - xbuf = new Complex128Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0, 2.0, 1.0 ] ); + xbuf = new Complex128Array([ + -2.0, // 4 + 1.0, // 4 + 3.0, // 3 + -5.0, // 3 + 4.0, // 2 + 0.0, // 2 + -1.0, // 1 + -3.0, // 1 + 2.0, // 0 + 1.0 // 0 + ]); x = vector( xbuf, 5, -1, 4 ); alpha = scalar2ndarray( new Complex128( 5.0, 0.0 ), { 'dtype': 'complex128' @@ -113,7 +164,18 @@ tape( 'the function supports an input ndarray having a negative stride', functio actual = zxsa( [ x, alpha ] ); t.strictEqual( actual, x, 'returns expected value' ); - expected = new Complex128Array( [ -7.0, 1.0, -2.0, -5.0, -1.0, 0.0, -6.0, -3.0, -3.0, 1.0 ] ); + expected = new Complex128Array([ + -7.0, // 4 + 1.0, // 4 + -2.0, // 3 + -5.0, // 3 + -1.0, // 2 + 0.0, // 2 + -6.0, // 1 + -3.0, // 1 + -3.0, // 0 + 1.0 // 0 + ]); t.deepEqual( xbuf, expected, 'returns expected value' ); t.end(); @@ -126,7 +188,20 @@ tape( 'the function supports an input ndarray having a non-zero offset', functio var xbuf; var x; - xbuf = new Complex128Array( [ 1.0, 0.0, -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0, 2.0, 1.0 ] ); + xbuf = new Complex128Array([ + 0.0, + 0.0, + 0.0, + 0.0, + 3.0, // 0 + -5.0, // 0 + 4.0, // 1 + 0.0, // 1 + -1.0, // 2 + -3.0, // 2 + 0.0, + 0.0 + ]); x = vector( xbuf, 3, 1, 2 ); alpha = scalar2ndarray( new Complex128( 5.0, 0.0 ), { 'dtype': 'complex128' @@ -135,7 +210,20 @@ tape( 'the function supports an input ndarray having a non-zero offset', functio actual = zxsa( [ x, alpha ] ); t.strictEqual( actual, x, 'returns expected value' ); - expected = new Complex128Array( [ 1.0, 0.0, -2.0, 1.0, -2.0, -5.0, -1.0, 0.0, -6.0, -3.0, 2.0, 1.0 ] ); + expected = new Complex128Array([ + 0.0, + 0.0, + 0.0, + 0.0, + -2.0, // 0 + -5.0, // 0 + -1.0, // 1 + 0.0, // 1 + -6.0, // 2 + -3.0, // 2 + 0.0, + 0.0 + ]); t.deepEqual( xbuf, expected, 'returns expected value' ); t.end();