Skip to content

Commit a8ca2ba

Browse files
committed
refactor: use stdlib conventions
--- 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 5b87ba7 commit a8ca2ba

File tree

6 files changed

+57
-47
lines changed

6 files changed

+57
-47
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var min = require( '@stdlib/math/base/special/min' );
5151
* var S = new Float64Array( 3 );
5252
* var out = new Float64Array( 2 );
5353
*
54-
* dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 );
54+
* dppequ( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 );
5555
* // S => <Float64Array>[ 1, ~0.58, ~0.33 ]
5656
* // out => <Float64Array>[ ~0.33, 9 ]
5757
*/
@@ -76,7 +76,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou
7676

7777
is = offsetS + strideS;
7878
iap = offsetAP;
79-
if ( uplo === 'U' ) {
79+
if ( uplo === 'upper' ) {
8080
for ( i = 1; i < N; i++ ) {
8181
if ( order === 'row-major' ) {
8282
iap += ( N - i + 1 ) * strideAP;
@@ -88,7 +88,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou
8888
amax = max( amax, S[ is ] );
8989
is += strideS;
9090
}
91-
} else { // uplo === 'L'
91+
} else { // uplo === 'lower'
9292
for ( i = 1; i < N; i++ ) {
9393
if ( order === 'row-major' ) {
9494
iap += ( i + 1 ) * strideAP;

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
2424
var format = require( '@stdlib/string/format' );
25+
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
2526
var base = require( './base.js' );
2627

2728

@@ -37,6 +38,7 @@ var base = require( './base.js' );
3738
* @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements
3839
* @param {Float64Array} out - array to store the output
3940
* @throws {TypeError} first argument must be a valid order
41+
* @throws {TypeError} second argument must be a valid side
4042
* @throws {RangeError} third argument must be a nonnegative integer
4143
* @returns {integer} status code
4244
*
@@ -47,16 +49,19 @@ var base = require( './base.js' );
4749
* var S = new Float64Array( 3 );
4850
* var out = new Float64Array( 2 );
4951
*
50-
* dppequ( 'row-major', 'L', 3, AP, S, out );
52+
* dppequ( 'row-major', 'lower', 3, AP, S, out );
5153
* // S => <Float64Array>[ 1, ~0.58, ~0.33 ]
5254
* // out => <Float64Array>[ ~0.33, 9 ]
5355
*/
5456
function dppequ( order, uplo, N, AP, S, out ) {
5557
if ( !isLayout( order ) ) {
5658
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
5759
}
60+
if ( !isMatrixTriangle( uplo ) ) {
61+
throw new TypeError( format( 'invalid argument. Second argument must be a valid side. Value: `%s`.', order ) );
62+
}
5863
if ( N < 0 ) {
59-
throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) );
64+
throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) );
6065
}
6166
return base( order, uplo, N, AP, 1, 0, S, 1, 0, out, 1, 0 );
6267
}

lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* var S = new Float64Array( 3 );
3232
* var out = new Float64Array( 2 );
3333
*
34-
* dppequ( 'row-major', 'L', 3, AP, S, out );
34+
* dppequ( 'row-major', 'lower', 3, AP, S, out );
3535
* // S => <Float64Array>[ 1, ~0.58, ~0.33 ]
3636
* // out => <Float64Array>[ ~0.33, 9 ]
3737
*
@@ -43,7 +43,7 @@
4343
* var S = new Float64Array( 3 );
4444
* var out = new Float64Array( 2 );
4545
*
46-
* dppequ.ndarray( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 );
46+
* dppequ.ndarray( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 );
4747
* // S => <Float64Array>[ 1, ~0.58, ~0.33 ]
4848
* // out => <Float64Array>[ ~0.33, 9 ]
4949
*/

lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
2424
var format = require( '@stdlib/string/format' );
25+
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
2526
var base = require( './base.js' );
2627

2728

@@ -43,6 +44,7 @@ var base = require( './base.js' );
4344
* @param {integer} strideOut - stride length for `out`
4445
* @param {integer} offsetOut - starting index for `out`
4546
* @throws {TypeError} first argument must be a valid order
47+
* @throws {TypeError} first argument must be a valid side
4648
* @throws {RangeError} third argument must be a nonnegative integer
4749
* @returns {integer} status code
4850
*
@@ -53,7 +55,7 @@ var base = require( './base.js' );
5355
* var S = new Float64Array( 3 );
5456
* var out = new Float64Array( 2 );
5557
*
56-
* dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 );
58+
* dppequ( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 );
5759
* // S => <Float64Array>[ 1, ~0.58, ~0.33 ]
5860
* // out => <Float64Array>[ ~0.33, 9 ]
5961
*/
@@ -62,7 +64,10 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou
6264
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
6365
}
6466
if ( N < 0 ) {
65-
throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) );
67+
throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) );
68+
}
69+
if ( !isMatrixTriangle( uplo ) ) {
70+
throw new TypeError( format( 'invalid argument. Second argument must be a valid side. Value: `%s`.', order ) );
6671
}
6772
return base( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ); // eslint-disable-line max-len
6873
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ tape( 'the function throws an error if provided an invalid third argument', func
6666

6767
function badValue( value ) {
6868
return function badValue() {
69-
dppequ( 'row-major', 'L', value, AP, S, out );
69+
dppequ( 'row-major', 'lower', value, AP, S, out );
7070
};
7171
}
7272
});
@@ -105,7 +105,7 @@ tape( 'the function throws an error if provided a first argument which is not a
105105

106106
function badValue( value ) {
107107
return function badValue() {
108-
dppequ( value, 'L', 3, AP, S, out );
108+
dppequ( value, 'lower', 3, AP, S, out );
109109
};
110110
}
111111
});
@@ -122,7 +122,7 @@ tape( 'the function leaves the row and column scaling factors intended to equili
122122
S = new Float64Array( 3 );
123123
out = new Float64Array( 2 );
124124

125-
info = dppequ( 'row-major', 'L', 0, AP, S, out );
125+
info = dppequ( 'row-major', 'lower', 0, AP, S, out );
126126

127127
expectedOut = new Float64Array( [ 1.0, 0.0 ] );
128128
expectedS = new Float64Array( 3 );
@@ -145,7 +145,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq
145145
S = new Float64Array( 3 );
146146
out = new Float64Array( 2 );
147147

148-
info = dppequ( 'row-major', 'L', 3, AP, S, out );
148+
info = dppequ( 'row-major', 'lower', 3, AP, S, out );
149149

150150
expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] );
151151
expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] );
@@ -168,7 +168,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq
168168
S = new Float64Array( 3 );
169169
out = new Float64Array( 2 );
170170

