Skip to content

Commit 0689326

Browse files
committed
chore: cleaning up
--- 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: passed - 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: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 44c54a9 commit 0689326

File tree

6 files changed

+31
-37
lines changed

6 files changed

+31
-37
lines changed

lib/node_modules/@stdlib/lapack/base/dlange/README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The supported norms are:
3030

3131
- **Max Absolute Value** (`norm` = `'max'`): returns the largest absolute element in `A`.
3232

33-
<!-- <equation class="equation" label="eq:lu_decomposition" align="center" raw="\|A\|_{\max} = \max_{i,j} |a_{i,j}|" alt="Maximum absolute value of a matrix."> -->
33+
<!-- <equation class="equation" label="eq:max_absolute_value" align="center" raw="\|A\|_{\max} = \max_{i,j} |a_{i,j}|" alt="Maximum absolute value of a matrix."> -->
3434

3535
```math
3636
\|A\|_{\max} = \max_{i,j} |a_{i,j}|
@@ -40,7 +40,7 @@ The supported norms are:
4040

4141
- **One Norm** (`norm` = `'one'`): returns the maximum absolute column sum in `A`.
4242

43-
<!-- <equation class="equation" label="eq:lu_decomposition" align="center" raw="\|A\|_1 = \max_j \sum_{i=1}^M |a_{i,j}|" alt="Definition of one norm of a matrix."> -->
43+
<!-- <equation class="equation" label="eq:one_norm" align="center" raw="\|A\|_1 = \max_j \sum_{i=1}^M |a_{i,j}|" alt="Definition of one norm of a matrix."> -->
4444

4545
```math
4646
\|A\|_1 = \max_j \sum_{i=1}^M |a_{i,j}|
@@ -50,7 +50,7 @@ The supported norms are:
5050

5151
- **Infinity Norm** (`norm` = `'infinity'`): returns the maximum absolute row sum in `A`.
5252

53-
<!-- <equation class="equation" label="eq:lu_decomposition" align="center" raw="\|A\|_{\infty} = \max_i \sum_{j=1}^N |a_{i,j}|" alt="Definition of infinity norm of a matrix."> -->
53+
<!-- <equation class="equation" label="eq:infinity_norm" align="center" raw="\|A\|_{\infty} = \max_i \sum_{j=1}^N |a_{i,j}|" alt="Definition of infinity norm of a matrix."> -->
5454

5555
```math
5656
\|A\|_{\infty} = \max_i \sum_{j=1}^N |a_{i,j}|
@@ -60,7 +60,7 @@ The supported norms are:
6060

6161
- **Frobenius Norm** (`norm` = `'frobenius'`): returns the square root of the sum of the squares of all elements in `A`.
6262

63-
<!-- <equation class="equation" label="eq:lu_decomposition" align="center" raw="\|A\|_F = \left(\sum_{i=1}^M \sum_{j=1}^N |a_{i,j}|^2 \right)^{1/2}" alt="Definition of frobenius norm of a matrix."> -->
63+
<!-- <equation class="equation" label="eq:frobenius_norm" align="center" raw="\|A\|_F = \left(\sum_{i=1}^M \sum_{j=1}^N |a_{i,j}|^2 \right)^{1/2}" alt="Definition of frobenius norm of a matrix."> -->
6464

6565
```math
6666
\|A\|_F = \left(\sum_{i=1}^M \sum_{j=1}^N |a_{i,j}|^2 \right)^{1/2}
@@ -107,14 +107,12 @@ var out = dlange( 'row-major', 'frobenius', 3, 4, A, 4, work );
107107
The function has the following parameters:
108108

109109
- **order**: storage layout.
110-
- **norm**: specifies the type of norm to be calculated, should be one of the following: `max`, `one`, `frobenius` or `infinity`.
110+
- **norm**: specifies the type of norm to be calculated, should be one of the following: `max`, `one`, `frobenius`, or `infinity`.
111111
- **M**: number of rows in `A`.
112112
- **N**: number of columns in `A`.
113113
- **A**: input [`Float64Array`][mdn-float64array].
114114
- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
115-
- **work**: [`Float64Array`][mdn-float64array] used as a temporary workspace.
116-
117-
`work` should have `N` indexed elements if calculating the one norm in a row-major layout and `M` indexed elements if calculating the infinity norm in column-major layout, in all other cases it is fine to pass a dummy [`Float64Array`][mdn-float64array].
115+
- **work**: [`Float64Array`][mdn-float64array] used as a temporary workspace. When `A` is `row-major` and `norm` is `one`, `work` should have at least `N` indexed elements. When `A` is `column-major` and `norm` is `infinity`, `work` should have at least `M` indexed elements. In all other cases, `work` is not used and can have any number of elements, including zero.
118116

119117
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
120118

@@ -170,19 +168,17 @@ var out = dlange.ndarray( 'frobenius', 3, 4, A, 4, 1, 0, work, 1, 0 );
170168

171169
The function has the following additional parameters:
172170

