Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dznrm2/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,82 @@ tape( 'the function computes the L2-norm', function test( t ) {

actual = dznrm2( 3, zx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

zx = new Complex128Array([
1E150, // 1
1E150, // 1
1E150, // 2
1E150, // 2
1E150, // 3
1E150, // 3
1E150, // 4
1E150 // 4
]);
expected = 2.828E+150;

actual = dznrm2( 4, zx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

zx = new Complex128Array([
1E-155, // 1
1E-155, // 1
1E-155, // 2
1E-155, // 2
1E-155, // 3
1E-155, // 3
1E-155, // 4
1E-155 // 4
]);
expected = 2.828E-155;

actual = dznrm2( 4, zx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

zx = new Complex128Array([
1E150, // 1
1E50, // 1
1E150, // 2
1E50, // 2
1E150, // 3
1E50, // 3
1E150, // 4
1E50 // 4
]);
expected = 2e150;

actual = dznrm2( 4, zx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

zx = new Complex128Array([
1E-155, // 1
1E50, // 1
1E-155, // 2
1E50, // 2
1E-155, // 3
1E50, // 3
1E-155, // 4
1E50 // 4
]);
expected = 2E50;

actual = dznrm2( 4, zx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

zx = new Complex128Array([
1.4E-154, // 1
1.5E-154, // 1
1.4E-154, // 2
1.5E-154, // 2
1.4E-154, // 3
0, // 3
1.4E-154, // 4
0 // 4
]);
expected = 3.51E-154;

actual = dznrm2( 4, zx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

t.end();
});

Expand Down
75 changes: 75 additions & 0 deletions lib/node_modules/@stdlib/blas/base/scnrm2/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,81 @@ tape( 'the function computes the L2-norm', function test( t ) {

actual = scnrm2( 3, cx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

cx = new Complex64Array([
5E+15, // 1
5E+15, // 1
5E+15, // 2
5E+15, // 2
5E+15, // 3
5E+15, // 3
5E+15, // 4
5E+15 // 4
]);
expected = 14142135623730950;

actual = scnrm2( 4, cx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

cx = new Complex64Array([
1E-20, // 1
1E-20, // 1
1E-20, // 2
1E-20, // 2
1E-20, // 3
1E-20, // 3
1E-20, // 4
1E-20 // 4
]);
expected = 2.828427124E-20;

actual = scnrm2( 4, cx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

cx = new Complex64Array([
1E20, // 1
1E10, // 1
1E20, // 2
1E10, // 2
1E20, // 3
1E10, // 3
1E20, // 4
1E10 // 4
]);
expected = 2E20;

actual = scnrm2( 4, cx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

cx = new Complex64Array([
1E-20, // 1
1E10, // 1
1E-20, // 2
1E10, // 2
1E-20, // 3
1E10, // 3
1E-20, // 4
1E10 // 4
]);
expected = 2E10;

actual = scnrm2( 4, cx, 1, 0 );
isApprox( t, actual, expected, 2.0 );

cx = new Complex64Array([
1E-19, // 1
1.08420217E-19, // 1
1E-19, // 2
1.08420217E-19, // 2
1E-19, // 3
0, // 3
1E-19, // 4
0 // 4
]);
expected = 2.5207E-19;

actual = scnrm2( 4, cx, 1, 0 );
isApprox( t, actual, expected, 2.0 );
t.end();
});

Expand Down
Loading