tc-gsl-cblas.c - numeric - C++ library with numerical algorithms
 (HTM) git clone git://src.adamsgaard.dk/numeric
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tc-gsl-cblas.c (745B)
       ---
            1 #include <stdio.h>
            2 #include <stdlib.h>
            3 #include <gsl/gsl_cblas.h>
            4 
            5 int main(int argc, char* argv[])
            6 {
            7     unsigned int i, N;
            8     double* A;
            9     double* B;
           10     double* C;
           11 
           12     if (argc == 2) {
           13         N = atoi(argv[1]);
           14     } else {
           15         fprintf(stderr, "Sorry, I need matrix width as command line argument\n");
           16         return 1;
           17     }
           18 
           19     A = (double*) malloc(N * N * sizeof(double*));
           20     B = (double*) malloc(N * N * sizeof(double*));
           21     C = (double*) malloc(N * N * sizeof(double*));
           22 
           23     for (i = 0; i < N*N; i++) {
           24         A[i] = 2.0;
           25         B[i] = (double)i;
           26     }
           27 
           28     cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, 
           29             N, N, N, 1.0, A, N, B, N, 0.0, C, N);
           30 
           31     free(A);
           32     free(B);
           33     free(C);
           34 
           35     return 0;
           36 }