@@ -93,6 +93,8 @@ dgemv( 'row-major', 'no-transpose', 2, 2, 1.0, A, 2, x1, -1, 1.0, y1, -1 );
93
93
// y0 => <Float64Array>[ 0.0, 8.0, 4.0 ]
94
94
```
95
95
96
+ <!-- lint disable maximum-heading-length -->
97
+
96
98
#### dgemv.ndarray( trans, M, N, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )
97
99
98
100
Performs one of the matrix-vector operations ` y = α*A*x + β*y ` or ` y = α*A**T*x + β*y ` , using alternative indexing semantics and where ` α ` and ` β ` are scalars, ` x ` and ` y ` are vectors, and ` A ` is an ` M ` by ` N ` matrix.
@@ -199,18 +201,73 @@ console.log( y );
199
201
#include " stdlib/blas/base/dgemv.h"
200
202
```
201
203
202
- #### TODO
204
+ #### c_dgemv( order, trans, M, N, alpha, \* A, LDA, \* X, strideX, beta, \* Y, strideY )
203
205
204
- TODO .
206
+ Performs one of the matrix-vector operations ` y = α*A*x + β*y ` or ` y = α*A^T*x + β*y ` , where ` α ` and ` β ` are scalars, ` x ` and ` y ` are vectors, and ` A ` is an ` M ` by ` N ` matrix .
205
207
206
208
``` c
207
- TODO
209
+ #include " stdlib/blas/base/shared.h"
210
+
211
+ double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
212
+ const double x[ ] = { 1.0, 2.0, 3.0 };
213
+ const double y[ ] = { 1.0, 2.0, 3.0 };
214
+
215
+ c_dgemv ( CblasColMajor, CblasNoTrans, 3, 3, 1.0, A, 3, x, 1, 1.0, y, 1 );
208
216
```
209
217
210
- TODO
218
+ The function accepts the following arguments:
219
+
220
+ - **order**: `[in] CBLAS_LAYOUT` storage layout.
221
+ - **trans**: `[in] CBLAS_TRANSPOSE` specifies whether `A` should be transposed, conjugate-transposed, or not transposed.
222
+ - **M**: `[in] CBLAS_INT` number of rows in the matrix `A`.
223
+ - **N**: `[in] CBLAS_INT` number of columns in the matrix `A`.
224
+ - **alpha**: `[in] double` scalar.
225
+ - **A**: `[inout] double*` input matrix.
226
+ - **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
227
+ - **X**: `[in] double*` first input vector.
228
+ - **strideX**: `[in] CBLAS_INT` index increment for `X`.
229
+ - **beta**: `[in] double` scalar.
230
+ - **Y**: `[in] double*` second input vector.
231
+ - **strideY**: `[in] CBLAS_INT` index increment for `Y`.
211
232
212
233
```c
213
- TODO
234
+ void c_dgemv( const CBLAS_LAYOUT order, const CBLAS_TRANSPOSE trans, const CBLAS_INT M, const CBLAS_INT N, const double alpha, const double *A, const CBLAS_INT LDA, const double *x, const CBLAS_INT strideX, const double beta, double *y, const CBLAS_INT strideY )
235
+ ```
236
+
237
+ #### c_dgemv_ndarray( trans, M, N, alpha, \* A, sa1, sa2, oa, \* X, sx, ox, beta, \* Y, sy, oy )
238
+
239
+ Performs one of the matrix-vector operations ` y = α*A*x + β*y ` or ` y = α*A^T*x + β*y ` , where ` α ` and ` β ` are scalars, ` x ` and ` y ` are vectors, and ` A ` is an ` M ` by ` N ` matrix using indexing alternative semantics.
240
+
241
+ ``` c
242
+ #include " stdlib/blas/base/shared.h"
243
+
244
+ double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
245
+ const double x[ ] = { 1.0, 2.0, 3.0 };
246
+ const double y[ ] = { 1.0, 2.0, 3.0 };
247
+
248
+ c_dgemv_ndarray ( CblasNoTrans, 3, 3, 1.0, A, 1, 3, 0, x, 1, 0, 1.0, y, 1, 0 );
249
+ ```
250
+
251
+ The function accepts the following arguments:
252
+
253
+ - **trans**: `[in] CBLAS_TRANSPOSE` specifies whether `A` should be transposed, conjugate-transposed, or not transposed.
254
+ - **M**: `[in] CBLAS_INT` number of rows in the matrix `A`.
255
+ - **N**: `[in] CBLAS_INT` number of columns in the matrix `A`.
256
+ - **alpha**: `[in] double` scalar.
257
+ - **A**: `[inout] double*` input matrix.
258
+ - **sa1**: `[in] CBLAS_INT` stride of the first dimension of `A`.
259
+ - **sa2**: `[in] CBLAS_INT` stride of the second dimension of `A`.
260
+ - **oa**: `[in] CBLAS_INT` starting index for `A`.
261
+ - **X**: `[in] double*` first input vector.
262
+ - **strideX**: `[in] CBLAS_INT` index increment for `X`.
263
+ - **offsetX**: `[in] CBLAS_INT` starting index for `X`.
264
+ - **beta**: `[in] double` scalar.
265
+ - **Y**: `[in] double*` second input vector.
266
+ - **strideY**: `[in] CBLAS_INT` index increment for `Y`.
267
+ - **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
268
+
269
+ ```c
270
+ void c_dgemv_ndarray( const CBLAS_TRANSPOSE trans, const CBLAS_INT M, const CBLAS_INT N, const double alpha, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, const double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double beta, double *y, const CBLAS_INT strideY, const CBLAS_INT offsetY )
214
271
```
215
272
216
273
</section >
@@ -232,7 +289,36 @@ TODO
232
289
### Examples
233
290
234
291
``` c
235
- TODO
292
+ #include " stdlib/blas/base/dgemv.h"
293
+ #include " stdlib/blas/base/shared.h"
294
+ #include < stdio.h>
295
+
296
+ int main ( void ) {
297
+ // Create a strided array:
298
+ const double A[ ] = { 1.0f, 0.0f, 0.0f, 2.0f, 1.0f, 0.0f, 3.0f, 2.0f, 1.0f };
299
+ const double x[ ] = { 1.0f, 2.0f, 3.0f };
300
+ double y[ ] = { 1.0f, 2.0f, 3.0f };
301
+
302
+ // Specify the number of elements along each dimension of `A`:
303
+ const int M = 3;
304
+ const int N = 3;
305
+
306
+ // Perform the matrix-vector operations `y = α*A*x + β*y`:
307
+ c_dgemv( CblasRowMajor, CblasNoTrans, M, N, 1.0f, A, M, x, 1, 1.0f, y, 1 );
308
+
309
+ // Print the result:
310
+ for ( int i = 0; i < N; i++ ) {
311
+ printf( "y[ %i ] = %lf\n", i, y[ i ] );
312
+ }
313
+
314
+ // Perform the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A`:
315
+ c_dgemv_ndarray( CblasNoTrans, 3, 3, 1.0f, A, 3, 1, 0, x, 1, 0, 1.0f, y, 1, 0 );
316
+
317
+ // Print the result:
318
+ for ( int i = 0; i < N; i++ ) {
319
+ printf( "y[ %i ] = %lf\n", i, y[ i ] );
320
+ }
321
+ }
236
322
```
237
323
238
324
</section>
0 commit comments