1 /*
2  *
3  * cblas_dsbmv.c
4  * This program is a C interface to dsbmv.
5  * Written by Keita Teranishi
6  * 4/6/1998
7  *
8  */
9 
10 #include "cblas.h"
11 #include "cblas_f77.h"
cblas_dsbmv(const CBLAS_LAYOUT layout,const CBLAS_UPLO Uplo,const int N,const int K,const double alpha,const double * A,const int lda,const double * X,const int incX,const double beta,double * Y,const int incY)12 void cblas_dsbmv(const CBLAS_LAYOUT layout,
13                  const CBLAS_UPLO Uplo, const int N, const int K,
14                  const double alpha, const double  *A, const int lda,
15                  const double  *X, const int incX, const double beta,
16                  double  *Y, const int incY)
17 {
18    char UL;
19 #ifdef F77_CHAR
20    F77_CHAR F77_UL;
21 #else
22    #define F77_UL &UL
23 #endif
24 #ifdef F77_INT
25    F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_incX=incX, F77_incY=incY;
26 #else
27    #define F77_N N
28    #define F77_K K
29    #define F77_lda lda
30    #define F77_incX incX
31    #define F77_incY incY
32 #endif
33    extern int CBLAS_CallFromC;
34    extern int RowMajorStrg;
35    RowMajorStrg = 0;
36 
37    CBLAS_CallFromC = 1;
38    if (layout == CblasColMajor)
39    {
40       if (Uplo == CblasUpper) UL = 'U';
41       else if (Uplo == CblasLower) UL = 'L';
42       else
43       {
44          cblas_xerbla(2, "cblas_dsbmv","Illegal Uplo setting, %d\n",Uplo );
45          CBLAS_CallFromC = 0;
46          RowMajorStrg = 0;
47          return;
48       }
49       #ifdef F77_CHAR
50          F77_UL = C2F_CHAR(&UL);
51       #endif
52       F77_dsbmv(F77_UL, &F77_N, &F77_K, &alpha, A, &F77_lda, X,
53                      &F77_incX, &beta, Y, &F77_incY);
54    }
55    else if (layout == CblasRowMajor)
56    {
57       RowMajorStrg = 1;
58       if (Uplo == CblasUpper) UL = 'L';
59       else if (Uplo == CblasLower) UL = 'U';
60       else
61       {
62          cblas_xerbla(2, "cblas_dsbmv","Illegal Uplo setting, %d\n", Uplo);
63          CBLAS_CallFromC = 0;
64          RowMajorStrg = 0;
65          return;
66       }
67       #ifdef F77_CHAR
68          F77_UL = C2F_CHAR(&UL);
69       #endif
70       F77_dsbmv(F77_UL, &F77_N, &F77_K, &alpha,
71                      A ,&F77_lda, X,&F77_incX, &beta, Y, &F77_incY);
72    }
73    else cblas_xerbla(1, "cblas_dsbmv", "Illegal layout setting, %d\n", layout);
74    CBLAS_CallFromC = 0;
75    RowMajorStrg = 0;
76    return;
77 }
78