DenseLinAlgPack: Concreate C++ Classes for Dense Blas-Compatible Linear Algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DenseLinAlgPack_BLAS_Cpp.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 //
42 // C++ overloads for BLAS kernals (element type removed from name and enum for operations)
43 
44 #ifndef BLAS_CPP_OVERLOADS_DECLARATIONS_H
45 #define BLAS_CPP_OVERLOADS_DECLARATIONS_H
46 
47 #include "Teuchos_F77_wrappers.h"
48 #include "BLAS_Cpp_Types.hpp"
49 
50 // Overloaded BLAS wrappers.
51 // The naming convention is the Fortran BLAS name minus the type prefix.
52 namespace BLAS_Cpp {
53 
54 typedef FortranTypes::f_int f_int;
55 typedef FortranTypes::f_real f_real;
56 typedef FortranTypes::f_dbl_prec f_dbl_prec;
57 
58 /* * @name Option Arguments
59  * These are emumerations that are used with the overloaded C++ BLAS declarations to replace the
60  * error prone use of characters for specifying options
61  * @memo enumerations (enum)
62  */
63 // @{
64 
66 const char SideChar[] = {'L' , 'R' };
68 const char TransChar[] = {'N' , 'T' , 'C' };
70 const char UploChar[] = {'U' , 'L' };
72 const char DiagChar[] = {'U' , 'N' };
73 
74 // @}
75 
76 /* * @name C++ BLAS Function Declarations
77  * These are overloaded C++ functions that have removed the element type from the name
78  * of the BLAS functions and use enumerations for the options arguments.
79  */
80 // @{
81 
82 // ///////////////////////////////////////////////////////////////////////////////////////////
83 /* * @name Level 1 BLAS (vector-vector operations) */
84 // @{
85 
86 /* * @name Generate plane rotation */
87 // @{
88 
90 void rotg( f_dbl_prec* a, f_dbl_prec* b, f_dbl_prec* c, f_dbl_prec* s );
91 
92 // @}
93 
94 /* * @name Apply plane rotation */
95 // @{
96 
98 void rot(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY
99  , const f_dbl_prec& C, const f_dbl_prec& S);
100 // @}
101 
102 /* * @name Interchange vectors */
103 // @{
104 
106 void swap(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY);
107 
108 // @}
109 
110 /* * @name DVector scaling */
111 // @{
112 
114 void scal(const f_int& N, const f_dbl_prec& ALPHA, f_dbl_prec* X, const f_int& INCX);
115 
116 // @}
117 
118 /* * @name DVector copy */
119 // @{
120 
122 void copy(const f_int& N, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY);
123 
124 // @}
125 
126 /* * @name y = a*x + y */
127 // @{
128 
130 void axpy(const f_int& N, const f_dbl_prec& A, const f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y
131  , const f_int& INCY);
132 
133 // @}
134 
135 /* * @name Dot product */
136 // @{
137 
139 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);
140 
141 // @}
142 
143 /* * @name 2-Norm */
144 // @{
145 
147 f_dbl_prec nrm2(const f_int& N, const f_dbl_prec* X, const f_int& INCX);
148 
149 // @}
150 
151 /* * @name 1-Norm */
152 // @{
153 
155 f_dbl_prec asum(const f_int& N, const f_dbl_prec* X, const f_int& INCX);
156 
157 // @}
158 
159 /* * @name Inifinity-Norm */
160 // @{
161 
163 f_dbl_prec iamax(const f_int& N, const f_dbl_prec* X, const f_int& INCX);
164 // @}
165 
166 // end Level-1 BLAS
167 // @}
168 
169 // /////////////////////////////////////////////////
170 /* * @name Level-2 BLAS (matrix-vector operations) */
171 // @{
172 
173 /* * @name General rectangular matrix-vector products */
174 // @{
175 
177 void gemv(Transp transa, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa
178  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy);
179 
180 // @}
181 
182 /* * @name General band matrix-vector products */
183 // @{
184 
186 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
187  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy);
188 
189 // @}
190 
191 /* * @name Hermitian matrix-vector products */
192 // @{
193 
194 
195 // @}
196 
197 /* * @name Hermitian band matrix-vector products */
198 // @{
199 
200 // @}
201 
202 /* * @name Hermitian packed matrix-vector products */
203 // @{
204 
205 
206 // @}
207 
208 /* * @name Symmetric matrix-vector products */
209 // @{
210 
212 void symv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa
213  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy);
214 
215 // @}
216 
217 /* * @name Symmetric band matrix-vector products */
218 // @{
219 
221 void sbmv(Uplo uplo, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
222  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy);
223 
224 // @}
225 
226 /* * @name Symmetric packed matrix-vector products */
227 // @{
228 
230 void spmv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pap
231  , const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy);
232 
233 // @}
234 
235 /* * @name Triangular matrix-vector products */
236 // @{
237 
239 void trmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa
240  , f_int lda, f_dbl_prec* px, f_int incx);
241 
242 // @}
243 
244 /* * @name Triangular band matrix-vector products */
245 // @{
246 
248 void tbmv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa
249  , f_int lda, f_dbl_prec* px, f_int incx);
250 
251 // @}
252 
253 /* * @name Triangular packed matrix-vector products */
254 // @{
255 
257 void tpmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap
258  , f_dbl_prec* px, f_int incx);
259 
260 // @}
261 
262 /* * @name Triangular equation solve */
263 // @{
264 
266 void trsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa
267  , f_int lda, f_dbl_prec* px, f_int incx);
268 
269 // @}
270 
271 /* * @name Triangular band equation solve */
272 // @{
273 
275 void tbsv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa
276  , f_int lda, f_dbl_prec* px, f_int incx);
277 
278 // @}
279 
280 /* * @name Triangular packed equation solve */
281 // @{
282 
284 void tpsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap
285  , f_dbl_prec* px, f_int incx);
286 
287 // @}
288 
289 /* * @name General rank-1 update */
290 // @{
291 
293 void ger(f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
294  , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda);
295 
296 // @}
297 
298 /* * @name Hermitian rank-1 update */
299 // @{
300 
301 // @}
302 
303 /* * @name Hermitian packed rank-1 update */
304 // @{
305 
306 // @}
307 
308 /* * @name Hermitian rank-2 update */
309 // @{
310 
311 // @}
312 
313 /* * @name Hermitian packed rank-2 update */
314 // @{
315 
316 // @}
317 
318 /* * @name Symmetric rank-1 update */
319 // @{
320 
322 void syr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
323  , f_int incx, f_dbl_prec* pa, f_int lda);
324 
325 // @}
326 
327 /* * @name Symmetric packed rank-1 update */
328 // @{
329 
331 void spr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
332  , f_int incx, f_dbl_prec* pap);
333 
334 // @}
335 
336 /* * @name Symmetric rank-2 update */
337 // @{
338 
340 void syr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
341  , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda);
342 
343 // @}
344 
345 /* * @name Symmetric packed rank-2 update */
346 // @{
347 
349 void spr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
350  , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pap);
351 
352 // @}
353 
354 // end Level 2 BLAS
355 // @}
356 
357 // /////////////////////////////////////////
358 /* * @name Level 3 BLAS (matrix-matrix operations) */
359 // @{
360 
361 /* * @name General rectangular matrix-matrix product */
362 // @{
363 
365 void gemm(Transp transa, Transp transb, f_int m, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
366  , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc);
367 
368 // @}
369 
370 /* * @name Symmetric matrix-matrix product */
371 // @{
372 
374 void symm(Side side, Uplo uplo, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa
375  , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc);
376 
377 // @}
378 
379 /* * @name Hermitian matrix-matrix product */
380 // @{
381 
382 // @}
383 
384 /* * @name Symmetric rank-k update */
385 // @{
386 
388 void syrk(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
389  , f_int lda, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc);
390 
391 // @}
392 
393 /* * @name Hermitian rank-k update */
394 // @{
395 
396 // @}
397 
398 /* * @name Symmetric rank-2k update */
399 // @{
400 
402 void syr2k(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
403  , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc);
404 
405 // @}
406 
407 /* * @name Hermitian rank-2k update */
408 // @{
409 
410 // @}
411 
412 /* * @name Triangular matrix-matrix product */
413 // @{
414 
416 void trmm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha
417  , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb);
418 
419 // @}
420 
421 /* * @name Solution of triangular system */
422 // @{
423 
425 void trsm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha
426  , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb);
427 
428 // @}
429 
430 // end Level 3 BLAS
431 // @}
432 
433 // end overloaded functions
434 // @}
435 
436 } // end namespace BLAS_Cpp
437 
438 #endif // BLAS_CPP_OVERLOADS_DECLARATIONS_H
Uplo
Side
Diag
Transp