00001
00002
00003
00004
00005
00006
00007
00008 #include "cblas.h"
00009 #include "cblas_f77.h"
00010 void cblas_ztrsv(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, void *X,
00013 const int incX)
00014 {
00015 char TA;
00016 char UL;
00017 char DI;
00018 #ifdef F77_CHAR
00019 F77_CHAR F77_TA, F77_UL, F77_DI;
00020 #else
00021 #define F77_TA &TA
00022 #define F77_UL &UL
00023 #define F77_DI &DI
00024 #endif
00025 #ifdef F77_INT
00026 F77_INT F77_N=N, F77_lda=lda, F77_incX=incX;
00027 #else
00028 #define F77_N N
00029 #define F77_lda lda
00030 #define F77_incX incX
00031 #endif
00032 int n, i=0, tincX;
00033 double *st=0,*x=(double *)X;
00034 extern int CBLAS_CallFromC;
00035 extern int RowMajorStrg;
00036 RowMajorStrg = 0;
00037
00038 CBLAS_CallFromC = 1;
00039 if (order == CblasColMajor)
00040 {
00041 if (Uplo == CblasUpper) UL = 'U';
00042 else if (Uplo == CblasLower) UL = 'L';
00043 else
00044 {
00045 cblas_xerbla(2, "cblas_ztrsv","Illegal Uplo setting, %d\n", Uplo);
00046 CBLAS_CallFromC = 0;
00047 RowMajorStrg = 0;
00048 return;
00049 }
00050 if (TransA == CblasNoTrans) TA = 'N';
00051 else if (TransA == CblasTrans) TA = 'T';
00052 else if (TransA == CblasConjTrans) TA = 'C';
00053 else
00054 {
00055 cblas_xerbla(3, "cblas_ztrsv","Illegal TransA setting, %d\n", TransA);
00056 CBLAS_CallFromC = 0;
00057 RowMajorStrg = 0;
00058 return;
00059 }
00060 if (Diag == CblasUnit) DI = 'U';
00061 else if (Diag == CblasNonUnit) DI = 'N';
00062 else
00063 {
00064 cblas_xerbla(4, "cblas_ztrsv","Illegal Diag setting, %d\n", Diag);
00065 CBLAS_CallFromC = 0;
00066 RowMajorStrg = 0;
00067 return;
00068 }
00069 #ifdef F77_CHAR
00070 F77_UL = C2F_CHAR(&UL);
00071 F77_TA = C2F_CHAR(&TA);
00072 F77_DI = C2F_CHAR(&DI);
00073 #endif
00074 F77_ztrsv( F77_UL, F77_TA, F77_DI, &F77_N, A, &F77_lda, X,
00075 &F77_incX);
00076 }
00077 else if (order == CblasRowMajor)
00078 {
00079 RowMajorStrg = 1;
00080 if (Uplo == CblasUpper) UL = 'L';
00081 else if (Uplo == CblasLower) UL = 'U';
00082 else
00083 {
00084 cblas_xerbla(2, "cblas_ztrsv","Illegal Uplo setting, %d\n", Uplo);
00085 CBLAS_CallFromC = 0;
00086 RowMajorStrg = 0;
00087 return;
00088 }
00089
00090 if (TransA == CblasNoTrans) TA = 'T';
00091 else if (TransA == CblasTrans) TA = 'N';
00092 else if (TransA == CblasConjTrans)
00093 {
00094 TA = 'N';
00095 if ( N > 0)
00096 {
00097 if ( incX > 0 )
00098 tincX = incX;
00099 else
00100 tincX = -incX;
00101
00102 n = N*2*(tincX);
00103 x++;
00104 st=x+n;
00105 i = tincX << 1;
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_ztrsv","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_ztrsv","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_ztrsv( 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_ztrsv", "Illegal Order setting, %d\n", order);
00153 CBLAS_CallFromC = 0;
00154 RowMajorStrg = 0;
00155 return;
00156 }