numeric-linalg
Educational material on the SciPy implementation of numerical linear algebra algorithms
Name | Size | Mode | |
.. | |||
lapack/CBLAS/examples/cblas_example1_64.c | 1434B | -rw-r--r-- |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
/* cblas_example.c */ #include <stdio.h> #include <stdlib.h> #include "cblas_64.h" int main ( ) { CBLAS_LAYOUT Layout; CBLAS_TRANSPOSE transa; double *a, *x, *y; double alpha, beta; int64_t m, n, lda, incx, incy, i; Layout = CblasColMajor; transa = CblasNoTrans; m = 4; /* Size of Column ( the number of rows ) */ n = 4; /* Size of Row ( the number of columns ) */ lda = 4; /* Leading dimension of 5 * 4 matrix is 5 */ incx = 1; incy = 1; alpha = 1; beta = 0; a = (double *)malloc(sizeof(double)*m*n); x = (double *)malloc(sizeof(double)*n); y = (double *)malloc(sizeof(double)*n); /* The elements of the first column */ a[0] = 1; a[1] = 2; a[2] = 3; a[3] = 4; /* The elements of the second column */ a[m] = 1; a[m+1] = 1; a[m+2] = 1; a[m+3] = 1; /* The elements of the third column */ a[m*2] = 3; a[m*2+1] = 4; a[m*2+2] = 5; a[m*2+3] = 6; /* The elements of the fourth column */ a[m*3] = 5; a[m*3+1] = 6; a[m*3+2] = 7; a[m*3+3] = 8; /* The elements of x and y */ x[0] = 1; x[1] = 2; x[2] = 1; x[3] = 1; y[0] = 0; y[1] = 0; y[2] = 0; y[3] = 0; cblas_dgemv_64( Layout, transa, m, n, alpha, a, lda, x, incx, beta, y, incy ); /* Print y */ for( i = 0; i < n; i++ ) printf(" y%" CBLAS_IFMT " = %f\n", i, y[i]); free(a); free(x); free(y); return 0; }