Skip to content

Commit 6319005

Browse files
committed
chore: initial clean-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: 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: 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 697b398 commit 6319005

File tree

6 files changed

+58
-57
lines changed

6 files changed

+58
-57
lines changed

lib/node_modules/@stdlib/blas/base/dger/lib/base.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
2626
// MAIN //
2727

2828
/**
29-
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
29+
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3030
*
31+
* @private
3132
* @param {NonNegativeInteger} M - number of rows in the matrix `A`
3233
* @param {NonNegativeInteger} N - number of columns in the matrix `A`
3334
* @param {number} alpha - scalar constant

lib/node_modules/@stdlib/blas/base/dger/lib/dger.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var base = require( './base.js' );
3131
// MAIN //
3232

3333
/**
34-
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
34+
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3535
*
3636
* @param {string} order - storage layout
3737
* @param {NonNegativeInteger} M - number of rows in the matrix `A`
@@ -48,7 +48,7 @@ var base = require( './base.js' );
4848
* @throws {RangeError} third argument must be a nonnegative integer
4949
* @throws {RangeError} sixth argument must be non-zero
5050
* @throws {RangeError} eighth argument must be non-zero
51-
* @throws {RangeError} tenth argument must be greater than or equal to max(1,M)
51+
* @throws {RangeError} tenth argument must be a valid stride
5252
* @returns {Float64Array} `A`
5353
*
5454
* @example
@@ -69,7 +69,6 @@ function dger( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) {
6969
var ox;
7070
var oy;
7171

72-
iscm = isColumnMajor( order );
7372
if ( !isLayout( order ) ) {
7473
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
7574
}
@@ -85,6 +84,7 @@ function dger( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) {
8584
if ( strideY === 0 ) {
8685
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero.' ) );
8786
}
87+
iscm = isColumnMajor( order );
8888
if ( iscm ) {
8989
vala = M;
9090
} else {
@@ -99,7 +99,7 @@ function dger( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) {
9999
}
100100
ox = stride2offset( M, strideX );
101101
oy = stride2offset( N, strideY );
102-
if ( order === 'column-major' ) {
102+
if ( iscm ) {
103103
sa1 = 1;
104104
sa2 = LDA;
105105
} else { // order === 'row-major'

lib/node_modules/@stdlib/blas/base/dger/lib/dger.native.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,40 @@ var addon = require( './../src/addon.node' );
2828
// MAIN //
2929

3030
/**
31-
* Performs the rank 1 operation `A = alpha*x*y^T + A`.
31+
* Performs the rank 1 operation `A = alpha*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3232
*
3333
* @param {*} order - storage layout
3434
* @param {NonNegativeInteger} M - number of rows in the matrix `A`
3535
* @param {NonNegativeInteger} N - number of columns in the matrix `A`
3636
* @param {number} alpha - scalar constant
37-
* @param {Float64Array} x - an `M` element vector
37+
* @param {Float64Array} x - first input vector
3838
* @param {integer} strideX - `x` stride length
39-
* @param {Float64Array} y - an `N` element vector
39+
* @param {Float64Array} y - second input vector
4040
* @param {integer} strideY - `y` stride length
4141
* @param {Float64Array} A - matrix of coefficients
4242
* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
43-
* @throws {TypeError} first argument must be a supported BLAS memory layout
43+
* @throws {TypeError} first argument must be a valid order
44+
* @throws {RangeError} second argument must be a nonnegative integer
45+
* @throws {RangeError} third argument must be a nonnegative integer
46+
* @throws {RangeError} sixth argument must be non-zero
47+
* @throws {RangeError} eighth argument must be non-zero
48+
* @throws {RangeError} tenth argument must be a valid stride
4449
* @returns {Float64Array} `A`
4550
*
4651
* @example
4752
* var Float64Array = require( '@stdlib/array/float64' );
4853
*
49-
* var M = 4;
50-
* var N = 3;
54+
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
55+
* var x = new Float64Array( [ 1.0, 1.0 ] );
56+
* var y = new Float64Array( [ 1.0, 1.0, 1.0 ] );
5157
*
52-
* var B = new Float64Array( M*N );
53-
*
54-
* var x = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
55-
* var y = new Float64Array( [ 1.0, 4.0, 0.0 ] );
56-
*
57-
* dger( 'row-major', N, M, 1.0, y, 1, x, 1, B, M );
58-
* // B => <Float64Array>[ 0.0, 1.0, 2.0, 3.0, 0.0, 4.0, 8.0, 12.0, 0.0, 0.0, 0.0, 0.0 ]
58+
* dger( 'row-major', 2, 3, 1.0, x, 1, y, 1, A, 3 );
59+
* // A => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
5960
*/
6061
function dger( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) {
6162
var ord = resolve( order );
6263
if ( ord === null ) {
63-
throw new TypeError( format( 'invalid argument. First argument must be a supported BLAS memory layout. Value: `%s`.', order ) );
64+
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
6465
}
6566
addon( ord, M, N, alpha, x, strideX, y, strideY, A, LDA );
6667
return A;

lib/node_modules/@stdlib/blas/base/dger/lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* BLAS level 2 routine to perform the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
22+
* BLAS level 2 routine to perform the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
2323
*
2424
* @module @stdlib/blas/base/dger
2525
*
@@ -42,7 +42,7 @@
4242
* var x = new Float64Array( [ 1.0, 1.0 ] );
4343
* var y = new Float64Array( [ 1.0, 1.0, 1.0 ] );
4444
*
45-
* dger.ndarray( 'row-major', 2, 3, 1.0, x, 1, 0, y, 1, 0, A, 3, 1, 0 );
45+
* dger.ndarray( 2, 3, 1.0, x, 1, 0, y, 1, 0, A, 3, 1, 0 );
4646
* // A => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
4747
*/
4848

lib/node_modules/@stdlib/blas/base/dger/lib/ndarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var base = require( './base.js' );
2727
// MAIN //
2828

2929
/**
30-
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
30+
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3131
*
3232
* @param {NonNegativeInteger} M - number of rows in the matrix `A`
3333
* @param {NonNegativeInteger} N - number of columns in the matrix `A`

lib/node_modules/@stdlib/blas/base/dger/lib/ndarray.native.js

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,62 @@
2020

2121
// MODULES //
2222

23-
var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' );
24-
var offsetView = require( '@stdlib/strided/base/offset-view' );
25-
var resolve = require( '@stdlib/blas/base/layout-resolve-enum' );
2623
var format = require( '@stdlib/string/format' );
27-
var addon = require( './dger.native.js' );
24+
var addon = require( './../src/addon.node' );
2825

2926

3027
// MAIN //
3128

3229
/**
33-
* Performs the rank 1 operation `A = alpha*x*y^T + A`.
30+
* Performs the rank 1 operation `A = alpha*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3431
*
35-
* @param {*} order - storage layout
3632
* @param {NonNegativeInteger} M - number of rows in the matrix `A`
3733
* @param {NonNegativeInteger} N - number of columns in the matrix `A`
3834
* @param {number} alpha - scalar constant
39-
* @param {Float64Array} x - an `M` element vector
35+
* @param {Float64Array} x - first input vector
4036
* @param {integer} strideX - `x` stride length
4137
* @param {NonNegativeInteger} offsetX - starting `x` index
42-
* @param {Float64Array} y - an `N` element vector
38+
* @param {Float64Array} y - second input vector
4339
* @param {integer} strideY - `y` stride length
4440
* @param {NonNegativeInteger} offsetY - starting `y` index
45-
* @param {Float64Array} A - matrix of coefficients
46-
* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
47-
* @throws {TypeError} first argument must be a supported BLAS memory layout
41+
* @param {Float64Array} A - input matrix
42+
* @param {integer} strideA1 - stride of the first dimension of `A`
43+
* @param {integer} strideA2 - stride of the second dimension of `A`
44+
* @param {NonNegativeInteger} offsetA - starting index for `A
45+
* @throws {RangeError} first argument must be a nonnegative integer
46+
* @throws {RangeError} second argument must be a nonnegative integer
47+
* @throws {RangeError} fifth argument must be non-zero
48+
* @throws {RangeError} eighth argument must be non-zero
4849
* @returns {Float64Array} `A`
4950
*
5051
* @example
5152
* var Float64Array = require( '@stdlib/array/float64' );
5253
*
53-
* var M = 4;
54-
* var N = 3;
54+
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
55+
* var x = new Float64Array( [ 1.0, 1.0 ] );
56+
* var y = new Float64Array( [ 1.0, 1.0, 1.0 ] );
5557
*
56-
* var B = new Float64Array( M*N );
57-
*
58-
* var x = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
59-
* var y = new Float64Array( [ 1.0, 4.0, 0.0 ] );
60-
*
61-
* dger( 'row-major', N, M, 1.0, y, 1, 0, x, 1, 0, B, M );
62-
* // B => <Float64Array>[ 0.0, 1.0, 2.0, 3.0, 0.0, 4.0, 8.0, 12.0, 0.0, 0.0, 0.0, 0.0 ]
58+
* dger( 2, 3, 1.0, x, 1, 0, y, 1, 0, A, 3, 1, 0 );
59+
* // A => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
6360
*/
64-
function dger( order, M, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, LDA ) { // eslint-disable-line max-len, max-params
65-
var viewX;
66-
var viewY;
67-
var ord;
68-
69-
ord = resolve( order );
70-
if ( ord === null ) {
71-
throw new TypeError( format( 'invalid argument. First argument must be a supported BLAS memory layout. Value: `%s`.', order ) );
61+
function dger( M, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-len, max-params
62+
if ( M < 0 ) {
63+
throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', M ) );
7264
}
73-
offsetX = minViewBufferIndex( N, strideX, offsetX );
74-
offsetY = minViewBufferIndex( N, strideY, offsetY );
75-
76-
viewX = offsetView( x, offsetX );
77-
viewY = offsetView( y, offsetY );
78-
79-
addon( ord, M, N, alpha, viewX, strideX, viewY, strideY, A, LDA );
65+
if ( N < 0 ) {
66+
throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N ) );
67+
}
68+
if ( strideX === 0 ) {
69+
throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero.' ) );
70+
}
71+
if ( strideY === 0 ) {
72+
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero.' ) );
73+
}
74+
// Check if we can early return...
75+
if ( M === 0 || N === 0 || alpha === 0.0 ) {
76+
return A;
77+
}
78+
addon.ndarray( M, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ); // eslint-disable-line max-len
8079
return A;
8180
}
8281

0 commit comments

Comments
 (0)