1 /*
2  * cblas_strsv.c
3  * The program is a C interface to strsv.
4  *
5  * Keita Teranishi  5/20/98
6  *
7  */
8 #include "cblas.h"
9 #include "cblas_f77.h"
cblas_strsv(const enum CBLAS_ORDER order,const enum CBLAS_UPLO Uplo,const enum CBLAS_TRANSPOSE TransA,const enum CBLAS_DIAG Diag,const CBLAS_INT_TYPE N,const float * A,const CBLAS_INT_TYPE lda,float * X,const CBLAS_INT_TYPE incX)10 void cblas_strsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
11                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
12                  const CBLAS_INT_TYPE N, const float  *A, const CBLAS_INT_TYPE lda, float  *X,
13                  const CBLAS_INT_TYPE incX)
14 
15 {
16    char TA;
17    char UL;
18    char DI;
19 #ifdef F77_CHAR
20    F77_CHAR F77_TA, F77_UL, F77_DI;
21 #else
22    #define F77_TA &TA
23    #define F77_UL &UL
24    #define F77_DI &DI
25 #endif
26 #ifdef F77_INT
27    F77_INT F77_N=N, F77_lda=lda, F77_incX=incX;
28 #else
29    #define F77_N N
30    #define F77_lda lda
31    #define F77_incX incX
32 #endif
33 
34    if (order == CblasColMajor)
35    {
36       if (Uplo == CblasUpper) UL = 'U';
37       else if (Uplo == CblasLower) UL = 'L';
38       else
39       {
40          cblas_xerbla(2, "cblas_strsv","Illegal Uplo setting, %d\n", Uplo);
41          return;
42       }
43       if (TransA == CblasNoTrans) TA = 'N';
44       else if (TransA == CblasTrans) TA = 'T';
45       else if (TransA == CblasConjTrans) TA = 'C';
46       else
47       {
48          cblas_xerbla(3, "cblas_strsv","Illegal TransA setting, %d\n", TransA);
49          return;
50       }
51       if (Diag == CblasUnit) DI = 'U';
52       else if (Diag == CblasNonUnit) DI = 'N';
53       else
54       {
55          cblas_xerbla(4, "cblas_strsv","Illegal Diag setting, %d\n", Diag);
56          return;
57       }
58       #ifdef F77_CHAR
59          F77_UL = C2F_CHAR(&UL);
60          F77_TA = C2F_CHAR(&TA);
61          F77_DI = C2F_CHAR(&DI);
62       #endif
63       F77_strsv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X,
64                       &F77_incX);
65    }
66    else if (order == CblasRowMajor)
67    {
68       if (Uplo == CblasUpper) UL = 'L';
69       else if (Uplo == CblasLower) UL = 'U';
70       else
71       {
72          cblas_xerbla(2, "cblas_strsv","Illegal Uplo setting, %d\n", Uplo);
73          return;
74       }
75 
76       if (TransA == CblasNoTrans) TA = 'T';
77       else if (TransA == CblasTrans) TA = 'N';
78       else if (TransA == CblasConjTrans) TA = 'N';
79       else
80       {
81          cblas_xerbla(3, "cblas_strsv","Illegal TransA setting, %d\n", TransA);
82          return;
83       }
84 
85       if (Diag == CblasUnit) DI = 'U';
86       else if (Diag == CblasNonUnit) DI = 'N';
87       else
88       {
89          cblas_xerbla(4, "cblas_strsv","Illegal Diag setting, %d\n", Diag);
90          return;
91       }
92       #ifdef F77_CHAR
93          F77_UL = C2F_CHAR(&UL);
94          F77_TA = C2F_CHAR(&TA);
95          F77_DI = C2F_CHAR(&DI);
96       #endif
97       F77_strsv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X,
98                       &F77_incX);
99    }
100    else cblas_xerbla(1, "cblas_strsv", "Illegal Order setting, %d\n", order);
101    return;
102 }
103