171-
info = dppequ( 'column-major', 'L', 3, AP, S, out );
171+
info = dppequ( 'column-major', 'lower', 3, AP, S, out );
172172

173173
expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] );
174174
expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] );
@@ -191,7 +191,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq
191191
S = new Float64Array( 3 );
192192
out = new Float64Array( 2 );
193193

194-
info = dppequ( 'row-major', 'U', 3, AP, S, out );
194+
info = dppequ( 'row-major', 'upper', 3, AP, S, out );
195195

196196
expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] );
197197
expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] );
@@ -214,7 +214,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq
214214
S = new Float64Array( 3 );
215215
out = new Float64Array( 2 );
216216

217-
info = dppequ( 'column-major', 'U', 3, AP, S, out );
217+
info = dppequ( 'column-major', 'upper', 3, AP, S, out );
218218

219219
expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] );
220220
expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] );
@@ -237,7 +237,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (u
237237
S = new Float64Array( 3 );
238238
out = new Float64Array( 2 );
239239

240-
info = dppequ( 'column-major', 'U', 3, AP, S, out );
240+
info = dppequ( 'column-major', 'upper', 3, AP, S, out );
241241

242242
expectedOut = new Float64Array( [ 0.0, 1.0 ] );
243243
expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] );
@@ -260,7 +260,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (u
260260
S = new Float64Array( 3 );
261261
out = new Float64Array( 2 );
262262

263-
info = dppequ( 'row-major', 'U', 3, AP, S, out );
263+
info = dppequ( 'row-major', 'upper', 3, AP, S, out );
264264

265265
expectedOut = new Float64Array( [ 0.0, 1.0 ] );
266266
expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] );
@@ -283,7 +283,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (l
283283
S = new Float64Array( 3 );
284284
out = new Float64Array( 2 );
285285

286-
info = dppequ( 'column-major', 'L', 3, AP, S, out );
286+
info = dppequ( 'column-major', 'lower', 3, AP, S, out );
287287

288288
expectedOut = new Float64Array( [ 0.0, 1.0 ] );
289289
expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] );
@@ -306,7 +306,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (l
306306
S = new Float64Array( 3 );
307307
out = new Float64Array( 2 );
308308

309-
info = dppequ( 'row-major', 'L', 3, AP, S, out );
309+
info = dppequ( 'row-major', 'lower', 3, AP, S, out );
310310

311311
expectedOut = new Float64Array( [ 0.0, 1.0 ] );
312312
expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] );

0 commit comments

Comments
 (0)