cblas_ctbmv.c
Go to the documentation of this file.
00001 /*
00002  * cblas_ctbmv.c
00003  * The program is a C interface to ctbmv.
00004  * 
00005  * Keita Teranishi  5/20/98
00006  *
00007  */
00008 #include "cblas.h"
00009 #include "cblas_f77.h"
00010 void cblas_ctbmv(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 int K, const void  *A, const int lda,
00013                  void  *X, 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_K=K, F77_incX=incX;
00027 #else
00028    #define F77_N N
00029    #define F77_K K
00030    #define F77_lda lda
00031    #define F77_incX incX
00032 #endif
00033    int n, i=0, tincX; 
00034    float *st=0, *x=(float *)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_ctbmv","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_ctbmv","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_ctbmv","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_ctbmv( F77_UL, F77_TA, F77_DI, &F77_N, &F77_K, 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_ctbmv","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_ctbmv","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_ctbmv","Illegal Uplo setting, %d\n", Uplo);
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 
00138       F77_ctbmv( F77_UL, F77_TA, F77_DI, &F77_N, &F77_K, A, &F77_lda, X,
00139                       &F77_incX);
00140 
00141       if (TransA == CblasConjTrans)
00142       {
00143          if (N > 0)
00144          {
00145             do
00146             {
00147                *x = -(*x);
00148                x += i;
00149             }
00150             while (x != st);
00151          }
00152       }
00153    }
00154    else cblas_xerbla(1, "cblas_ctbmv", "Illegal Order setting, %d\n", order);
00155    CBLAS_CallFromC = 0;
00156    RowMajorStrg = 0;
00157    return;
00158 }


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