|
DenseLinAlgPack: Concreate C++ Classes for Dense Blas-Compatible Linear Algebra Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00005 // Copyright (2003) 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 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #include "DenseLinAlgPack_BLAS_Cpp.hpp" 00030 00031 // ///////////////////////////////////// 00032 // Fortran function declarations. 00033 00034 namespace BLAS_C_Decl { 00035 00036 typedef FortranTypes::f_int f_int; 00037 typedef FortranTypes::f_real f_real; 00038 typedef FortranTypes::f_dbl_prec f_dbl_prec; 00039 00040 // function declarations 00041 // (don't use these directly, use the later overloaded wrappers in namespace BLAS) 00042 extern "C" { 00043 00044 // //////////////////////////////////////// 00045 // Level 1 BLAS (vector-vector operations) 00046 00047 // Generate plane rotation 00048 FORTRAN_FUNC_DECL_UL(void,DROTG,drotg)(f_dbl_prec* A, f_dbl_prec* B, f_dbl_prec* C, f_dbl_prec* S); 00049 00050 // Apply plane rotation 00051 FORTRAN_FUNC_DECL_UL(void,DROT,drot)(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY, 00052 const f_dbl_prec& C, const f_dbl_prec& S); 00053 00054 // Interchange vectors 00055 FORTRAN_FUNC_DECL_UL(void,DSWAP,dswap)(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY); 00056 00057 // DVector scaling 00058 FORTRAN_FUNC_DECL_UL(void,DSCAL,dscal)(const f_int& N, const f_dbl_prec& ALPHA, f_dbl_prec* X, const f_int& INCX); 00059 00060 // DVector copy 00061 FORTRAN_FUNC_DECL_UL(void,DCOPY,dcopy)(const f_int& N, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY); 00062 00063 // y = a*x + y 00064 FORTRAN_FUNC_DECL_UL(void,DAXPY,daxpy)(const f_int& N, const f_dbl_prec& A, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, 00065 const f_int& INCY); 00066 00067 // Dot product 00068 FORTRAN_FUNC_DECL_UL(f_dbl_prec,DDOT,ddot)(const f_int& N, const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec* Y, const f_int& INCY); 00069 FORTRAN_FUNC_DECL_UL(f_dbl_prec,DSDOT,dsdot)(const f_int& N, const f_real* X, const f_int& INCX, const f_real* Y, const f_int& INCY); 00070 00071 // 2-Norm 00072 FORTRAN_FUNC_DECL_UL(f_dbl_prec,DNRM2,dnrm2)(const f_int& N, const f_dbl_prec* X, const f_int& INCX); 00073 00074 // Sum of magnitudes 00075 FORTRAN_FUNC_DECL_UL(f_dbl_prec,DASUM,dasum)(const f_int& N, const f_dbl_prec* X, const f_int& INCX); 00076 00077 // Largest component of vector 00078 FORTRAN_FUNC_DECL_UL(f_dbl_prec,IDAMAX,idamax)(const f_int& N, const f_dbl_prec* X, const f_int& INCX); 00079 00080 // //////////////////////////////////////// 00081 // Level 2 BLAS (matrix-vector operations) 00082 00083 // General rectangular matrix-vector products 00084 FORTRAN_FUNC_DECL_UL(void,DGEMV,dgemv)(FORTRAN_CONST_CHAR_1_ARG(TRANSA) 00085 , const f_int& M, const f_int& N, const f_dbl_prec& ALPHA 00086 , const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* X, const f_int& INCX 00087 , const f_dbl_prec& BETA, f_dbl_prec* Y, const f_int& INCY 00088 ); 00089 00090 // General band matrix-vector products 00091 FORTRAN_FUNC_DECL_UL(void,DGBMV,dgbmv)(FORTRAN_CONST_CHAR_1_ARG(TRANSA) 00092 , const f_int& M, const f_int& N, const f_int& KL, const f_int& KU 00093 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* X 00094 , const f_int& INCX, const f_dbl_prec& BETA, f_dbl_prec* Y, const f_int& INCY 00095 ); 00096 00097 // Hermitian matrix-vector products 00098 00099 // Hermitian band matrix-vector products 00100 00101 // Hermitian packed matrix-vector products 00102 00103 // Symmetric matrix-vector products 00104 FORTRAN_FUNC_DECL_UL(void,DSYMV,dsymv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00105 , const f_int& N 00106 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA 00107 , const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec& BETA 00108 , f_dbl_prec* Y, const f_int& INCY 00109 ); 00110 00111 // Symmetric band matrix-vector products 00112 FORTRAN_FUNC_DECL_UL(void,DSBMV,dsbmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00113 , const f_int& N, const f_int& K 00114 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA 00115 , const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec& BETA 00116 , f_dbl_prec* Y, const f_int& INCY 00117 ); 00118 00119 // Symmetric packed matrix-vector products 00120 FORTRAN_FUNC_DECL_UL(void,DSPMV,dspmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00121 , const f_int& N 00122 , const f_dbl_prec& ALPHA, const f_dbl_prec* AP 00123 , const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec& BETA 00124 , f_dbl_prec* Y, const f_int& INCY 00125 ); 00126 00127 // Triangular matrix-vector products 00128 FORTRAN_FUNC_DECL_UL(void,DTRMV,dtrmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00129 , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N 00130 , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX); 00131 00132 // Triangular band matrix-vector products 00133 FORTRAN_FUNC_DECL_UL(void,DTBMV,dtbmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00134 , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG) 00135 , const f_int& N, const f_int& K 00136 , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX); 00137 00138 // Triangular packed matrix-vector products 00139 FORTRAN_FUNC_DECL_UL(void,DTPMV,dtpmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00140 , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N 00141 , const f_dbl_prec* AP, f_dbl_prec* X, const f_int& INCX); 00142 00143 // Triangular equation solve 00144 FORTRAN_FUNC_DECL_UL(void,DTRSV,dtrsv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00145 , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N 00146 , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX); 00147 00148 // Triangular band equation solve 00149 FORTRAN_FUNC_DECL_UL(void,DTBSV,dtbsv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00150 , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N 00151 , const f_int& K 00152 , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX); 00153 00154 // Triangular packed equation solve 00155 FORTRAN_FUNC_DECL_UL(void,DTPSV,dtpsv)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00156 , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N 00157 , const f_dbl_prec* AP, f_dbl_prec* X, const f_int& INCX); 00158 00159 // General rank-1 update 00160 FORTRAN_FUNC_DECL_UL(void,DGER,dger)(const f_int& M, const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX, 00161 const f_dbl_prec* Y, const f_int& INCY, f_dbl_prec* A, const f_int& LDA); 00162 00163 // Hermitian rank-1 update 00164 00165 // Hermitian packed rank-1 update 00166 00167 // Hermitian rank-2 update 00168 00169 // Hermitian packed rank-2 update 00170 00171 // Symmetric rank-1 update 00172 FORTRAN_FUNC_DECL_UL(void,DSYR,dsyr)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00173 , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX 00174 , f_dbl_prec* A, const f_int& LDA); 00175 00176 // Symmetric packed rank-1 update 00177 FORTRAN_FUNC_DECL_UL(void,DSPR,dspr)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00178 , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX 00179 , f_dbl_prec* AP); 00180 00181 // Symmetric rank-2 update 00182 FORTRAN_FUNC_DECL_UL(void,DSYR2,dsyr2)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00183 , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX 00184 , const f_dbl_prec* Y, const f_int& INCY, f_dbl_prec* A, const f_int& LDA); 00185 00186 // Symmetric packed rank-2 update 00187 FORTRAN_FUNC_DECL_UL(void,DSPR2,dspr2)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00188 , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX 00189 , const f_dbl_prec* Y, const f_int& INCY, f_dbl_prec* AP); 00190 00191 // //////////////////////////////////////// 00192 // Level 3 BLAS (matrix-matrix operations) 00193 00194 // General rectangular matrix-matrix product 00195 FORTRAN_FUNC_DECL_UL(void,DGEMM,dgemm)(FORTRAN_CONST_CHAR_1_ARG(TRANSA) 00196 , FORTRAN_CONST_CHAR_1_ARG(TRANSB), const f_int& M, const f_int& N, const f_int& K 00197 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* B 00198 , const f_int& LDB, const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC); 00199 00200 // Symmetric matrix-matrix product 00201 FORTRAN_FUNC_DECL_UL(void,DSYMM,dsymm)(FORTRAN_CONST_CHAR_1_ARG(SIDE) 00202 , FORTRAN_CONST_CHAR_1_ARG(UPLO), const f_int& M, const f_int& N 00203 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* B 00204 , const f_int& LDB, const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC); 00205 00206 // Hermitian matrix-matrix product 00207 00208 // Symmetric rank-k update 00209 FORTRAN_FUNC_DECL_UL(void,DSYRK,dsyrk)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00210 , FORTRAN_CONST_CHAR_1_ARG(TRANS), const f_int& N, const f_int& K 00211 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA 00212 , const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC); 00213 00214 // Hermitian rank-k update 00215 00216 // Symmetric rank-2k update 00217 FORTRAN_FUNC_DECL_UL(void,DSYR2K,dsyr2k)(FORTRAN_CONST_CHAR_1_ARG(UPLO) 00218 , FORTRAN_CONST_CHAR_1_ARG(TRANS), const f_int& N, const f_int& K 00219 , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* B 00220 , const f_int& LDB, const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC); 00221 00222 // Hermitian rank-2k update 00223 00224 // Triangular matrix-matrix product 00225 FORTRAN_FUNC_DECL_UL(void,DTRMM,dtrmm)(FORTRAN_CONST_CHAR_1_ARG(SIDE) 00226 , FORTRAN_CONST_CHAR_1_ARG(UPLO), FORTRAN_CONST_CHAR_1_ARG(TRANSA) 00227 , FORTRAN_CONST_CHAR_1_ARG(DIAG) 00228 , const f_int& M, const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* A 00229 , const f_int& LDA, f_dbl_prec* B, const f_int& LDB); 00230 00231 // Solution of triangular system 00232 FORTRAN_FUNC_DECL_UL(void,DTRSM,dtrsm)(FORTRAN_CONST_CHAR_1_ARG(SIDE) 00233 , FORTRAN_CONST_CHAR_1_ARG(UPLO), FORTRAN_CONST_CHAR_1_ARG(TRANSA) 00234 , FORTRAN_CONST_CHAR_1_ARG(DIAG) 00235 , const f_int& M, const f_int& N, const f_dbl_prec& ALPHA 00236 , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* B, const f_int& LDB); 00237 00238 } // end extern "C" 00239 00240 } // end namespace BLAS_C_Decl 00241 00242 // //////////////////////////////////////////////////////// 00243 // C++ BLAS Function Declarations 00244 00245 // Level 1 BLAS (vector-vector operations) 00246 00247 void BLAS_Cpp::rotg(f_dbl_prec* a, f_dbl_prec* b, f_dbl_prec* c, f_dbl_prec* s) { 00248 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DROTG,drotg)(a,b,c,s); 00249 } 00250 00251 // Apply plane rotation 00252 00253 void BLAS_Cpp::rot(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY 00254 , const f_dbl_prec& C, const f_dbl_prec& S) 00255 { 00256 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DROT,drot)(N, X, INCX, Y, INCY, C, S); 00257 } 00258 00259 // Interchange vectors 00260 00261 void BLAS_Cpp::swap(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY) 00262 { 00263 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSWAP,dswap)(N, X, INCX, Y, INCY); 00264 } 00265 00266 // DVector scaling 00267 00268 void BLAS_Cpp::scal(const f_int& N, const f_dbl_prec& ALPHA, f_dbl_prec* X, const f_int& INCX) 00269 { 00270 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSCAL,dscal)(N, ALPHA, X, INCX); 00271 } 00272 00273 // DVector copy 00274 00275 void BLAS_Cpp::copy(const f_int& N, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY) 00276 { 00277 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DCOPY,dcopy)(N, X, INCX, Y, INCY); 00278 } 00279 00280 // y = a*x + y 00281 00282 void BLAS_Cpp::axpy(const f_int& N, const f_dbl_prec& A, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y 00283 , const f_int& INCY) 00284 { 00285 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DAXPY,daxpy)(N, A, X, INCX, Y, INCY); 00286 } 00287 00288 // Dot product 00289 00290 BLAS_Cpp::f_dbl_prec BLAS_Cpp::dot(const f_int& N, const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec* Y, const f_int& INCY) 00291 { 00292 return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DDOT,ddot)(N, X, INCX, Y, INCY); 00293 } 00294 00295 // 2-Norm 00296 00297 BLAS_Cpp::f_dbl_prec BLAS_Cpp::nrm2(const f_int& N, const f_dbl_prec* X, const f_int& INCX) 00298 { 00299 return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DNRM2,dnrm2)(N, X, INCX); 00300 } 00301 00302 // 1-Norm 00303 00304 BLAS_Cpp::f_dbl_prec BLAS_Cpp::asum(const f_int& N, const f_dbl_prec* X, const f_int& INCX) 00305 { 00306 return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DASUM,dasum)(N, X, INCX); 00307 } 00308 00309 // Inifinity-Norm 00310 00311 BLAS_Cpp::f_dbl_prec BLAS_Cpp::iamax(const f_int& N, const f_dbl_prec* X, const f_int& INCX) 00312 { 00313 return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(IDAMAX,idamax)(N, X, INCX); 00314 } 00315 00316 // Level-2 BLAS (matrix-vector operations) 00317 00318 // General rectangular matrix-vector products 00319 00320 void BLAS_Cpp::gemv(Transp transa, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa 00321 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy) 00322 { 00323 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DGEMV,dgemv)(FORTRAN_CHAR_1_ARG_CALL(TransChar[transa]), m, n, alpha, pa, lda, x, incx, beta, py, incy); 00324 } 00325 00326 // General band matrix-vector products 00327 00328 void BLAS_Cpp::gbmv(Transp transa, f_int m, f_int n, f_int kl, f_int ku, f_dbl_prec alpha, const f_dbl_prec* pa 00329 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy) 00330 { 00331 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DGBMV,dgbmv)(FORTRAN_CHAR_1_ARG_CALL(TransChar[transa]), m, n, kl, ku, alpha, pa, lda, x, incx, beta, py, incy); 00332 } 00333 00334 // Hermitian matrix-vector products 00335 00336 // Hermitian band matrix-vector products 00337 00338 // Hermitian packed matrix-vector products 00339 00340 // Symmetric matrix-vector products 00341 00342 void BLAS_Cpp::symv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa 00343 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy) 00344 { 00345 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYMV,dsymv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, pa, lda, x, incx, beta, py, incy); 00346 } 00347 00348 // Symmetric band matrix-vector products 00349 00350 void BLAS_Cpp::sbmv(Uplo uplo, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00351 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy) 00352 { 00353 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSBMV,dsbmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, k, alpha, pa, lda, x, incx, beta, py, incy); 00354 } 00355 00356 // Symmetric packed matrix-vector products 00357 00358 void BLAS_Cpp::spmv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pap 00359 , const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy) 00360 { 00361 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSPMV,dspmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, pap, x, incx, beta, py, incy); 00362 } 00363 00364 // Triangular matrix-vector products 00365 00366 void BLAS_Cpp::trmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa 00367 , f_int lda, f_dbl_prec* px, f_int incx) 00368 { 00369 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRMV,dtrmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00370 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]),FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]) 00371 ,n, pa, lda, px, incx); 00372 } 00373 00374 // Triangular band matrix-vector products 00375 00376 void BLAS_Cpp::tbmv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa 00377 , f_int lda, f_dbl_prec* px, f_int incx) 00378 { 00379 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTBMV,dtbmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00380 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]) 00381 ,n, k, pa, lda, px, incx); 00382 } 00383 00384 // Triangular packed matrix-vector products 00385 00386 void BLAS_Cpp::tpmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap 00387 , f_dbl_prec* px, f_int incx) 00388 { 00389 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTPMV,dtpmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00390 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]) 00391 ,n, pap, px, incx); 00392 } 00393 00394 // Triangular equation solve 00395 00396 void BLAS_Cpp::trsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa 00397 , f_int lda, f_dbl_prec* px, f_int incx) 00398 { 00399 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRSV,dtrsv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00400 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]) 00401 ,n, pa, lda, px, incx); 00402 } 00403 00404 // Triangular band equation solve 00405 00406 void BLAS_Cpp::tbsv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa 00407 , f_int lda, f_dbl_prec* px, f_int incx) 00408 { 00409 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTBSV,dtbsv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00410 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]) 00411 ,n, k, pa, lda, px, incx); 00412 } 00413 00414 // Triangular packed equation solve 00415 00416 void BLAS_Cpp::tpsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap 00417 , f_dbl_prec* px, f_int incx) 00418 { 00419 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTPSV,dtpsv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00420 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]) 00421 ,n, pap, px, incx); 00422 } 00423 00424 // General rank-1 update 00425 00426 void BLAS_Cpp::ger(f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00427 , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda) 00428 { 00429 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DGER,dger)(m, n, alpha, px, incx, py, incy, pa, lda); 00430 } 00431 00432 // Hermitian rank-1 update 00433 00434 // Hermitian packed rank-1 update 00435 00436 // Hermitian rank-2 update 00437 00438 // Hermitian packed rank-2 update 00439 00440 // Symmetric rank-1 update 00441 00442 void BLAS_Cpp::syr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00443 , f_int incx, f_dbl_prec* pa, f_int lda) 00444 { 00445 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYR,dsyr)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, pa, lda); 00446 } 00447 00448 // Symmetric packed rank-1 update 00449 00450 void BLAS_Cpp::spr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00451 , f_int incx, f_dbl_prec* pap) 00452 { 00453 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSPR,dspr)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, pap); 00454 } 00455 00456 // Symmetric rank-2 update 00457 00458 void BLAS_Cpp::syr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00459 , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda) 00460 { 00461 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYR2,dsyr2)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, py, incy, pa, lda); 00462 } 00463 00464 // Symmetric packed rank-2 update 00465 00466 void BLAS_Cpp::spr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00467 , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pap) 00468 { 00469 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSPR2,dspr2)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, py, incy, pap); 00470 } 00471 00472 // Level 3 BLAS (matrix-matrix operations) 00473 00474 // General rectangular matrix-matrix product 00475 00476 void BLAS_Cpp::gemm(Transp transa, Transp transb, f_int m, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00477 , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc) 00478 { 00479 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DGEMM,dgemm)(FORTRAN_CHAR_1_ARG_CALL(TransChar[transa]) 00480 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[transb]), m, n, k, alpha, pa, lda, pb, ldb 00481 , beta, pc, ldc); 00482 } 00483 00484 // Symmetric matrix-matrix product 00485 00486 void BLAS_Cpp::symm(Side side, Uplo uplo, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa 00487 , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc) 00488 { 00489 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYMM,dsymm)(FORTRAN_CHAR_1_ARG_CALL(SideChar[side]), FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), m, n, alpha, pa, lda, pb, ldb, beta, pc, ldc); 00490 } 00491 00492 // Hermitian matrix-matrix product 00493 00494 // Symmetric rank-k update 00495 00496 void BLAS_Cpp::syrk(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00497 , f_int lda, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc) 00498 { 00499 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYRK,dsyrk)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00500 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), n, k, alpha, pa, lda, beta, pc, ldc); 00501 } 00502 00503 // Hermitian rank-k update 00504 00505 // Symmetric rank-2k update 00506 00507 void BLAS_Cpp::syr2k(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00508 , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc) 00509 { 00510 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYR2K,dsyr2k)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]) 00511 ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), n, k, alpha, pa, lda, pb, ldb 00512 ,beta, pc, ldc); 00513 } 00514 00515 // Hermitian rank-2k update 00516 00517 // Triangular matrix-matrix product 00518 00519 void BLAS_Cpp::trmm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha 00520 , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb) 00521 { 00522 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRMM,dtrmm)(FORTRAN_CHAR_1_ARG_CALL(SideChar[side]) 00523 ,FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), FORTRAN_CHAR_1_ARG_CALL(TransChar[transa]) 00524 ,FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]), m, n, alpha, pa, lda, pb, ldb); 00525 } 00526 00527 // Solution of triangular system 00528 00529 void BLAS_Cpp::trsm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha 00530 , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb) 00531 { 00532 BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRSM,dtrsm)(FORTRAN_CHAR_1_ARG_CALL(SideChar[side]) 00533 ,FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), FORTRAN_CHAR_1_ARG_CALL(TransChar[transa]) 00534 ,FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]), m, n, alpha, pa, lda, pb, ldb); 00535 }
1.7.4