Skip to content

Commit 1d6841c

Browse files
committed
refactor: update implementation for ndarray, add test, and update descriptions
1 parent 61053ed commit 1d6841c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1249
-553
lines changed

lib/node_modules/@stdlib/blas/base/dtrmv/README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# dtrmv
2222

23-
> Perform 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.
23+
> Perform 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.
2424
2525
<section class = "usage">
2626

@@ -32,29 +32,29 @@ var dtrmv = require( '@stdlib/blas/base/dtrmv' );
3232

3333
#### dtrmv( order, uplo, trans, diag, N, A, LDA, x, sx )
3434

35-
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.
35+
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.
3636

3737
```javascript
3838
var Float64Array = require( '@stdlib/array/float64' );
3939

4040
var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
4141
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
4242

43-
dtrmv( 'row-major', 'upper', 'none', 'unit', 3, A, 3, x, 1 );
43+
dtrmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 );
4444
// x => <Float64Array>[ 14.0, 8.0, 3.0 ]
4545
```
4646

4747
The function has the following parameters:
4848

4949
- **order**: storage layout.
50-
- **uplo**: specifies whether the upper or lower triangular part of `A` should be referenced.
51-
- **trans**: specifies whether the matrix `A` is a non-transpose, transpose, or conjugate-transpose.
52-
- **diag**: specifies whether or not the matrix `A` is a unit triangular.
50+
- **uplo**: specifies whether `A` is an upper or lower triangular matrix.
51+
- **trans**: specifies whether `A` should be transposed, conjugate-transposed, or not transposed.
52+
- **diag**: specifies whether `A` has a unit diagonal.
5353
- **N**: number of elements along each dimension of `A`.
5454
- **A**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
5555
- **lda**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
56-
- **x**: input [`Float64Array`][mdn-float64array].
57-
- **sx**: index increment for `x`.
56+
- **x**: input vector [`Float64Array`][mdn-float64array].
57+
- **sx**: `x` stride length.
5858

5959
The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of `x` in reverse order,
6060

@@ -64,7 +64,7 @@ var Float64Array = require( '@stdlib/array/float64' );
6464
var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
6565
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
6666

67-
dtrmv( 'row-major', 'upper', 'none', 'unit', 3, A, 3, x, -1 );
67+
dtrmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, -1 );
6868
// x => <Float64Array>[ 1.0, 4.0, 10.0 ]
6969
```
7070

@@ -82,26 +82,29 @@ var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
8282
// Create offset views...
8383
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
8484

85-
dtrmv( 'row-major', 'upper', 'none', 'unit', 3, A, 3, x1, 1 );
85+
dtrmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x1, 1 );
8686
// x0 => <Float64Array>[ 1.0, 6.0, 3.0, 1.0 ]
8787
```
8888

89-
#### dtrmv.ndarray( order, uplo, trans, diag, N, A, LDA, x, sx, ox )
89+
#### dtrmv.ndarray( order, uplo, trans, diag, N, A, sa1, sa2, oa, x, sx, ox )
9090

91-
Performs one of the matrix-vector operations `x = A*x`, or `x = A**T*x`, using alternative indexing semantics, where `x` is an `N` element vector, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
91+
Performs one of the matrix-vector operations `x = A*x` or `x = A**T*x`, using alternative indexing semantics, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
9292

9393
```javascript
9494
var Float64Array = require( '@stdlib/array/float64' );
9595

9696
var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
9797
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
9898

99-
dtrmv.ndarray( 'row-major', 'upper', 'none', 'unit', 3, A, 3, 0, x, 1, 0 );
99+
dtrmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 );
100100
// x => <Float64Array>[ 14.0, 8.0, 3.0 ]
101101
```
102102

103103
The function has the following additional parameters:
104104

105+
- **sa1**: stride of the first dimension of `A`.
106+
- **sa2**: stride of the second dimension of `A`.
107+
- **oa**: starting index for `A`.
105108
- **ox**: starting index for `x`.
106109

107110
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,
@@ -112,7 +115,7 @@ var Float64Array = require( '@stdlib/array/float64' );
112115
var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
113116
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
114117

115-
dtrmv.ndarray( 'row-major', 'upper', 'none', 'unit', 3, A, 3, 0, x, -1, 2 );
118+
dtrmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, -1, 2 );
116119
// x => <Float64Array>[ 1.0, 4.0, 10.0 ]
117120
```
118121

@@ -149,7 +152,7 @@ var N = 3;
149152
var A = discreteUniform( N*N, -10.0, 10.0, opts );
150153
var x = discreteUniform( N, -10.0, 10.0, opts );
151154

152-
dtrmv( 'row-major', 'upper', 'none', 'unit', 3, A, 3, x, 1 );
155+
dtrmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 );
153156
console.log( x );
154157
```
155158

@@ -241,7 +244,7 @@ TODO
241244

242245
[blas]: http://www.netlib.org/blas
243246

