Skip to content

Commit 7dd1e0f

Browse files
committed
test: more test coverage
--- 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: passed - 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 6100480 commit 7dd1e0f

10 files changed

+276
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function dgtts2( order, itrans, N, nrhs, DL, D, DU, DU2, IPIV, B, LDB ) { // esl
7070
sb1 = 1;
7171
sb2 = LDB;
7272
} else { // order === 'row-major'
73-
if ( LDB < N ) {
73+
if ( LDB < nrhs ) {
7474
throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to %d. Value: `%d`.', N, LDB ) );
7575
}
7676
sb1 = LDB;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"order": "column-major",
3+
4+
"itrans": 0,
5+
"N": 3,
6+
"nrhs": 1,
7+
8+
"DL": [ 0.25, 0.26666667 ],
9+
"sdl": 1,
10+
"odl": 0,
11+
12+
"D": [ 4.0, 3.75, 3.73333333 ],
13+
"sd": 1,
14+
"od": 0,
15+
16+
"DU": [ 1.0, 0.73333333 ],
17+
"sdu": 1,
18+
"odu": 0,
19+
20+
"DU2": [ 0.0 ],
21+
"sdu2": 1,
22+
"odu2": 0,
23+
24+
"IPIV": [ 0, 1, 2 ],
25+
"si": 1,
26+
"oi": 0,
27+
28+
"B": [ 7.0, 8.0, 7.0 ],
29+
"sb1": 1,
30+
"sb2": 1,
31+
"ob": 0,
32+
33+
"LDB": 3,
34+
35+
"expected": [1.4031746026466836 ,1.3873015894132654 ,1.4285714242665817]
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"order": "column-major",
3+
4+
"itrans": 1,
5+
"N": 3,
6+
"nrhs": 1,
7+
8+
"DL": [ 0.25, 0.26666667 ],
9+
"sdl": 1,
10+
"odl": 0,
11+
12+
"D": [ 4.0, 3.75, 3.73333333 ],
13+
"sd": 1,
14+
"od": 0,
15+
16+
"DU": [ 1.0, 0.73333333 ],
17+
"sdu": 1,
18+
"odu": 0,
19+
20+
"DU2": [ 0.0 ],
21+
"sdu2": 1,
22+
"odu2": 0,
23+
24+
"IPIV": [ 0, 1, 2 ],
25+
"si": 1,
26+
"oi": 0,
27+
28+
"B": [ 7.0, 8.0, 7.0 ],
29+
"sb1": 1,
30+
"sb2": 1,
31+
"ob": 0,
32+
33+
"LDB": 3,
34+
35+
"expected": [1.4365079379889456, 1.2539682480442178 ,1.5476190504889455]
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"order": "column-major",
3+
4+
"itrans": 0,
5+
"N": 3,
6+
"nrhs": 1,
7+
8+
"DL": [ 0.25, 0.26666667 ],
9+
"sdl": 1,
10+
"odl": 0,
11+
12+
"D": [ 4.0, 3.75, 3.73333333 ],
13+
"sd": 1,
14+
"od": 0,
15+
16+
"DU": [ 1.0, 0.73333333 ],
17+
"sdu": 1,
18+
"odu": 0,
19+
20+
"DU2": [ 0.0 ],
21+
"sdu2": 1,
22+
"odu2": 0,
23+
24+
"IPIV": [ 0, 1, 2 ],
25+
"si": 1,
26+
"oi": 0,
27+
28+
"B": [ 7.0, 8.0, 7.0 ],
29+
"sb1": 1,
30+
"sb2": 1,
31+
"ob": 0,
32+
33+
"LDB": 1,
34+
35+
"expected": [1.4031746026466836 ,1.3873015894132654 ,1.4285714242665817]
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"order": "row-major",
3+
4+
"itrans": 1,
5+
"N": 3,
6+
"nrhs": 1,
7+
8+
"DL": [ 0.25, 0.26666667 ],
9+
"sdl": 1,
10+
"odl": 0,
11+
12+
"D": [ 4.0, 3.75, 3.73333333 ],
13+
"sd": 1,
14+
"od": 0,
15+
16+
"DU": [ 1.0, 0.73333333 ],
17+
"sdu": 1,
18+
"odu": 0,
19+
20+
"DU2": [ 0.0 ],
21+
"sdu2": 1,
22+
"odu2": 0,
23+
24+
"IPIV": [ 0, 1, 2 ],
25+
"si": 1,
26+
"oi": 0,
27+
28+
"B": [ 7.0, 8.0, 7.0 ],
29+
"sb1": 1,
30+
"sb2": 1,
31+
"ob": 0,
32+
33+
"LDB": 1,
34+
35+
"expected": [1.4365079379889456, 1.2539682480442178 ,1.5476190504889455]
36+
}

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

Lines changed: 131 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
/* eslint-disable max-len */
19+
/* eslint-disable max-len, id-length */
2020

2121
'use strict';
2222

@@ -30,10 +30,13 @@ var dgtts2 = require( './../lib/dgtts2.js' );
3030

3131
// FIXTURES //
3232

33-
var COL_MAJOR_NO_OFFSET_TRANS = require( './fixtures/col_major_no_offset_trans.json' );
34-
var COL_MAJOR_NO_OFFSET_NO_TRANS = require( './fixtures/col_major_no_offset_no_trans.json' );
35-
var ROW_MAJOR_NO_OFFSET_TRANS = require( './fixtures/row_major_no_offset_trans.json' );
36-
var ROW_MAJOR_NO_OFFSET_NO_TRANS = require( './fixtures/row_major_no_offset_no_trans.json' );
33+
var COL_MAJOR_TRANS_NRHS_GT_ONE = require( './fixtures/col_major_trans_nrhs_gt_one.json' );
34+
var COL_MAJOR_NO_TRANS_NRHS_GT_ONE = require( './fixtures/col_major_no_trans_nrhs_gt_one.json' );
35+
var ROW_MAJOR_TRANS_NRHS_GT_ONE = require( './fixtures/row_major_trans_nrhs_gt_one.json' );
36+
var ROW_MAJOR_NO_TRANS_NRHS_GT_ONE = require( './fixtures/row_major_no_trans_nrhs_gt_one.json' );
37+
var COL_MAJOR_NO_TRANS_NRHS_EQ_ONE = require( './fixtures/col_major_no_trans_nrhs_eq_one.json' );
38+
var COL_MAJOR_TRANS_NRHS_EQ_ONE = require( './fixtures/col_major_trans_nrhs_eq_one.json' );
39+
var ROW_MAJOR_TRANS_NRHS_EQ_ONE = require( './fixtures/row_major_trans_nrhs_eq_one.json' );
3740

3841

3942
// TESTS //
@@ -54,7 +57,7 @@ tape( 'the function throws an error if provided a first argument which is not a
5457
var data;
5558
var i;
5659

57-
data = COL_MAJOR_NO_OFFSET_TRANS;
60+
data = COL_MAJOR_TRANS_NRHS_GT_ONE;
5861

5962
values = [
6063
'foo',
@@ -89,7 +92,7 @@ tape( 'the function throws an error if provided an eleventh argument which is no
8992
var data;
9093
var i;
9194

92-
data = ROW_MAJOR_NO_OFFSET_TRANS;
95+
data = ROW_MAJOR_TRANS_NRHS_GT_ONE;
9396

9497
values = [
9598
0,
@@ -119,7 +122,7 @@ tape( 'the function returns the input array unchanged if N is zero', function te
119122
var B;
120123
var X;
121124

122-
data = ROW_MAJOR_NO_OFFSET_NO_TRANS;
125+
data = ROW_MAJOR_NO_TRANS_NRHS_GT_ONE;
123126

124127
DL = new Float64Array( data.DL );
125128
D = new Float64Array( data.D );
@@ -134,7 +137,7 @@ tape( 'the function returns the input array unchanged if N is zero', function te
134137
t.end();
135138
});
136139

137-
tape( 'the function solves A * X = B (row-major)', function test( t ) {
140+
tape( 'the function solves A * X = B (row-major, nrhs > 1)', function test( t ) {
138141
var expectedX;
139142
var IPIV;
140143
var data;
@@ -145,7 +148,7 @@ tape( 'the function solves A * X = B (row-major)', function test( t ) {
145148
var B;
146149
var X;
147150

148-
data = ROW_MAJOR_NO_OFFSET_NO_TRANS;
151+
data = ROW_MAJOR_NO_TRANS_NRHS_GT_ONE;
149152

150153
DL = new Float64Array( data.DL );
151154
D = new Float64Array( data.D );
@@ -162,7 +165,7 @@ tape( 'the function solves A * X = B (row-major)', function test( t ) {
162165
t.end();
163166
});
164167

165-
tape( 'the function solves A * X = B (column-major)', function test( t ) {
168+
tape( 'the function solves A * X = B (column-major, nrhs > 1)', function test( t ) {
166169
var expectedX;
167170
var IPIV;
168171
var data;
@@ -173,7 +176,7 @@ tape( 'the function solves A * X = B (column-major)', function test( t ) {
173176
var B;
174177
var X;
175178

176-
data = COL_MAJOR_NO_OFFSET_NO_TRANS;
179+
data = COL_MAJOR_NO_TRANS_NRHS_GT_ONE;
177180

178181
DL = new Float64Array( data.DL );
179182
D = new Float64Array( data.D );
@@ -190,7 +193,7 @@ tape( 'the function solves A * X = B (column-major)', function test( t ) {
190193
t.end();
191194
});
192195

193-
tape( 'the function solves A**T * X = B (row-major)', function test( t ) {
196+
tape( 'the function solves A**T * X = B (row-major, nrhs > 1)', function test( t ) {
194197
var expectedX;
195198
var IPIV;
196199
var data;
@@ -201,7 +204,7 @@ tape( 'the function solves A**T * X = B (row-major)', function test( t ) {
201204
var B;
202205
var X;
203206

204-
data = ROW_MAJOR_NO_OFFSET_TRANS;
207+
data = ROW_MAJOR_TRANS_NRHS_GT_ONE;
205208

206209
DL = new Float64Array( data.DL );
207210
D = new Float64Array( data.D );
@@ -218,7 +221,7 @@ tape( 'the function solves A**T * X = B (row-major)', function test( t ) {
218221
t.end();
219222
});
220223

221-
tape( 'the function solves A**T * X = B (column-major)', function test( t ) {
224+
tape( 'the function solves A**T * X = B (column-major, nrhs > 1)', function test( t ) {
222225
var expectedX;
223226
var IPIV;
224227
var data;
@@ -229,7 +232,119 @@ tape( 'the function solves A**T * X = B (column-major)', function test( t ) {
229232
var B;
230233
var X;
231234

232-
data = COL_MAJOR_NO_OFFSET_TRANS;
235+
data = COL_MAJOR_TRANS_NRHS_GT_ONE;
236+
237+
DL = new Float64Array( data.DL );
238+
D = new Float64Array( data.D );
239+
DU = new Float64Array( data.DU );
240+
DU2 = new Float64Array( data.DU2 );
241+
IPIV = new Int32Array( data.IPIV );
242+
B = new Float64Array( data.B );
243+
244+
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
245+
246+
expectedX = new Float64Array( data.expected );
247+
t.deepEqual( X, expectedX, 'returns expected value' );
248+
249+
t.end();
250+
});
251+
252+
tape( 'the function solves A * X = B (column-major, nrhs <= 1)', function test( t ) {
253+
var expectedX;
254+
var IPIV;
255+
var data;
256+
var DU2;
257+
var DU;
258+
var DL;
259+
var D;
260+
var B;
261+
var X;
262+
263+
data = COL_MAJOR_NO_TRANS_NRHS_EQ_ONE;
264+
265+
DL = new Float64Array( data.DL );
266+
D = new Float64Array( data.D );
267+
DU = new Float64Array( data.DU );
268+
DU2 = new Float64Array( data.DU2 );
269+
IPIV = new Int32Array( data.IPIV );
270+
B = new Float64Array( data.B );
271+
272+
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
273+
274+
expectedX = new Float64Array( data.expected );
275+
t.deepEqual( X, expectedX, 'returns expected value' );
276+
277+
t.end();
278+
});
279+
280+
tape( 'the function solves A**T * X = B (column-major, nrhs <= 1)', function test( t ) {
281+
var expectedX;
282+
var IPIV;
283+
var data;
284+
var DU2;
285+
var DU;
286+
var DL;
287+
var D;
288+
var B;
289+
var X;
290+
291+
data = COL_MAJOR_TRANS_NRHS_EQ_ONE;
292+
293+
DL = new Float64Array( data.DL );
294+
D = new Float64Array( data.D );
295+
DU = new Float64Array( data.DU );
296+
DU2 = new Float64Array( data.DU2 );
297+
IPIV = new Int32Array( data.IPIV );
298+
B = new Float64Array( data.B );
299+
300+
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
301+
302+
expectedX = new Float64Array( data.expected );
303+
t.deepEqual( X, expectedX, 'returns expected value' );
304+
305+
t.end();
306+
});
307+
308+
tape( 'the function solves A**T * X = B (row-major, nrhs <= 1)', function test( t ) {
309+
var expectedX;
310+
var IPIV;
311+
var data;
312+
var DU2;
313+
var DU;
314+
var DL;
315+
var D;
316+
var B;
317+
var X;
318+
319+
data = ROW_MAJOR_TRANS_NRHS_EQ_ONE;
320+
321+
DL = new Float64Array( data.DL );
322+
D = new Float64Array( data.D );
323+
DU = new Float64Array( data.DU );
324+
DU2 = new Float64Array( data.DU2 );
325+
IPIV = new Int32Array( data.IPIV );
326+
B = new Float64Array( data.B );
327+
328+
X = dgtts2( data.order, data.itrans, data.N, data.nrhs, DL, D, DU, DU2, IPIV, B, data.LDB );
329+
330+
expectedX = new Float64Array( data.expected );
331+
t.deepEqual( X, expectedX, 'returns expected value' );
332+
333+
t.end();
334+
});
335+
336+
tape( 'the function solves A * X = B (row-major, nrhs <= 1)', function test( t ) {
337+
var expectedX;
338+
var IPIV;
339+
var data;
340+
var DU2;
341+
var DU;
342+
var DL;
343+
var D;
344+
var B;
345+
var X;
346+
347+
data = ROW_MAJOR_TRANS_NRHS_EQ_ONE;
233348

234349
DL = new Float64Array( data.DL );
235350
D = new Float64Array( data.D );

0 commit comments

Comments
 (0)