Skip to content

Commit 0045a59

Browse files
Merge branch 'develop' into feat/migrate-dmedian-sorted
2 parents 584a1c4 + 22afd69 commit 0045a59

2 files changed

Lines changed: 39 additions & 24 deletions

File tree

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

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

2323
var max = require( '@stdlib/math/base/special/fast/max' );
24-
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
25-
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
26-
var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' );
27-
var isDiagonal = require( '@stdlib/blas/base/assert/is-diagonal-type' );
24+
var resolveLayout = require( '@stdlib/blas/base/layout-resolve-str' );
25+
var resolveTriangle = require( '@stdlib/blas/base/matrix-triangle-resolve-str' );
26+
var resolveTranspose = require( '@stdlib/blas/base/transpose-operation-resolve-str' );
27+
var resolveDiagonal = require( '@stdlib/blas/base/diagonal-type-resolve-str' );
2828
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
2929
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
3030
var format = require( '@stdlib/string/format' );
@@ -36,10 +36,10 @@ var base = require( './base.js' );
3636
/**
3737
* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
3838
*
39-
* @param {string} order - storage layout
40-
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
41-
* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
42-
* @param {string} diag - specifies whether `A` has a unit diagonal
39+
* @param {(integer|string)} order - storage layout
40+
* @param {(integer|string)} uplo - specifies whether `A` is an upper or lower triangular matrix
41+
* @param {(integer|string)} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
42+
* @param {(integer|string)} diag - specifies whether `A` has a unit diagonal
4343
* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
4444
* @param {Float64Array} A - input matrix
4545
* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
@@ -67,17 +67,25 @@ function dtrmv( order, uplo, trans, diag, N, A, LDA, x, strideX ) {
6767
var sa1;
6868
var sa2;
6969
var ox;
70+
var l;
71+
var u;
72+
var t;
73+
var d;
7074

71-
if ( !isLayout( order ) ) {
75+
l = resolveLayout( order );
76+
if ( l === null ) {
7277
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
7378
}
74-
if ( !isMatrixTriangle( uplo ) ) {
79+
u = resolveTriangle( uplo );
80+
if ( u === null ) {
7581
throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) );
7682
}
77-
if ( !isTransposeOperation( trans ) ) {
83+
t = resolveTranspose( trans );
84+
if ( t === null ) {
7885
throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) );
7986
}
80-
if ( !isDiagonal( diag ) ) {
87+
d = resolveDiagonal( diag );
88+
if ( d === null ) {
8189
throw new TypeError( format( 'invalid argument. Fourth argument must be a valid diagonal type. Value: `%s`.', diag ) );
8290
}
8391
if ( N < 0 ) {
@@ -92,15 +100,15 @@ function dtrmv( order, uplo, trans, diag, N, A, LDA, x, strideX ) {
92100
if ( N === 0 ) {
93101
return x;
94102
}
95-
if ( isColumnMajor( order ) ) {
103+
if ( isColumnMajor( l ) ) {
96104
sa1 = 1;
97105
sa2 = LDA;
98106
} else { // order === 'row-major'
99107
sa1 = LDA;
100108
sa2 = 1;
101109
}
102110
ox = stride2offset( N, strideX );
103-
return base( uplo, trans, diag, N, A, sa1, sa2, 0, x, strideX, ox );
111+
return base( u, t, d, N, A, sa1, sa2, 0, x, strideX, ox );
104112
}
105113

106114

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
// MODULES //
2222

23-
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
24-
var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' );
25-
var isDiagonal = require( '@stdlib/blas/base/assert/is-diagonal-type' );
23+
var resolveTriangle = require( '@stdlib/blas/base/matrix-triangle-resolve-str' );
24+
var resolveTranspose = require( '@stdlib/blas/base/transpose-operation-resolve-str' );
25+
var resolveDiagonal = require( '@stdlib/blas/base/diagonal-type-resolve-str' );
2626
var format = require( '@stdlib/string/format' );
2727
var base = require( './base.js' );
2828

@@ -32,9 +32,9 @@ var base = require( './base.js' );
3232
/**
3333
* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
3434
*
35-
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
36-
* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
37-
* @param {string} diag - specifies whether `A` has a unit diagonal
35+
* @param {(integer|string)} uplo - specifies whether `A` is an upper or lower triangular matrix
36+
* @param {(integer|string)} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
37+
* @param {(integer|string)} diag - specifies whether `A` has a unit diagonal
3838
* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
3939
* @param {Float64Array} A - input matrix
4040
* @param {integer} strideA1 - stride of the first dimension of `A`
@@ -62,13 +62,20 @@ var base = require( './base.js' );
6262
* // x => <Float64Array>[ 14.0, 8.0, 3.0 ]
6363
*/
6464
function dtrmv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX ) { // eslint-disable-line max-params, max-len
65-
if ( !isMatrixTriangle( uplo ) ) {
65+
var u;
66+
var t;
67+
var d;
68+
69+
u = resolveTriangle( uplo );
70+
if ( u === null ) {
6671
throw new TypeError( format( 'invalid argument. First argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) );
6772
}
68-
if ( !isTransposeOperation( trans ) ) {
73+
t = resolveTranspose( trans );
74+
if ( t === null ) {
6975
throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', trans ) );
7076
}
71-
if ( !isDiagonal( diag ) ) {
77+
d = resolveDiagonal( diag );
78+
if ( d === null ) {
7279
throw new TypeError( format( 'invalid argument. Third argument must be a valid diagonal type. Value: `%s`.', diag ) );
7380
}
7481
if ( N < 0 ) {
@@ -86,7 +93,7 @@ function dtrmv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
8693
if ( N === 0 ) {
8794
return x;
8895
}
89-
return base( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX ); // eslint-disable-line max-len
96+
return base( u, t, d, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX ); // eslint-disable-line max-len
9097
}
9198

9299

0 commit comments

Comments
 (0)