173-
- **norm**: specifies the type of norm to be calculated, should be one of the following: `max`, `one`, `frobenius` or `infinity`.
171+
- **norm**: specifies the type of norm to be calculated, should be one of the following: `max`, `one`, `frobenius`, or `infinity`.
174172
- **M**: number of rows in `A`.
175173
- **N**: number of columns in `A`.
176174
- **A**: input [`Float64Array`][mdn-float64array].
177175
- **strideA1**: stride of the first dimension of `A`.
178176
- **strideA2**: stride of the second dimension of `A`.
179177
- **offsetA**: starting index for `A`.
180-
- **work**: [`Float64Array`][mdn-float64array] used as a temporary workspace
178+
- **work**: [`Float64Array`][mdn-float64array] used as a temporary workspace. When `A` is `row-major` and `norm` is `one`, `work` should have at least `N` indexed elements. When `A` is `column-major` and `norm` is `infinity`, `work` should have at least `M` indexed elements. In all other cases, `work` is not used and can have any number of elements, including zero.
181179
- **strideWork**: stride length of `work`.
182180
- **offsetWork**: starting index of `work`.
183181

184-
`work` should have `N` indexed elements if calculating the one norm in a row-major layout and `M` indexed elements if calculating the infinity norm in column-major layout, in all other cases it is fine to pass a dummy [`Float64Array`][mdn-float64array].
185-
186182
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,
187183

188184
<!-- eslint-disable max-len -->

