|
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 // C++ overloads for BLAS kernals (element type removed from name and enum for operations) 00030 00031 #ifndef BLAS_CPP_OVERLOADS_DECLARATIONS_H 00032 #define BLAS_CPP_OVERLOADS_DECLARATIONS_H 00033 00034 #include "Teuchos_F77_wrappers.h" 00035 #include "BLAS_Cpp_Types.hpp" 00036 00037 // Overloaded BLAS wrappers. 00038 // The naming convention is the Fortran BLAS name minus the type prefix. 00039 namespace BLAS_Cpp { 00040 00041 typedef FortranTypes::f_int f_int; 00042 typedef FortranTypes::f_real f_real; 00043 typedef FortranTypes::f_dbl_prec f_dbl_prec; 00044 00045 /* * @name Option Arguments 00046 * These are emumerations that are used with the overloaded C++ BLAS declarations to replace the 00047 * error prone use of characters for specifying options 00048 * @memo enumerations (enum) 00049 */ 00050 // @{ 00051 00053 const char SideChar[] = {'L' , 'R' }; 00055 const char TransChar[] = {'N' , 'T' , 'C' }; 00057 const char UploChar[] = {'U' , 'L' }; 00059 const char DiagChar[] = {'U' , 'N' }; 00060 00061 // @} 00062 00063 /* * @name C++ BLAS Function Declarations 00064 * These are overloaded C++ functions that have removed the element type from the name 00065 * of the BLAS functions and use enumerations for the options arguments. 00066 */ 00067 // @{ 00068 00069 // /////////////////////////////////////////////////////////////////////////////////////////// 00070 /* * @name Level 1 BLAS (vector-vector operations) */ 00071 // @{ 00072 00073 /* * @name Generate plane rotation */ 00074 // @{ 00075 00077 void rotg( f_dbl_prec* a, f_dbl_prec* b, f_dbl_prec* c, f_dbl_prec* s ); 00078 00079 // @} 00080 00081 /* * @name Apply plane rotation */ 00082 // @{ 00083 00085 void rot(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY 00086 , const f_dbl_prec& C, const f_dbl_prec& S); 00087 // @} 00088 00089 /* * @name Interchange vectors */ 00090 // @{ 00091 00093 void swap(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY); 00094 00095 // @} 00096 00097 /* * @name DVector scaling */ 00098 // @{ 00099 00101 void scal(const f_int& N, const f_dbl_prec& ALPHA, f_dbl_prec* X, const f_int& INCX); 00102 00103 // @} 00104 00105 /* * @name DVector copy */ 00106 // @{ 00107 00109 void copy(const f_int& N, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY); 00110 00111 // @} 00112 00113 /* * @name y = a*x + y */ 00114 // @{ 00115 00117 void axpy(const f_int& N, const f_dbl_prec& A, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y 00118 , const f_int& INCY); 00119 00120 // @} 00121 00122 /* * @name Dot product */ 00123 // @{ 00124 00126 f_dbl_prec dot(const f_int& N, const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec* Y, const f_int& INCY); 00127 00128 // @} 00129 00130 /* * @name 2-Norm */ 00131 // @{ 00132 00134 f_dbl_prec nrm2(const f_int& N, const f_dbl_prec* X, const f_int& INCX); 00135 00136 // @} 00137 00138 /* * @name 1-Norm */ 00139 // @{ 00140 00142 f_dbl_prec asum(const f_int& N, const f_dbl_prec* X, const f_int& INCX); 00143 00144 // @} 00145 00146 /* * @name Inifinity-Norm */ 00147 // @{ 00148 00150 f_dbl_prec iamax(const f_int& N, const f_dbl_prec* X, const f_int& INCX); 00151 // @} 00152 00153 // end Level-1 BLAS 00154 // @} 00155 00156 // ///////////////////////////////////////////////// 00157 /* * @name Level-2 BLAS (matrix-vector operations) */ 00158 // @{ 00159 00160 /* * @name General rectangular matrix-vector products */ 00161 // @{ 00162 00164 void gemv(Transp transa, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa 00165 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy); 00166 00167 // @} 00168 00169 /* * @name General band matrix-vector products */ 00170 // @{ 00171 00173 void gbmv(Transp transa, f_int m, f_int n, f_int kl, f_int ku, f_dbl_prec alpha, const f_dbl_prec* pa 00174 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy); 00175 00176 // @} 00177 00178 /* * @name Hermitian matrix-vector products */ 00179 // @{ 00180 00181 00182 // @} 00183 00184 /* * @name Hermitian band matrix-vector products */ 00185 // @{ 00186 00187 // @} 00188 00189 /* * @name Hermitian packed matrix-vector products */ 00190 // @{ 00191 00192 00193 // @} 00194 00195 /* * @name Symmetric matrix-vector products */ 00196 // @{ 00197 00199 void symv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa 00200 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy); 00201 00202 // @} 00203 00204 /* * @name Symmetric band matrix-vector products */ 00205 // @{ 00206 00208 void sbmv(Uplo uplo, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00209 , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy); 00210 00211 // @} 00212 00213 /* * @name Symmetric packed matrix-vector products */ 00214 // @{ 00215 00217 void spmv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pap 00218 , const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy); 00219 00220 // @} 00221 00222 /* * @name Triangular matrix-vector products */ 00223 // @{ 00224 00226 void trmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa 00227 , f_int lda, f_dbl_prec* px, f_int incx); 00228 00229 // @} 00230 00231 /* * @name Triangular band matrix-vector products */ 00232 // @{ 00233 00235 void tbmv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa 00236 , f_int lda, f_dbl_prec* px, f_int incx); 00237 00238 // @} 00239 00240 /* * @name Triangular packed matrix-vector products */ 00241 // @{ 00242 00244 void tpmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap 00245 , f_dbl_prec* px, f_int incx); 00246 00247 // @} 00248 00249 /* * @name Triangular equation solve */ 00250 // @{ 00251 00253 void trsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa 00254 , f_int lda, f_dbl_prec* px, f_int incx); 00255 00256 // @} 00257 00258 /* * @name Triangular band equation solve */ 00259 // @{ 00260 00262 void tbsv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa 00263 , f_int lda, f_dbl_prec* px, f_int incx); 00264 00265 // @} 00266 00267 /* * @name Triangular packed equation solve */ 00268 // @{ 00269 00271 void tpsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap 00272 , f_dbl_prec* px, f_int incx); 00273 00274 // @} 00275 00276 /* * @name General rank-1 update */ 00277 // @{ 00278 00280 void ger(f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00281 , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda); 00282 00283 // @} 00284 00285 /* * @name Hermitian rank-1 update */ 00286 // @{ 00287 00288 // @} 00289 00290 /* * @name Hermitian packed rank-1 update */ 00291 // @{ 00292 00293 // @} 00294 00295 /* * @name Hermitian rank-2 update */ 00296 // @{ 00297 00298 // @} 00299 00300 /* * @name Hermitian packed rank-2 update */ 00301 // @{ 00302 00303 // @} 00304 00305 /* * @name Symmetric rank-1 update */ 00306 // @{ 00307 00309 void syr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00310 , f_int incx, f_dbl_prec* pa, f_int lda); 00311 00312 // @} 00313 00314 /* * @name Symmetric packed rank-1 update */ 00315 // @{ 00316 00318 void spr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00319 , f_int incx, f_dbl_prec* pap); 00320 00321 // @} 00322 00323 /* * @name Symmetric rank-2 update */ 00324 // @{ 00325 00327 void syr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00328 , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda); 00329 00330 // @} 00331 00332 /* * @name Symmetric packed rank-2 update */ 00333 // @{ 00334 00336 void spr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px 00337 , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pap); 00338 00339 // @} 00340 00341 // end Level 2 BLAS 00342 // @} 00343 00344 // ///////////////////////////////////////// 00345 /* * @name Level 3 BLAS (matrix-matrix operations) */ 00346 // @{ 00347 00348 /* * @name General rectangular matrix-matrix product */ 00349 // @{ 00350 00352 void gemm(Transp transa, Transp transb, f_int m, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00353 , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc); 00354 00355 // @} 00356 00357 /* * @name Symmetric matrix-matrix product */ 00358 // @{ 00359 00361 void symm(Side side, Uplo uplo, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa 00362 , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc); 00363 00364 // @} 00365 00366 /* * @name Hermitian matrix-matrix product */ 00367 // @{ 00368 00369 // @} 00370 00371 /* * @name Symmetric rank-k update */ 00372 // @{ 00373 00375 void syrk(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00376 , f_int lda, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc); 00377 00378 // @} 00379 00380 /* * @name Hermitian rank-k update */ 00381 // @{ 00382 00383 // @} 00384 00385 /* * @name Symmetric rank-2k update */ 00386 // @{ 00387 00389 void syr2k(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa 00390 , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc); 00391 00392 // @} 00393 00394 /* * @name Hermitian rank-2k update */ 00395 // @{ 00396 00397 // @} 00398 00399 /* * @name Triangular matrix-matrix product */ 00400 // @{ 00401 00403 void trmm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha 00404 , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb); 00405 00406 // @} 00407 00408 /* * @name Solution of triangular system */ 00409 // @{ 00410 00412 void trsm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha 00413 , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb); 00414 00415 // @} 00416 00417 // end Level 3 BLAS 00418 // @} 00419 00420 // end overloaded functions 00421 // @} 00422 00423 } // end namespace BLAS_Cpp 00424 00425 #endif // BLAS_CPP_OVERLOADS_DECLARATIONS_H
1.7.4