• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* cblas_example2.c */
2 
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include "cblas.h"
6 #include "cblas_f77.h"
7 
8 #define INVALID -1
9 
main(int argc,char ** argv)10 int main (int argc, char **argv )
11 {
12    int rout=-1,info=0,m,n,k,lda,ldb,ldc;
13    double A[2] = {0.0,0.0},
14           B[2] = {0.0,0.0},
15           C[2] = {0.0,0.0},
16           ALPHA=0.0, BETA=0.0;
17 
18    if (argc > 2){
19       rout = atoi(argv[1]);
20       info = atoi(argv[2]);
21    }
22 
23    if (rout == 1) {
24       if (info==0) {
25          printf("Checking if cblas_dgemm fails on parameter 4\n");
26          cblas_dgemm( CblasRowMajor,  CblasTrans, CblasNoTrans, INVALID, 0, 0,
27                    ALPHA, A, 1, B, 1, BETA, C, 1 );
28       }
29       if (info==1) {
30          printf("Checking if cblas_dgemm fails on parameter 5\n");
31          cblas_dgemm( CblasRowMajor,  CblasNoTrans, CblasTrans, 0, INVALID, 0,
32                    ALPHA, A, 1, B, 1, BETA, C, 1 );
33       }
34       if (info==2) {
35          printf("Checking if cblas_dgemm fails on parameter 9\n");
36          cblas_dgemm( CblasRowMajor,  CblasNoTrans, CblasNoTrans, 0, 0, 2,
37                    ALPHA, A, 1, B, 1, BETA, C, 2 );
38       }
39       if (info==3) {
40          printf("Checking if cblas_dgemm fails on parameter 11\n");
41          cblas_dgemm( CblasRowMajor,  CblasNoTrans, CblasNoTrans, 0, 2, 2,
42                    ALPHA, A, 1, B, 1, BETA, C, 1 );
43       }
44    } else {
45       if (info==0) {
46          printf("Checking if F77_dgemm fails on parameter 3\n");
47          m=INVALID; n=0; k=0; lda=1; ldb=1; ldc=1;
48          F77_dgemm( "T", "N", &m, &n, &k,
49                    &ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
50       }
51       if (info==1) {
52          m=0; n=INVALID; k=0; lda=1; ldb=1; ldc=1;
53          printf("Checking if F77_dgemm fails on parameter 4\n");
54          F77_dgemm( "N", "T", &m, &n, &k,
55                    &ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
56       }
57       if (info==2) {
58          printf("Checking if F77_dgemm fails on parameter 8\n");
59          m=2; n=0; k=0; lda=1; ldb=1; ldc=2;
60          F77_dgemm( "N", "N" , &m, &n, &k,
61                    &ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
62       }
63       if (info==3) {
64          printf("Checking if F77_dgemm fails on parameter 10\n");
65          m=0; n=0; k=2; lda=1; ldb=1; ldc=1;
66          F77_dgemm( "N", "N" , &m, &n, &k,
67                    &ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
68       }
69    }
70 
71    return 1;
72 }
73