Skip to content

Commit 12f5df7

Browse files
committed
refactor: update implementation, apply corresponding changes and add test cases supporting ndarray
1 parent 0ab9fc7 commit 12f5df7

Some content is hidden

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

41 files changed

+1762
-878
lines changed

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

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

2121
# dsymv
2222

23-
> Perform the matrix-vector operation `y = α*A*x + β*y` where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
23+
> Perform the matrix-vector operation `y = α*A*x + β*y`.
2424
2525
<section class = "usage">
2626

@@ -92,7 +92,7 @@ dsymv( 'row-major', 'upper', 3, 1.0, A, 3, x1, -1, 1.0, y1, -1 );
9292
// y0 => <Float64Array>[ 1.0, 4.0, 3.0, 2.0 ]
9393
```
9494

95-
#### dsymv.ndarray( order, uplo, N, α, A, LDA, x, sx, ox, β, y, sy, oy )
95+
#### dsymv.ndarray( uplo, N, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )
9696

9797
Performs the matrix-vector operation `y = α*A*x + β*y` using alternative indexing semantics and where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
9898

@@ -103,12 +103,15 @@ var A = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] );
103103
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
104104
var y = new Float64Array( [ 1.0, 2.0, 3.0 ] );
105105

106-
dsymv.ndarray( 'row-major', 'upper', 3, 2.0, A, 3, x, -1, 2, 1.0, y, 1, 0 );
106+
dsymv.ndarray( 'upper', 3, 2.0, A, 3, 1, 0, x, -1, 2, 1.0, y, 1, 0 );
107107
// y => <Float64Array>[ 7.0, 10.0, 9.0 ]
108108
```
109109

110110
The function has the following additional parameters:
111111

112+
- **sa1**: stride for the first dimension of `A`.
113+
- **sa2**: stride for the second dimension of `A`.
114+
- **oa**: starting index for `A`.
112115
- **ox**: starting index for `x`.
113116
- **oy**: starting index for `y`.
114117

@@ -121,7 +124,7 @@ var A = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] );
121124
var x = new Float64Array( [ 1.0, 1.0, 1.0 ] );
122125
var y = new Float64Array( [ 1.0, 1.0, 1.0 ] );
123126

124-
dsymv.ndarray( 'row-major', 'lower', 3, 1.0, A, 3, x, -1, 2, 1.0, y, -1, 2 );
127+
dsymv.ndarray( 'lower', 3, 1.0, A, 3, 1, 0, x, -1, 2, 1.0, y, -1, 2 );
125128
// y => <Float64Array>[ 4.0, 3.0, 2.0 ]
126129
```
127130

@@ -154,13 +157,16 @@ var opts = {
154157
'dtype': 'float64'
155158
};
156159

157-
var N = 3;
160+
var N = 5;
158161
var A = ones( N*N, opts.dtype );
159162

160163
var x = discreteUniform( N, 0, 255, opts );
161164
var y = discreteUniform( N, 0, 255, opts );
162165

163-
dsymv.ndarray( 'row-major', 'upper', N, 1.0, A, N, x, 1, 0, 1.0, y, 1, 0 );
166+
dsymv( 'row-major', 'upper', N, 1.0, A, N, x, 1, 1.0, y, 1 );
167+
console.log( y );
168+
169+
dsymv.ndarray( 'upper', N, 1.0, A, N, 1, 0, x, 1, 0, 1.0, y, 1, 0 );
164170
console.log( y );
165171
```
166172

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

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