lib/node_modules/@stdlib/lapack/base/dlange/docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ interface Routine {
5757
* @param A - input array
5858
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
5959
* @param work - temporary workspace array
60-
* @returns required norm value
60+
* @returns result
6161
*
6262
* @example
6363
* var Float64Array = require( '@stdlib/array/float64' );
@@ -90,7 +90,7 @@ interface Routine {
9090
* @param work - temporary workspace array
9191
* @param strideWork - stride length of `work`
9292
* @param offsetWork - starting index of `work`
93-
* @returns required norm value
93+
* @returns result
9494
*
9595
* @example
9696
* var Float64Array = require( '@stdlib/array/float64' );
@@ -121,7 +121,7 @@ interface Routine {
121121
* @param A - input array
122122
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
123123
* @param work - temporary workspace array
124-
* @returns required norm value
124+
* @returns result
125125
*
126126
* @example
127127
* var Float64Array = require( '@stdlib/array/float64' );

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ var sqrt = require( '@stdlib/math/base/special/sqrt' );
3131
var abs = require( '@stdlib/math/base/special/abs' );
3232

3333

34+
// VARIABLES //
35+
36+
var workspace = new Float64Array( 2 );
37+
38+
3439
// FUNCTIONS //
3540

3641
/**
@@ -46,7 +51,7 @@ var abs = require( '@stdlib/math/base/special/abs' );
4651
* @param {Float64Array} work - work array, should have `N` indexed elements if row-major layout is used
4752
* @param {integer} strideWork - stride length of `work`
4853
* @param {NonNegativeInteger} offsetWork - starting index of `work`
49-
* @returns {number} required norm value
54+
* @returns {number} result
5055
*
5156
* @example
5257
* var Float64Array = require( '@stdlib/array/float64' );
@@ -121,7 +126,7 @@ function oneNorm( M, N, A, strideA1, strideA2, offsetA, work, strideWork, offset
121126
* @param {integer} strideA1 - stride of the first dimension of `A`
122127
* @param {integer} strideA2 - stride of the second dimension of `A`
123128
* @param {NonNegativeInteger} offsetA - starting index of `A`
124-
* @returns {number} required norm value
129+
* @returns {number} result
125130
*
126131
* @example
127132
* var Float64Array = require( '@stdlib/array/float64' );
@@ -183,7 +188,7 @@ function maxAbs( M, N, A, strideA1, strideA2, offsetA ) {
183188
* @param {Float64Array} work - work array, should have `M` indexed elements if column-major layout is used
184189
* @param {integer} strideWork - stride length of `work`
185190
* @param {NonNegativeInteger} offsetWork - starting index of `work`
186-
* @returns {number} required norm value
191+
* @returns {number} result
187192
*
188193
* @example
189194
* var Float64Array = require( '@stdlib/array/float64' );
@@ -257,26 +262,26 @@ function infinityNorm( M, N, A, strideA1, strideA2, offsetA, work, strideWork, o
257262
* @param {integer} strideA1 - stride of the first dimension of `A`
258263
* @param {integer} strideA2 - stride of the second dimension of `A`
259264
* @param {NonNegativeInteger} offsetA - starting index of `A`
260-
* @returns {number} required norm value
265+
* @returns {number} result
261266
*
262267
* @example
263268
* var Float64Array = require( '@stdlib/array/float64' );
264269
*
265270
* var A = new Float64Array( [ 1.0, 4.0, 7.0, 10.0, 2.0, 5.0, 8.0, 11.0, 3.0, 6.0, 9.0, 12.0 ] );
266271
*
267-
* var out = frobeniusNorm( 3, 4, A, 4, 1, 0 );
272+
* var result = frobeniusNorm( 3, 4, A, 4, 1, 0 );
268273
* // returns ~25.5
269274
*/
270275
function frobeniusNorm( M, N, A, strideA1, strideA2, offsetA ) {
271-
var out;
272276
var da0;
273277
var da1;
274278
var S1;
275279
var S2;
276280
var ia;
277281
var i;
278282

279-
out = new Float64Array( [ 0.0, 1.0 ] );
283+
workspace[ 0 ] = 0.0;
284+
workspace[ 1 ] = 1.0;
280285

281286
if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
282287
S1 = M;
@@ -292,11 +297,11 @@ function frobeniusNorm( M, N, A, strideA1, strideA2, offsetA ) {
292297

293298
ia = offsetA;
294299
for ( i = 0; i < S1; i++ ) {
295-
dlassq( S2, A, da0, ia, out[ 0 ], out[ 1 ], out, 1, 0 );
300+
dlassq( S2, A, da0, ia, workspace[ 0 ], workspace[ 1 ], workspace, 1, 0 ); // eslint-disable-line max-len
296301
ia += da1;
297302
}
298303

299-
return out[ 0 ] * sqrt( out[ 1 ] );
304+
return workspace[ 0 ] * sqrt( workspace[ 1 ] );
300305
}
301306

302307

@@ -323,7 +328,7 @@ function frobeniusNorm( M, N, A, strideA1, strideA2, offsetA ) {
323328
* @param {Float64Array} work - temporary workspace array
324329
* @param {integer} strideWork - stride length of `work`
325330
* @param {NonNegativeInteger} offsetWork - starting index of `work`
326-
* @returns {number} required norm value
331+
* @returns {number} result
327332
*
328333
* @example
329334
* var Float64Array = require( '@stdlib/array/float64' );
@@ -338,19 +343,15 @@ function dlange( norm, M, N, A, strideA1, strideA2, offsetA, work, strideWork, o
338343
if ( min( M, N ) === 0 ) {
339344
return 0.0;
340345
}
341-
342346
if ( norm === 'max' ) {
343347
return maxAbs( M, N, A, strideA1, strideA2, offsetA );
344348
}
345-
346349
if ( norm === 'one' ) {
347350
return oneNorm( M, N, A, strideA1, strideA2, offsetA, work, strideWork, offsetWork ); // eslint-disable-line max-len
348351
}
349-
350352
if ( norm === 'infinity' ) {
351353
return infinityNorm( M, N, A, strideA1, strideA2, offsetA, work, strideWork, offsetWork ); // eslint-disable-line max-len
352354
}
353-
354355
if ( norm === 'frobenius' ) {
355356
return frobeniusNorm( M, N, A, strideA1, strideA2, offsetA );
356357
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2525
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
2626
var max = require( '@stdlib/math/base/special/max' );
2727
var format = require( '@stdlib/string/format' );
28-
var isOperation = require( './isoperation.js' );
28+
var isOperation = require( './is_operation.js' );
2929
var NORMS = require( './norms.json' ).norms;
3030
var base = require( './base.js' );
3131

@@ -53,7 +53,7 @@ var base = require( './base.js' );
5353
* @throws {TypeError} first argument must be a valid order
5454
* @throws {TypeError} second argument must be a valid operation
5555
* @throws {RangeError} sixth argument must be greater than or equal to max(1,N)
56-
* @returns {number} required norm value
56+
* @returns {number} result
5757
*
5858
* @example
5959
* var Float64Array = require( '@stdlib/array/float64' );

lib/node_modules/@stdlib/lapack/base/dlange/lib/isoperation.js renamed to lib/node_modules/@stdlib/lapack/base/dlange/lib/is_operation.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
// MODULES //
2222

2323
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
24-
25-
26-
// VARIABLES //
27-
2824
var NORMS = require( './norms.json' ).norms;
2925

3026

@@ -33,6 +29,7 @@ var NORMS = require( './norms.json' ).norms;
3329
/**
3430
* Tests whether an input value is a supported operation.
3531
*
32+
* @private
3633
* @name isOperation
3734
* @type {Function}
3835
* @param {*} v - value to test

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var format = require( '@stdlib/string/format' );
24-
var isOperation = require( './isoperation.js' );
24+
var isOperation = require( './is_operation.js' );
2525
var NORMS = require( './norms.json' ).norms;
2626
var base = require( './base.js' );
2727

@@ -49,7 +49,7 @@ var base = require( './base.js' );
4949
* @param {integer} strideWork - stride length of `work`
5050
* @param {NonNegativeInteger} offsetWork - starting index of `work`
5151
* @throws {TypeError} first argument must be a valid operation
52-
* @returns {number} required norm value
52+
* @returns {number} result
5353
*
5454
* @example
5555
* var Float64Array = require( '@stdlib/array/float64' );

0 commit comments

Comments
 (0)