@@ -294,24 +294,30 @@ void c_dgemv_ndarray( const CBLAS_TRANSPOSE trans, const CBLAS_INT M, const CBLA
294
294
#include < stdio.h>
295
295
296
296
int main ( void ) {
297
- // Create a strided array:
298
- const double A[ ] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
299
- const double x[ ] = { 1.0, 2.0, 3.0 };
300
- double y[ ] = { 1.0, 2.0, 3.0 };
297
+ // Define a 3x3 matrix stored in row-major order:
298
+ double A[ 3* 3 ] = {
299
+ 0.0, 0.0, 0.0,
300
+ 0.0, 0.0, 0.0,
301
+ 0.0, 0.0, 0.0
302
+ };
303
+
304
+ // Define `x` and `y` vectors:
305
+ const double x[ 3 ] = { 1.0, 2.0, 3.0 };
306
+ double y[ 3 ] = { 1.0, 2.0, 3.0 };
301
307
302
308
// Specify the number of elements along each dimension of `A`:
303
309
const int M = 3;
304
310
const int N = 3;
305
311
306
- // Perform the matrix-vector operations `y = α*A*x + β*y`:
312
+ // Perform the matrix-vector operation `y = α*A*x + β*y`:
307
313
c_dgemv( CblasRowMajor, CblasNoTrans, M, N, 1.0, A, M, x, 1, 1.0, y, 1 );
308
314
309
315
// Print the result:
310
316
for ( int i = 0; i < N; i++ ) {
311
317
printf( "y[ %i ] = %lf\n", i, y[ i ] );
312
318
}
313
319
314
- // Perform the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A `:
320
+ // Perform the matrix-vector operation `y = α*A*x + β*y `:
315
321
c_dgemv_ndarray( CblasNoTrans, 3, 3, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 );
316
322
317
323
// Print the result:
0 commit comments