Skip to content

Commit 6100480

Browse files
committed
fix: reduce tolerance to zero and use deepequals
--- 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 ---
1 parent e935826 commit 6100480

File tree

5 files changed

+17
-48
lines changed

5 files changed

+17
-48
lines changed

lib/node_modules/@stdlib/lapack/base/dgtts2/test/fixtures/col_major_no_offset_no_trans.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
"LDB": 3,
3434

35-
"expected": [1.7455555555 , 0.017777778 , 0.25,
36-
1.9494841268814838, 0.2020634924740646 ,0.3303571422592474,
37-
1.6183333331681546, 0.526666667327381 , 0.3749999983258929]
35+
"expected": [1.7455555555 , 0.017777778 , 0.25,
36+
1.9494841268814838 , 0.2020634924740646 , 0.33035714225924745,
37+
1.6183333331681546 , 0.526666667327381 , 0.37499999832589287]
3838
}

lib/node_modules/@stdlib/lapack/base/dgtts2/test/fixtures/col_major_no_offset_trans.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
"LDB": 3,
3333

34-
"expected": [ 1.7503174605488945 ,-0.0012698421955782274, 0.2547619050488946,
35-
1.9566269844548256 ,0.1734920621806973 , 0.3494047624548257,
36-
1.6278571432659439 , 0.4885714269362245 , 0.4178571437659439]
34+
"expected": [ 1.7503174605488945 , -0.0012698421955782274 , 0.25476190504889457,
35+
1.9566269844548256 , 0.1734920621806973 , 0.34940476245482566,
36+
1.6278571432659439 , 0.48857142693622446 , 0.4178571437659439 ]
3737
}

lib/node_modules/@stdlib/lapack/base/dgtts2/test/fixtures/row_major_no_offset_no_trans.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
"LDB": 3,
3434

35-
"expected": [1.4031746026466836, 0.3769841267155612 ,0.1884920633577806,
36-
1.3873015894132654 ,0.4920634931377552, 0.2460317465688776,
37-
1.4285714242665817 ,0.8928571414221939, 0.4464285707110969]
35+
"expected": [1.4031746026466836 ,0.3769841267155612 , 0.1884920633577806,
36+
1.3873015894132654 , 0.49206349313775516, 0.24603174656887758,
37+
1.4285714242665817 , 0.8928571414221939 , 0.44642857071109693]
3838
}

lib/node_modules/@stdlib/lapack/base/dgtts2/test/fixtures/row_major_no_offset_trans.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
"LDB": 3,
3434

35-
"expected": [1.4365079379889456 ,0.3960317469111395 ,0.1980158734555697,
36-
1.2539682480442178, 0.4158730123554421, 0.2079365061777211,
37-
1.5476190504889455, 0.9404761919111395 ,0.4702380959555698]
35+
"expected": [1.4365079379889456 , 0.39603174691113946, 0.19801587345556973,
36+
1.2539682480442178 ,0.4158730123554421 , 0.20793650617772105,
37+
1.5476190504889455 , 0.9404761919111395 , 0.47023809595556976]
3838
}

lib/node_modules/@stdlib/lapack/base/dgtts2/test/test.dgtts2.js

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
var tape = require( 'tape' );
2626
var Int32Array = require( '@stdlib/array/int32' );
2727
var Float64Array = require( '@stdlib/array/float64' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
29-
var abs = require( '@stdlib/math/base/special/abs' );
3028
var dgtts2 = require( './../lib/dgtts2.js' );
3129

3230

@@ -38,35 +36,6 @@ var ROW_MAJOR_NO_OFFSET_TRANS = require( './fixtures/row_major_no_offset_trans.j
3836
var ROW_MAJOR_NO_OFFSET_NO_TRANS = require( './fixtures/row_major_no_offset_no_trans.json' );
3937

4038

41-
// FUNCTIONS //
42-
43-
/**
44-
* Tests for element-wise approximate equality.
45-
*
46-
* @private
47-
* @param {Object} t - test object
48-
* @param {Collection} actual - actual values
49-
* @param {Collection} expected - expected values
50-
* @param {number} rtol - relative tolerance
51-
*/
52-
function isApprox( t, actual, expected, rtol ) {
53-
var delta;
54-
var tol;
55-
var i;
56-
57-
t.strictEqual( actual.length, expected.length, 'returns expected value' );
58-
for ( i = 0; i < expected.length; i++ ) {
59-
if ( actual[ i ] === expected[ i ] ) {
60-
t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' );
61-
} else {
62-
delta = abs( actual[ i ] - expected[ i ] );
63-
tol = rtol * EPS * abs( expected[ i ] );
64-
t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
65-
}
66-
}
67-
}
68-
69-
7039
// TESTS //
7140

7241
tape( 'main export is a function', function test( t ) {
@@ -160,7 +129,7 @@ tape( 'the function returns the input array unchanged if N is zero', function te
160129
B = new Float64Array( data.B );
161130

162131
X = dgtts2( data.order, data.itrans, 0, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
163-
t.deepEqual( B, X );
132+
t.deepEqual( B, X, 'returns expected value' );
164133

165134
t.end();
166135
});
@@ -188,7 +157,7 @@ tape( 'the function solves A * X = B (row-major)', function test( t ) {
188157
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
189158

190159
expectedX = new Float64Array( data.expected );
191-
isApprox( t, X, expectedX, 1.0 );
160+
t.deepEqual( X, expectedX, 'returns expected value' );
192161

193162
t.end();
194163
});
@@ -216,7 +185,7 @@ tape( 'the function solves A * X = B (column-major)', function test( t ) {
216185
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
217186

218187
expectedX = new Float64Array( data.expected );
219-
isApprox( t, X, expectedX, 1.0 );
188+
t.deepEqual( X, expectedX, 'returns expected value' );
220189

221190
t.end();
222191
});
@@ -244,7 +213,7 @@ tape( 'the function solves A**T * X = B (row-major)', function test( t ) {
244213
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
245214

246215
expectedX = new Float64Array( data.expected );
247-
isApprox( t, X, expectedX, 1.5 );
216+
t.deepEqual( X, expectedX, 'returns expected value' );
248217

249218
t.end();
250219
});
@@ -272,7 +241,7 @@ tape( 'the function solves A**T * X = B (column-major)', function test( t ) {
272241
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
273242

274243
expectedX = new Float64Array( data.expected );
275-
isApprox( t, X, expectedX, 1.0 );
244+
t.deepEqual( X, expectedX, 'returns expected value' );
276245

277246
t.end();
278247
});

0 commit comments

Comments
 (0)