Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Teuchos_BLAS.cpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 //
00004 //                    Teuchos: Common Tools Package
00005 //                 Copyright (2004) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #include "Teuchos_BLAS.hpp"
00043 #include "Teuchos_BLAS_wrappers.hpp"
00044 
00045 #ifdef TEUCHOS_BLAS_APPLE_VECLIB_ERROR
00046 #include <vecLib/cblas.h>
00047 #endif
00048 
00049 const char Teuchos::ESideChar[] = {'L' , 'R' };
00050 const char Teuchos::ETranspChar[] = {'N' , 'T' , 'C' };
00051 const char Teuchos::EUploChar[] = {'U' , 'L' };
00052 const char Teuchos::EDiagChar[] = {'U' , 'N' };
00053 //const char Teuchos::EFactChar[] = {'F', 'N' };
00054 //const char Teuchos::ENormChar[] = {'O', 'I' };
00055 //const char Teuchos::ECompQChar[] = {'N', 'I', 'V' };
00056 //const char Teuchos::EJobChar[] = {'E', 'V', 'B' };
00057 //const char Teuchos::EJobSChar[] = {'E', 'S' };
00058 //const char Teuchos::EJobVSChar[] = {'V', 'N' };
00059 //const char Teuchos::EHowmnyChar[] = {'A', 'S' };
00060 //const char Teuchos::ECMachChar[] = {'E', 'S', 'B', 'P', 'N', 'R', 'M', 'U', 'L', 'O' };
00061 //const char Teuchos::ESortChar[] = {'N', 'S'};
00062 
00063 
00064 namespace {
00065 
00066 
00067 template<typename Scalar>
00068 Scalar generic_dot(const int n, const Scalar* x, const int incx,
00069   const Scalar* y, const int incy)
00070 {
00071   typedef Teuchos::ScalarTraits<Scalar> ST;
00072   Scalar dot = 0.0;
00073   if (incx==1 && incy==1) {
00074     for (int i = 0; i < n; ++i)
00075       dot += (*x++)*ST::conjugate(*y++);
00076   }
00077   else {
00078     if (incx < 0)
00079       x = x - incx*(n-1);
00080     if (incy < 0)
00081       y = y - incy*(n-1);
00082     for (int i = 0; i < n; ++i, x+=incx, y+=incy)
00083       dot += (*x)*ST::conjugate(*y);
00084   }
00085   return dot;
00086 }  
00087 
00088 
00089 } // namespace
00090 
00091 
00092 namespace Teuchos {
00093 
00094 //Explicitly instantiating these templates for windows due to an issue with
00095 //resolving them when linking dlls.
00096 #ifdef _WIN32
00097 #  ifdef HAVE_TEUCHOS_COMPLEX
00098      template BLAS<long int, std::complex<float> >;
00099      template BLAS<long int, std::complex<double> >;
00100 #  endif
00101      template BLAS<long int, float>;
00102      template BLAS<long int, double>;
00103 #endif
00104 
00105   // *************************** BLAS<int,float> DEFINITIONS ******************************  
00106 
00107   void BLAS<int, float>::ROTG(float* da, float* db, float* c, float* s) const
00108   { SROTG_F77(da, db, c, s ); }
00109 
00110   void BLAS<int, float>::ROT(const int n, float* dx, const int incx, float* dy, const int incy, float* c, float* s) const
00111   { SROT_F77(&n, dx, &incx, dy, &incy, c, s); }
00112 
00113   
00114   float BLAS<int, float>::ASUM(const int n, const float* x, const int incx) const
00115   {
00116     typedef ScalarTraits<float> ST;
00117 #ifdef HAVE_TEUCHOS_BLASFLOAT
00118     float tmp = SASUM_F77(&n, x, &incx);
00119     return tmp;
00120 #else
00121     float sum = 0.0;
00122     if (incx == 1) {
00123       for (int i = 0; i < n; ++i)
00124         sum += ST::magnitude(*x++);
00125     }
00126     else {
00127       for (int i = 0; i < n; ++i, x+=incx)
00128         sum += ST::magnitude(*x);
00129     }
00130     return sum;
00131 #endif
00132   }
00133     
00134   void BLAS<int, float>::AXPY(const int n, const float alpha, const float* x, const int incx, float* y, const int incy) const
00135   { SAXPY_F77(&n, &alpha, x, &incx, y, &incy); }
00136   
00137   void BLAS<int, float>::COPY(const int n, const float* x, const int incx, float* y, const int incy) const 
00138   { SCOPY_F77(&n, x, &incx, y, &incy); }
00139   
00140   float BLAS<int, float>::DOT(const int n, const float* x, const int incx, const float* y, const int incy) const
00141   {
00142 #ifdef HAVE_TEUCHOS_BLASFLOAT
00143     return SDOT_F77(&n, x, &incx, y, &incy);
00144 #else
00145     return generic_dot(n, x, incx, y, incy);
00146 #endif
00147   }
00148   
00149   int BLAS<int, float>::IAMAX(const int n, const float* x, const int incx) const
00150   { return ISAMAX_F77(&n, x, &incx); }
00151 
00152   float BLAS<int, float>::NRM2(const int n, const float* x, const int incx) const
00153   {
00154 #if defined(HAVE_TEUCHOS_BLASFLOAT)
00155     return SNRM2_F77(&n, x, &incx);
00156 #else
00157     return ScalarTraits<float>::squareroot(generic_dot(n, x, incx, x, incx));
00158 #endif
00159   }
00160   
00161   void BLAS<int, float>::SCAL(const int n, const float alpha, float* x, const int incx) const
00162   { SSCAL_F77(&n, &alpha, x, &incx); }
00163   
00164   void BLAS<int, float>::GEMV(ETransp trans, const int m, const int n, const float alpha, const float* A, const int lda, const float* x, const int incx, const float beta, float* y, const int incy) const
00165   { SGEMV_F77(CHAR_MACRO(ETranspChar[trans]), &m, &n, &alpha, A, &lda, x, &incx, &beta, y, &incy); }
00166   
00167   void BLAS<int, float>::GER(const int m, const int n, const float alpha, const float* x, const int incx, const float* y, const int incy, float* A, const int lda) const
00168   { SGER_F77(&m, &n, &alpha, x, &incx, y, &incy, A, &lda); }
00169 
00170   void BLAS<int, float>::TRMV(EUplo uplo, ETransp trans, EDiag diag, const int n, const float* A, const int lda, float* x, const int incx) const
00171   { STRMV_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), CHAR_MACRO(EDiagChar[diag]), &n, A, &lda, x, &incx); }
00172   
00173   void BLAS<int, float>::GEMM(ETransp transa, ETransp transb, const int m, const int n, const int k, const float alpha, const float* A, const int lda, const float* B, const int ldb, const float beta, float* C, const int ldc) const
00174   { SGEMM_F77(CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(ETranspChar[transb]), &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00175   
00176   void BLAS<int, float>::SYMM(ESide side, EUplo uplo, const int m, const int n, const float alpha, const float* A, const int lda, const float* B, const int ldb, const float beta, float* C, const int ldc) const
00177   { SSYMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), &m, &n, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00178   
00179   void BLAS<int, float>::SYRK(EUplo uplo, ETransp trans, const int n, const int k, const float alpha, const float* A, const int lda, const float beta, float* C, const int ldc) const
00180   { SSYRK_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), &n, &k, &alpha, A, &lda, &beta, C, &ldc); }
00181   
00182   void BLAS<int, float>::TRMM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const float alpha, const float* A, const int lda, float* B, const int ldb) const
00183   { STRMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00184   
00185   void BLAS<int, float>::TRSM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const float alpha, const float* A, const int lda, float* B, const int ldb) const
00186   { STRSM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00187 
00188   // *************************** BLAS<int,double> DEFINITIONS ******************************  
00189   
00190   void BLAS<int, double>::ROTG(double* da, double* db, double* c, double* s) const
00191   { DROTG_F77(da, db, c, s); }
00192 
00193   void BLAS<int, double>::ROT(const int n, double* dx, const int incx, double* dy, const int incy, double* c, double* s) const
00194   { DROT_F77(&n, dx, &incx, dy, &incy, c, s); }
00195 
00196   double BLAS<int, double>::ASUM(const int n, const double* x, const int incx) const
00197   { return DASUM_F77(&n, x, &incx); }
00198   
00199   void BLAS<int, double>::AXPY(const int n, const double alpha, const double* x, const int incx, double* y, const int incy) const
00200   { DAXPY_F77(&n, &alpha, x, &incx, y, &incy); }
00201   
00202   void BLAS<int, double>::COPY(const int n, const double* x, const int incx, double* y, const int incy) const
00203   { DCOPY_F77(&n, x, &incx, y, &incy); }
00204   
00205   double BLAS<int, double>::DOT(const int n, const double* x, const int incx, const double* y, const int incy) const
00206   {
00207     return DDOT_F77(&n, x, &incx, y, &incy);
00208   }
00209   
00210   int BLAS<int, double>::IAMAX(const int n, const double* x, const int incx) const
00211   { return IDAMAX_F77(&n, x, &incx); }
00212 
00213   double BLAS<int, double>::NRM2(const int n, const double* x, const int incx) const
00214   { return DNRM2_F77(&n, x, &incx); }
00215   
00216   void BLAS<int, double>::SCAL(const int n, const double alpha, double* x, const int incx) const
00217   { DSCAL_F77(&n, &alpha, x, &incx); }
00218   
00219   void BLAS<int, double>::GEMV(ETransp trans, const int m, const int n, const double alpha, const double* A, const int lda, const double* x, const int incx, const double beta, double* y, const int incy) const
00220   { DGEMV_F77(CHAR_MACRO(ETranspChar[trans]), &m, &n, &alpha, A, &lda, x, &incx, &beta, y, &incy); }
00221   
00222   void BLAS<int, double>::GER(const int m, const int n, const double alpha, const double* x, const int incx, const double* y, const int incy, double* A, const int lda) const
00223   { DGER_F77(&m, &n, &alpha, x, &incx, y, &incy, A, &lda); }
00224 
00225   void BLAS<int, double>::TRMV(EUplo uplo, ETransp trans, EDiag diag, const int n, const double* A, const int lda, double* x, const int incx) const
00226   { DTRMV_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), CHAR_MACRO(EDiagChar[diag]), &n, A, &lda, x, &incx); }
00227   
00228   void BLAS<int, double>::GEMM(ETransp transa, ETransp transb, const int m, const int n, const int k, const double alpha, const double* A, const int lda, const double* B, const int ldb, const double beta, double* C, const int ldc) const
00229   { DGEMM_F77(CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(ETranspChar[transb]), &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00230   
00231   void BLAS<int, double>::SYMM(ESide side, EUplo uplo, const int m, const int n, const double alpha, const double* A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc) const
00232   { DSYMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), &m, &n, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00233   
00234   void BLAS<int, double>::SYRK(EUplo uplo, ETransp trans, const int n, const int k, const double alpha, const double* A, const int lda, const double beta, double* C, const int ldc) const
00235   { DSYRK_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), &n, &k, &alpha, A, &lda, &beta, C, &ldc); }
00236   
00237   void BLAS<int, double>::TRMM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const double alpha, const double* A, const int lda, double* B, const int ldb) const
00238   { DTRMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00239 
00240   void BLAS<int, double>::TRSM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const double alpha, const double* A, const int lda, double* B, const int ldb) const
00241   { DTRSM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00242   
00243 #ifdef HAVE_TEUCHOS_COMPLEX
00244 
00245   // *************************** BLAS<int,std::complex<float> > DEFINITIONS ******************************  
00246 
00247   void BLAS<int, std::complex<float> >::ROTG(std::complex<float>* da, std::complex<float>* db, float* c, std::complex<float>* s) const
00248   { CROTG_F77(da, db, c, s ); }
00249 
00250   void BLAS<int, std::complex<float> >::ROT(const int n, std::complex<float>* dx, const int incx, std::complex<float>* dy, const int incy, float* c, std::complex<float>* s) const
00251   { CROT_F77(&n, dx, &incx, dy, &incy, c, s); }
00252 
00253   float BLAS<int, std::complex<float> >::ASUM(const int n, const std::complex<float>* x, const int incx) const
00254   { return CASUM_F77(&n, x, &incx); }
00255   
00256   void BLAS<int, std::complex<float> >::AXPY(const int n, const std::complex<float> alpha, const std::complex<float>* x, const int incx, std::complex<float>* y, const int incy) const
00257   { CAXPY_F77(&n, &alpha, x, &incx, y, &incy); }
00258   
00259   void BLAS<int, std::complex<float> >::COPY(const int n, const std::complex<float>* x, const int incx, std::complex<float>* y, const int incy) const
00260   { CCOPY_F77(&n, x, &incx, y, &incy); }
00261   
00262   std::complex<float> BLAS<int, std::complex<float> >::DOT(const int n, const std::complex<float>* x, const int incx, const std::complex<float>* y, const int incy) const
00263   { 
00264 #if defined(TEUCHOS_BLAS_APPLE_VECLIB_ERROR)
00265     std::complex<float> z;
00266     cblas_cdotc_sub(n,x,incx,y,incy,&z);
00267     return z;
00268 #elif defined(HAVE_COMPLEX_BLAS_PROBLEM) && defined(HAVE_FIXABLE_COMPLEX_BLAS_PROBLEM)
00269     std::complex<float> z;
00270     CDOT_F77(&z, &n, x, &incx, y, &incy); 
00271     return z;
00272 #else
00273     return CDOT_F77(&n, x, &incx, y, &incy); 
00274 #endif
00275   }
00276   
00277   int BLAS<int, std::complex<float> >::IAMAX(const int n, const std::complex<float>* x, const int incx) const
00278   { return ICAMAX_F77(&n, x, &incx); }
00279 
00280   float BLAS<int, std::complex<float> >::NRM2(const int n, const std::complex<float>* x, const int incx) const
00281   { return CNRM2_F77(&n, x, &incx); }
00282   
00283   void BLAS<int, std::complex<float> >::SCAL(const int n, const std::complex<float> alpha, std::complex<float>* x, const int incx) const
00284   { CSCAL_F77(&n, &alpha, x, &incx); }
00285   
00286   void BLAS<int, std::complex<float> >::GEMV(ETransp trans, const int m, const int n, const std::complex<float> alpha, const std::complex<float>* A, const int lda, const std::complex<float>* x, const int incx, const std::complex<float> beta, std::complex<float>* y, const int incy) const
00287   { CGEMV_F77(CHAR_MACRO(ETranspChar[trans]), &m, &n, &alpha, A, &lda, x, &incx, &beta, y, &incy); }
00288   
00289   void BLAS<int, std::complex<float> >::GER(const int m, const int n, const std::complex<float> alpha, const std::complex<float>* x, const int incx, const std::complex<float>* y, const int incy, std::complex<float>* A, const int lda) const
00290   { CGER_F77(&m, &n, &alpha, x, &incx, y, &incy, A, &lda); }
00291 
00292   void BLAS<int, std::complex<float> >::TRMV(EUplo uplo, ETransp trans, EDiag diag, const int n, const std::complex<float>* A, const int lda, std::complex<float>* x, const int incx) const
00293   { CTRMV_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), CHAR_MACRO(EDiagChar[diag]), &n, A, &lda, x, &incx); }
00294   
00295   void BLAS<int, std::complex<float> >::GEMM(ETransp transa, ETransp transb, const int m, const int n, const int k, const std::complex<float> alpha, const std::complex<float>* A, const int lda, const std::complex<float>* B, const int ldb, const std::complex<float> beta, std::complex<float>* C, const int ldc) const
00296   { CGEMM_F77(CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(ETranspChar[transb]), &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); } 
00297  
00298   void BLAS<int, std::complex<float> >::SYMM(ESide side, EUplo uplo, const int m, const int n, const std::complex<float> alpha, const std::complex<float>* A, const int lda, const std::complex<float>* B, const int ldb, const std::complex<float> beta, std::complex<float>* C, const int ldc) const
00299   { CSYMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), &m, &n, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00300   
00301   void BLAS<int, std::complex<float> >::SYRK(EUplo uplo, ETransp trans, const int n, const int k, const std::complex<float> alpha, const std::complex<float>* A, const int lda, const std::complex<float> beta, std::complex<float>* C, const int ldc) const
00302   { CSYRK_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), &n, &k, &alpha, A, &lda, &beta, C, &ldc); }
00303   
00304   void BLAS<int, std::complex<float> >::TRMM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const std::complex<float> alpha, const std::complex<float>* A, const int lda, std::complex<float>* B, const int ldb) const
00305   { CTRMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00306   
00307   void BLAS<int, std::complex<float> >::TRSM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const std::complex<float> alpha, const std::complex<float>* A, const int lda, std::complex<float>* B, const int ldb) const
00308   { CTRSM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00309 
00310   // *************************** BLAS<int,std::complex<double> > DEFINITIONS ******************************  
00311 
00312   void BLAS<int, std::complex<double> >::ROTG(std::complex<double>* da, std::complex<double>* db, double* c, std::complex<double>* s) const
00313   { ZROTG_F77(da, db, c, s); }
00314 
00315   void BLAS<int, std::complex<double> >::ROT(const int n, std::complex<double>* dx, const int incx, std::complex<double>* dy, const int incy, double* c, std::complex<double>* s) const
00316   { ZROT_F77(&n, dx, &incx, dy, &incy, c, s); }
00317 
00318   double BLAS<int, std::complex<double> >::ASUM(const int n, const std::complex<double>* x, const int incx) const
00319   { return ZASUM_F77(&n, x, &incx); }
00320   
00321   void BLAS<int, std::complex<double> >::AXPY(const int n, const std::complex<double> alpha, const std::complex<double>* x, const int incx, std::complex<double>* y, const int incy) const
00322   { ZAXPY_F77(&n, &alpha, x, &incx, y, &incy); }
00323   
00324   void BLAS<int, std::complex<double> >::COPY(const int n, const std::complex<double>* x, const int incx, std::complex<double>* y, const int incy) const
00325   { ZCOPY_F77(&n, x, &incx, y, &incy); }
00326   
00327   std::complex<double> BLAS<int, std::complex<double> >::DOT(const int n, const std::complex<double>* x, const int incx, const std::complex<double>* y, const int incy) const
00328   { 
00329 #if defined(TEUCHOS_BLAS_APPLE_VECLIB_ERROR)
00330     std::complex<double> z;
00331     cblas_zdotc_sub(n,x,incx,y,incy,&z);
00332     return z;
00333 #elif defined(HAVE_COMPLEX_BLAS_PROBLEM) && defined(HAVE_FIXABLE_COMPLEX_BLAS_PROBLEM)
00334     std::complex<double> z;
00335     ZDOT_F77(&z, &n, x, &incx, y, &incy); 
00336     return z;
00337 #else
00338     return ZDOT_F77(&n, x, &incx, y, &incy); 
00339 #endif
00340   }
00341   
00342   int BLAS<int, std::complex<double> >::IAMAX(const int n, const std::complex<double>* x, const int incx) const
00343   { return IZAMAX_F77(&n, x, &incx); }
00344 
00345   double BLAS<int, std::complex<double> >::NRM2(const int n, const std::complex<double>* x, const int incx) const
00346   { return ZNRM2_F77(&n, x, &incx); }
00347   
00348   void BLAS<int, std::complex<double> >::SCAL(const int n, const std::complex<double> alpha, std::complex<double>* x, const int incx) const
00349   { ZSCAL_F77(&n, &alpha, x, &incx); }
00350   
00351   void BLAS<int, std::complex<double> >::GEMV(ETransp trans, const int m, const int n, const std::complex<double> alpha, const std::complex<double>* A, const int lda, const std::complex<double>* x, const int incx, const std::complex<double> beta, std::complex<double>* y, const int incy) const
00352   { ZGEMV_F77(CHAR_MACRO(ETranspChar[trans]), &m, &n, &alpha, A, &lda, x, &incx, &beta, y, &incy); }
00353   
00354   void BLAS<int, std::complex<double> >::GER(const int m, const int n, const std::complex<double> alpha, const std::complex<double>* x, const int incx, const std::complex<double>* y, const int incy, std::complex<double>* A, const int lda) const
00355   { ZGER_F77(&m, &n, &alpha, x, &incx, y, &incy, A, &lda); }
00356 
00357   void BLAS<int, std::complex<double> >::TRMV(EUplo uplo, ETransp trans, EDiag diag, const int n, const std::complex<double>* A, const int lda, std::complex<double>* x, const int incx) const
00358   { ZTRMV_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), CHAR_MACRO(EDiagChar[diag]), &n, A, &lda, x, &incx); }
00359   
00360   void BLAS<int, std::complex<double> >::GEMM(ETransp transa, ETransp transb, const int m, const int n, const int k, const std::complex<double> alpha, const std::complex<double>* A, const int lda, const std::complex<double>* B, const int ldb, const std::complex<double> beta, std::complex<double>* C, const int ldc) const
00361   { ZGEMM_F77(CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(ETranspChar[transb]), &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00362   
00363   void BLAS<int, std::complex<double> >::SYMM(ESide side, EUplo uplo, const int m, const int n, const std::complex<double> alpha, const std::complex<double>* A, const int lda, const std::complex<double> *B, const int ldb, const std::complex<double> beta, std::complex<double> *C, const int ldc) const
00364   { ZSYMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), &m, &n, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); }
00365   
00366   void BLAS<int, std::complex<double> >::SYRK(EUplo uplo, ETransp trans, const int n, const int k, const std::complex<double> alpha, const std::complex<double>* A, const int lda, const std::complex<double> beta, std::complex<double>* C, const int ldc) const
00367   { ZSYRK_F77(CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[trans]), &n, &k, &alpha, A, &lda, &beta, C, &ldc); }
00368   
00369   void BLAS<int, std::complex<double> >::TRMM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const std::complex<double> alpha, const std::complex<double>* A, const int lda, std::complex<double>* B, const int ldb) const
00370   { ZTRMM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00371 
00372   void BLAS<int, std::complex<double> >::TRSM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const int m, const int n, const std::complex<double> alpha, const std::complex<double>* A, const int lda, std::complex<double>* B, const int ldb) const
00373   { ZTRSM_F77(CHAR_MACRO(ESideChar[side]), CHAR_MACRO(EUploChar[uplo]), CHAR_MACRO(ETranspChar[transa]), CHAR_MACRO(EDiagChar[diag]), &m, &n, &alpha, A, &lda, B, &ldb); }
00374   
00375 #endif // HAVE_TEUCHOS_COMPLEX
00376 
00377 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines