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