6565
b.tic();
6666
for ( i = 0; i < b.iterations; i++ ) {
67-
z = dsymv( 'row-major', 'upper', N, 1.0, A, N, x, 1, 0, 1.0, y, 1, 0 );
67+
z = dsymv( 'upper', N, 1.0, A, N, 1, 0, x, 1, 0, 1.0, y, 1, 0 );
6868
if ( isnan( z[ i%z.length ] ) ) {
6969
b.fail( 'should not return NaN' );
7070
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Scalar constant.
2929

3030
A: Float64Array
31-
Matrix.
31+
Input matrix.
3232

3333
lda: integer
3434
Stride of the first dimension of `A` (a.k.a., leading dimension of the
@@ -63,7 +63,7 @@
6363
<Float64Array>[ 4.0, 4.0 ]
6464

6565

66-
{{alias}}.ndarray( order, uplo, N, α, A, lda, x, sx, ox, β, y, sy, oy )
66+
{{alias}}.ndarray( uplo, N, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )
6767
Performs the matrix-vector operation `y = α*A*x + β*y` using alternative
6868
indexing semantics and where `α` and `β` are scalars, `x` and `y` are `N`
6969
element vectors, and `A` is an `N` by `N` symmetric matrix.
@@ -74,10 +74,6 @@
7474

7575
Parameters
7676
----------
77-
order: string
78-
Row-major (C-style) or column-major (Fortran-style) order. Must be
79-
either 'row-major' or 'column-major'.
80-
8177
uplo: string
8278
Specifies whether to reference the upper or lower triangular part of
8379
`A`. Must be either 'upper' or 'lower'.
@@ -89,11 +85,16 @@
8985
Scalar constant.
9086

9187
A: Float64Array
92-
Matrix.
88+
Input matrix.
9389

94-
lda: integer
95-
Stride of the first dimension of `A` (a.k.a., leading dimension of the
96-
matrix `A`).
90+
sa1: integer
91+
Stride for the first dimension of `A`.
92+
93+
sa2: integer
94+
Stride for the second dimension of `A`.
95+
96+
oa: integer
97+
Starting index for `A`.
9798

9899
x: Float64Array
99100
Input vector.
@@ -126,8 +127,7 @@
126127
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
127128
> var y = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
128129
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 2.0, 1.0 ] );
129-
> var ord = 'row-major';
130-
> {{alias}}.ndarray( ord, 'upper', 2, 1.0, A, 2, x, 1, 0, 1.0, y, 1, 0 )
130+
> {{alias}}.ndarray( 'upper', 2, 1.0, A, 2, 1, 0, x, 1, 0, 1.0, y, 1, 0 )
131131
<Float64Array>[ 4.0, 4.0 ]
132132

133133
See Also

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import { Layout, MatrixTriangle } from '@stdlib/types/blas';
2727
*/
2828
interface Routine {
2929
/**
30-
* Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
30+
* Performs the matrix-vector operation `y = α*A*x + β*y` where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
3131
*
3232
* @param order - storage layout
3333
* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is to be referenced
3434
* @param N - number of elements along each dimension in the matrix `A`
3535
* @param alpha - scalar constant
36-
* @param A - matrix
36+
* @param A - input matrix
3737
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
3838
* @param x - first input array
3939
* @param strideX - `x` stride length
@@ -55,21 +55,23 @@ interface Routine {
5555
( order: Layout, uplo: MatrixTriangle, N: number, alpha: number, A: Float64Array, LDA: number, x: Float64Array, strideX: number, beta: number, y: Float64Array, strideY: number ): Float64Array;
5656

5757
/**
58-
* Performs the matrix-vector operation `y = alpha*A*x + beta*y` using alternative indexing semantics and where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
58+
* Performs the matrix-vector operation `y = α*A*x + β*y`, using alternative indexing semantics and where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
5959
*
6060
* @param order - storage layout
6161
* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
6262
* @param N - number of elements along each dimension in the matrix `A`
6363
* @param alpha - scalar constant
64-
* @param A - matrix
65-
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
64+
* @param A - input matrix
65+
* @param strideA1 - stride for the first dimension of `A`
66+
* @param strideA2 - stride for the second dimension of `A`
67+
* @param offsetA - starting index for `A`
6668
* @param x - first input array
6769
* @param strideX - `x` stride length
68-
* @param offsetX - starting `x` index
70+
* @param offsetX - starting index for `x`
6971
* @param beta - scalar constant
7072
* @param y - second input array
7173
* @param strideY - `y` stride length
72-
* @param offsetY - starting `y` index
74+
* @param offsetY - starting index for `y`
7375
* @returns `y`
7476
*
7577
* @example
@@ -79,20 +81,20 @@ interface Routine {
7981
* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] );
8082
* var y = new Float64Array( [ 0.0, 0.0, 0.0 ] );
8183
*
82-
* dsymv.ndarray( 'row-major', 'lower', 3, 1.0, A, 3, x, 1, 0, 0.0, y, 1, 0 );
84+
* dsymv.ndarray( 'lower', 3, 1.0, A, 3, 1, 0, x, 1, 0, 0.0, y, 1, 0 );
8385
* // y => <Float64Array>[ 1.0, 2.0, 3.0 ]
8486
*/
85-
ndarray( order: Layout, uplo: MatrixTriangle, N: number, alpha: number, A: Float64Array, LDA: number, x: Float64Array, strideX: number, offsetX: number, beta: number, y: Float64Array, strideY: number, offsetY: number ): Float64Array;
87+
ndarray( uplo: MatrixTriangle, N: number, alpha: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, x: Float64Array, strideX: number, offsetX: number, beta: number, y: Float64Array, strideY: number, offsetY: number ): Float64Array;
8688
}
8789

8890
/**
89-
* Performs the matrix-vector operation `y = alpha*A*x + beta*y` where `alpha` and `beta` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
91+
* Performs the matrix-vector operation `y = α*A*x + β*y` where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
9092
*
9193
* @param order - storage layout
9294
* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is to be referenced
9395
* @param N - number of elements along each dimension in the matrix `A`
9496
* @param alpha - scalar constant
95-
* @param A - matrix
97+
* @param A - input matrix
9698
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
9799
* @param x - first input array
98100
* @param strideX - `x` stride length
@@ -118,7 +120,7 @@ interface Routine {
118120
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
119121
* var y = new Float64Array( [ 1.0, 2.0, 3.0 ] );
120122
*
121-
* dsymv.ndarray( 'row-major', 'upper', 3, 2.0, A, 3, x, 1, 0, 1.0, y, 2, 0 );
123+
* dsymv.ndarray( 'upper', 3, 2.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 2, 0 );
122124
* // y => <Float64Array>[ 3.0, 2.0, 11.0 ]
123125
*/
124126
declare var dsymv: Routine;

0 commit comments

Comments
 (0)