00001
00002
00003
00004
00005
00006
00007
00008 #include "cblas.h"
00009 #include "cblas_f77.h"
00010 void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
00011 const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
00012 const int N, const void *A, const int lda,
00013 void *X, const int incX)
00014
00015 {
00016 char TA;
00017 char UL;
00018 char DI;
00019 #ifdef F77_CHAR
00020 F77_CHAR F77_TA, F77_UL, F77_DI;
00021 #else
00022 #define F77_TA &TA
00023 #define F77_UL &UL
00024 #define F77_DI &DI
00025 #endif
00026 #ifdef F77_INT
00027 F77_INT F77_N=N, F77_lda=lda, F77_incX=incX;
00028 #else
00029 #define F77_N N
00030 #define F77_lda lda
00031 #define F77_incX incX
00032 #endif
00033 int n, i=0, tincX;
00034 double *st=0,*x=(double *)X;
00035 extern int CBLAS_CallFromC;
00036 extern int RowMajorStrg;
00037 RowMajorStrg = 0;
00038
00039 CBLAS_CallFromC = 1;
00040 if (order == CblasColMajor)
00041 {
00042 if (Uplo == CblasUpper) UL = 'U';
00043 else if (Uplo == CblasLower) UL = 'L';
00044 else
00045 {
00046 cblas_xerbla(2, "cblas_ztrmv","Illegal Uplo setting, %d\n", Uplo);
00047 CBLAS_CallFromC = 0;
00048 RowMajorStrg = 0;
00049 return;
00050 }
00051 if (TransA == CblasNoTrans) TA = 'N';
00052 else if (TransA == CblasTrans) TA = 'T';
00053 else if (TransA == CblasConjTrans) TA = 'C';
00054 else
00055 {
00056 cblas_xerbla(3, "cblas_ztrmv","Illegal TransA setting, %d\n", TransA);
00057 CBLAS_CallFromC = 0;
00058 RowMajorStrg = 0;
00059 return;
00060 }
00061 if (Diag == CblasUnit) DI = 'U';
00062 else if (Diag == CblasNonUnit) DI = 'N';
00063 else
00064 {
00065 cblas_xerbla(4, "cblas_ztrmv","Illegal Diag setting, %d\n", Diag);
00066 CBLAS_CallFromC = 0;
00067 RowMajorStrg = 0;
00068 return;
00069 }
00070 #ifdef F77_CHAR
00071 F77_UL = C2F_CHAR(&UL);
00072 F77_TA = C2F_CHAR(&TA);
00073 F77_DI = C2F_CHAR(&DI);
00074 #endif
00075 F77_ztrmv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X,
00076 &F77_incX);
00077 }
00078 else if (order == CblasRowMajor)
00079 {
00080 RowMajorStrg = 1;
00081 if (Uplo == CblasUpper) UL = 'L';
00082 else if (Uplo == CblasLower) UL = 'U';
00083 else
00084 {
00085 cblas_xerbla(2, "cblas_ztrmv","Illegal Uplo setting, %d\n", Uplo);
00086 CBLAS_CallFromC = 0;
00087 RowMajorStrg = 0;
00088 return;
00089 }
00090
00091 if (TransA == CblasNoTrans) TA = 'T';
00092 else if (TransA == CblasTrans) TA = 'N';
00093 else if (TransA == CblasConjTrans)
00094 {
00095 TA = 'N';
00096 if ( N > 0)
00097 {
00098 if(incX > 0)
00099 tincX = incX;
00100 else
00101 tincX = -incX;
00102 i = tincX << 1;
00103 n = i * N;
00104 x++;
00105 st = x + n;
00106 do
00107 {
00108 *x = -(*x);
00109 x += i;
00110 }
00111 while (x != st);
00112 x -= n;
00113 }
00114 }
00115 else
00116 {
00117 cblas_xerbla(3, "cblas_ztrmv","Illegal TransA setting, %d\n", TransA);
00118 CBLAS_CallFromC = 0;
00119 RowMajorStrg = 0;
00120 return;
00121 }
00122
00123 if (Diag == CblasUnit) DI = 'U';
00124 else if (Diag == CblasNonUnit) DI = 'N';
00125 else
00126 {
00127 cblas_xerbla(4, "cblas_ztrmv","Illegal Diag setting, %d\n", Diag);
00128 CBLAS_CallFromC = 0;
00129 RowMajorStrg = 0;
00130 return;
00131 }
00132 #ifdef F77_CHAR
00133 F77_UL = C2F_CHAR(&UL);
00134 F77_TA = C2F_CHAR(&TA);
00135 F77_DI = C2F_CHAR(&DI);
00136 #endif
00137 F77_ztrmv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X,
00138 &F77_incX);
00139 if (TransA == CblasConjTrans)
00140 {
00141 if (N > 0)
00142 {
00143 do
00144 {
00145 *x = -(*x);
00146 x += i;
00147 }
00148 while (x != st);
00149 }
00150 }
00151 }
00152 else cblas_xerbla(1, "cblas_ztrmv", "Illegal Order setting, %d\n", order);
00153 CBLAS_CallFromC = 0;
00154 RowMajorStrg = 0;
00155 return;
00156 }