Skip to content

Commit

Permalink
update: dznrm2 test-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gururaj1512 committed Oct 1, 2024
1 parent 640567c commit 489c656
Showing 1 changed file with 52 additions and 36 deletions.
88 changes: 52 additions & 36 deletions lib/node_modules/@stdlib/blas/base/dznrm2/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,64 +107,80 @@ tape( 'the function computes the L2-norm', function test( t ) {
isApprox( t, actual, expected, 2.0 );

zx = new Complex128Array([
1e147, // 1
0, // 1
0, // 2
1e147, // 2
1e148, // 3
0, // 3
0, // 4
1e150 // 4
1E150, // 1
1E150, // 1
1E150, // 2
1E150, // 2
1E150, // 3
1E150, // 3
1E150, // 4
1E150 // 4
]);
expected = 1.0e+150;
expected = 2.828E+150;

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

zx = new Complex128Array([
1e-155, // 1
0, // 1
1e-160, // 2
0, // 2
0, // 3
0, // 3
1e-163, // 4
0 // 4
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 = 1.0e-155;
expected = 2.828E-155;

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

zx = new Complex128Array([
1e-155, // 1
1e147, // 1
1e155, // 2
1e-148, // 2
1e149, // 3
1e160, // 3
1e-147, // 4
1e-155 // 4
1E150, // 1
1E50, // 1
1E150, // 2
1E50, // 2
1E150, // 3
1E50, // 3
1E150, // 4
1E50 // 4
]);
expected = 1.0e160;
expected = 2e150;

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

zx = new Complex128Array([
12345678e-155, // 1
12345678e-160, // 1
0, // 2
0, // 2
0, // 3
0, // 3
12345678e-160, // 4
12345678e-165 // 4
1E-155, // 1
1E50, // 1
1E-155, // 2
1E50, // 2
1E-155, // 3
1E50, // 3
1E-155, // 4
1E50 // 4
]);
expected = 1.23e-147;
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

0 comments on commit 489c656

Please sign in to comment.