244-
[dtrmv]: https://www.netlib.org/lapack/explore-html/d6/d1c/group__trmv_ga73370bd6dca01abe05d54ecd1d91ce9a.html#ga73370bd6dca01abe05d54ecd1d91ce9a
247+
[dtrmv]: https://www.netlib.org/lapack/explore-html/d6/d1c/group__trmv_ga7b90369d2b2b19f78f168e10dd9eb8ad.html#ga7b90369d2b2b19f78f168e10dd9eb8ad
245248

246249
[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
247250

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function createBenchmark( N ) {
6262

6363
b.tic();
6464
for ( i = 0; i < b.iterations; i++ ) {
65-
z = dtrmv( 'row-major', 'upper', 'transpose', 'non-unit', N, A, N, 0, x, 1, 0 );
65+
z = dtrmv( 'row-major', 'upper', 'transpose', 'non-unit', N, A, N, 1, 0, x, 1, 0 );
6666
if ( isnan( z[ i%z.length ] ) ) {
6767
b.fail( 'should not return NaN' );
6868
}

lib/node_modules/@stdlib/blas/base/dtrmv/docs/repl.txt

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
{{alias}}( ord, uplo, trans, diag, N, A, lda, x, sx )
33
Performs one of the matrix-vector operations `x = A*x` or `x = A**T*x`,
4-
where `x` is an `N` element vector and `A` is an `N` by `N` unit,
5-
or non-unit, upper or lower triangular matrix.
4+
where `x` is an `N` element vector and `A` is an `N` by `N` unit, or
5+
non-unit, upper or lower triangular matrix.
66

77
Indexing is relative to the first index. To introduce an offset, use typed
88
array views.
@@ -16,15 +16,14 @@
1616
either 'row-major' or 'column-major'.
1717

1818
uplo: string
19-
Specifies whether to reference the upper or lower triangular part of
20-
`A`.
19+
Specifies whether `A` is an upper or lower triangular matrix.
2120

2221
trans: string
23-
Specifies whether the matrix `A` is non-transpose, transpose, or
24-
conjugate transpose.
22+
Specifies whether `A` should be transposed, conjugate-transposed, or
23+
not transposed.
2524

2625
diag: string
27-
Specifies whether or not `A` is unit triangular.
26+
Specifies whether `A` has a unit diagonal.
2827

2928
N: integer
3029
Number of elements along each dimension of `A`.
@@ -51,15 +50,15 @@
5150
--------
5251
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
5352
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 1.0 ] );
54-
> {{alias}}( 'row-major', 'upper', 'none', 'unit', 2, A, 2, x, 1 )
53+
> {{alias}}( 'row-major', 'upper', 'no-transpose', 'unit', 2, A, 2, x, 1 )
5554
<Float64Array>[ 3.0, 1.0 ]
5655

5756

58-
{{alias}}.ndarray( ord, uplo, trans, diag, N, A, lda, oa, x, sx, ox )
57+
{{alias}}.ndarray( ord, uplo, trans, diag, N, A, sa1, sa2, oa, x, sx, ox )
5958
Performs one of the matrix-vector operations `x = A*x` or `x = A**T*x`,
60-
using alternative indexing semantics, where `x` is an `N` element
61-
vector and `A` is an `N` by `N` unit, or non-unit, upper or lower
62-
triangular matrix.
59+
using alternative indexing semantics, where `x` is an `N` element vector
60+
and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular
61+
matrix.
6362

6463
While typed array views mandate a view offset based on the underlying
6564
buffer, the offset parameters support indexing semantics based on starting
@@ -68,29 +67,30 @@
6867
Parameters
6968
----------
7069
ord: string
71-
Row-major (C-style) or column-major (Fortran-style) ord. Must be
70+
Row-major (C-style) or column-major (Fortran-style) order. Must be
7271
either 'row-major' or 'column-major'.
7372

7473
uplo: string
75-
Specifies whether to reference the upper or lower triangular part of
76-
`A`.
74+
Specifies whether `A` is an upper or lower triangular matrix.
7775

7876
trans: string
79-
Specifies whether the matrix `A` is non-transpose, transpose, or
80-
conjugate transpose.
77+
Specifies whether `A` should be transposed, conjugate-transposed, or
78+
not transposed.
8179

8280
diag: string
83-
Specifies whether or not `A` is unit triangular.
81+
Specifies whether `A` has a unit diagonal.
8482

8583
N: integer
8684
Number of elements along each dimension of `A`.
8785

8886
A: Float64Array
8987
Input matrix.
9088

91-
lda: integer
92-
Stride of the first dimension of `A` (a.k.a., leading dimension of the
93-
matrix `A`).
89+
sa1: integer
90+
Stride of the first dimension of `A`.
91+
92+
sa2: integer
93+
Stride of the second dimension of `A`.
9494

9595
oa: integer
9696
Starting index for `A`.
@@ -115,7 +115,8 @@
115115
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 1.0 ] );
116116
> var ord = 'row-major';
117117
> var uplo = 'upper';
118-
> {{alias}}.ndarray( ord, uplo, 'none', 'unit', 2, A, 2, 0, x, 1, 0 )
118+
> var trans = 'no-transpose';
119+
> {{alias}}.ndarray( ord, uplo, trans, 'unit', 2, A, 2, 1, 0, x, 1, 0 )
119120
<Float64Array>[ 3.0, 1.0 ]
120121

121122
See Also

lib/node_modules/@stdlib/blas/base/dtrmv/docs/types/index.d.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ interface Routine {
3030
* 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.
3131
*
3232
* @param order - storage layout
33-
* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
34-
* @param trans - specifies whether the matrix `A` is transposed, conjugate-transposed, or not transposed
35-
* @param diag - specifies whether the matrix `A` has a unit diagonal
33+
* @param uplo - specifies whether `A` is an upper or lower triangular matrix
34+
* @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
35+
* @param diag - specifies whether `A` has a unit diagonal
3636
* @param N - number of elements along each dimension in the matrix `A`
3737
* @param A - input matrix
3838
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
@@ -46,7 +46,7 @@ interface Routine {
4646
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
4747
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
4848
*
49-
* dtrmv( row-major', 'upper', 'none', 'non-unit', 3, A, 3, x, 1 );
49+
* dtrmv( row-major', 'upper', 'no-transpose', 'non-unit', 3, A, 3, x, 1 );
5050
* // x => <Float64Array>[ 14.0, 8.0, 3.0 ]
5151
*/
5252
( order: Layout, uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, A: Float64Array, LDA: number, x: Float64Array, strideX: number ): Float64Array;
@@ -55,14 +55,15 @@ interface Routine {
5555
* Performs one of the matrix-vector operations `x = A*x` or `x = A**T*x`, using alternative indexing semantics, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
5656
*
5757
* @param order - storage layout
58-
* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
59-
* @param trans - specifies whether the matrix `A` is transposed, conjugate-transposed, or not transposed
60-
* @param diag - specifies whether the matrix `A` has a unit diagonal
58+
* @param uplo - specifies whether `A` is an upper or lower triangular matrix
59+
* @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
60+
* @param diag - specifies whether `A` has a unit diagonal
6161
* @param N - number of elements along each dimension in the matrix `A`
6262
* @param A - input matrix
63-
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
63+
* @param strideA1 - stride of the first dimension of `A`
64+
* @param strideA2 - stride of the first dimension of `A`
6465
* @param offsetA - starting index for `A`
65-
* @param x - first input array
66+
* @param x - input vector
6667
* @param strideX - `x` stride length
6768
* @param offsetX - starting index for `x`
6869
* @returns `x`
@@ -73,7 +74,7 @@ interface Routine {
7374
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] );
7475
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
7576
*
76-
* dtrmv.ndarray( row-major', 'upper', 'none', 'non-unit', 3, A, 3, 0, x, 1, 0 );
77+
* dtrmv.ndarray( row-major', 'upper', 'no-transpose', 'non-unit', 3, A, 3, 1, 0, x, 1, 0 );
7778
* // x => <Float64Array>[ 14.0, 8.0, 3.0 ]
7879
*/
7980
ndarray( order: Layout, uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, A: Float64Array, LDA: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array;
@@ -83,9 +84,9 @@ interface Routine {
8384
* 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.
8485
*
8586
* @param order - storage layout
86-
* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
87-
* @param trans - specifies whether the matrix `A` is transposed, conjugate-transposed, or not transposed
88-
* @param diag - specifies whether the matrix `A` has a unit diagonal
87+
* @param uplo - specifies whether `A` is an upper or lower triangular matrix
88+
* @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
89+
* @param diag - specifies whether `A` has a unit diagonal
8990
* @param N - number of elements along each dimension in the matrix `A`
9091
* @param A - input matrix
9192
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
@@ -99,7 +100,7 @@ interface Routine {
99100
* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] );
100101
* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] );
101102
*
102-
* dtrmv( 'row-major', 'lower', 'none', 'non-unit', 3, A, 3, x, 1 );
103+
* dtrmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, A, 3, x, 1 );
103104
* // x => <Float64Array>[ 1.0, 5.0, 15.0 ]
104105
*
105106
* @example
@@ -108,7 +109,7 @@ interface Routine {
108109
* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] );
109110
* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] );
110111
*
111-
* dtrmv.ndarray( 'row-major', 'lower', 'none', 'non-unit', 3, A, 3, 0, x, 1, 0 );
112+
* dtrmv.ndarray( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, A, 3, 1, 0, x, 1, 0 );
112113
* // x => <Float64Array>[ 1.0, 5.0, 15.0 ]
113114
*/
114115
declare var dtrmv: Routine;

0 commit comments

Comments
 (0)