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