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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:15