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.cpp
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 #include "DenseLinAlgPack_BLAS_Cpp.hpp"
43 
44 // /////////////////////////////////////
45 // Fortran function declarations.
46 
47 namespace BLAS_C_Decl {
48 
49 typedef FortranTypes::f_int f_int;
50 typedef FortranTypes::f_real f_real;
51 typedef FortranTypes::f_dbl_prec f_dbl_prec;
52 
53 // function declarations
54 // (don't use these directly, use the later overloaded wrappers in namespace BLAS)
55 extern "C" {
56 
57 // ////////////////////////////////////////
58 // Level 1 BLAS (vector-vector operations)
59 
60 // Generate plane rotation
61 FORTRAN_FUNC_DECL_UL(void,DROTG,drotg)(f_dbl_prec* A, f_dbl_prec* B, f_dbl_prec* C, f_dbl_prec* S);
62 
63 // Apply plane rotation
64 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,
65  const f_dbl_prec& C, const f_dbl_prec& S);
66 
67 // Interchange vectors
68 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);
69 
70 // DVector scaling
71 FORTRAN_FUNC_DECL_UL(void,DSCAL,dscal)(const f_int& N, const f_dbl_prec& ALPHA, f_dbl_prec* X, const f_int& INCX);
72 
73 // DVector copy
74 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);
75 
76 // y = a*x + y
77 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,
78  const f_int& INCY);
79 
80 // Dot product
81 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);
82 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);
83 
84 // 2-Norm
85 FORTRAN_FUNC_DECL_UL(f_dbl_prec,DNRM2,dnrm2)(const f_int& N, const f_dbl_prec* X, const f_int& INCX);
86 
87 // Sum of magnitudes
88 FORTRAN_FUNC_DECL_UL(f_dbl_prec,DASUM,dasum)(const f_int& N, const f_dbl_prec* X, const f_int& INCX);
89 
90 // Largest component of vector
91 FORTRAN_FUNC_DECL_UL(f_dbl_prec,IDAMAX,idamax)(const f_int& N, const f_dbl_prec* X, const f_int& INCX);
92 
93 // ////////////////////////////////////////
94 // Level 2 BLAS (matrix-vector operations)
95 
96 // General rectangular matrix-vector products
97 FORTRAN_FUNC_DECL_UL(void,DGEMV,dgemv)(FORTRAN_CONST_CHAR_1_ARG(TRANSA)
98  , const f_int& M, const f_int& N, const f_dbl_prec& ALPHA
99  , const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* X, const f_int& INCX
100  , const f_dbl_prec& BETA, f_dbl_prec* Y, const f_int& INCY
101  );
102 
103 // General band matrix-vector products
104 FORTRAN_FUNC_DECL_UL(void,DGBMV,dgbmv)(FORTRAN_CONST_CHAR_1_ARG(TRANSA)
105  , const f_int& M, const f_int& N, const f_int& KL, const f_int& KU
106  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* X
107  , const f_int& INCX, const f_dbl_prec& BETA, f_dbl_prec* Y, const f_int& INCY
108  );
109 
110 // Hermitian matrix-vector products
111 
112 // Hermitian band matrix-vector products
113 
114 // Hermitian packed matrix-vector products
115 
116 // Symmetric matrix-vector products
117 FORTRAN_FUNC_DECL_UL(void,DSYMV,dsymv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
118  , const f_int& N
119  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA
120  , const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec& BETA
121  , f_dbl_prec* Y, const f_int& INCY
122  );
123 
124 // Symmetric band matrix-vector products
125 FORTRAN_FUNC_DECL_UL(void,DSBMV,dsbmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
126  , const f_int& N, const f_int& K
127  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA
128  , const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec& BETA
129  , f_dbl_prec* Y, const f_int& INCY
130  );
131 
132 // Symmetric packed matrix-vector products
133 FORTRAN_FUNC_DECL_UL(void,DSPMV,dspmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
134  , const f_int& N
135  , const f_dbl_prec& ALPHA, const f_dbl_prec* AP
136  , const f_dbl_prec* X, const f_int& INCX, const f_dbl_prec& BETA
137  , f_dbl_prec* Y, const f_int& INCY
138  );
139 
140 // Triangular matrix-vector products
141 FORTRAN_FUNC_DECL_UL(void,DTRMV,dtrmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
142  , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N
143  , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX);
144 
145 // Triangular band matrix-vector products
146 FORTRAN_FUNC_DECL_UL(void,DTBMV,dtbmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
147  , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG)
148  , const f_int& N, const f_int& K
149  , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX);
150 
151 // Triangular packed matrix-vector products
152 FORTRAN_FUNC_DECL_UL(void,DTPMV,dtpmv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
153  , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N
154  , const f_dbl_prec* AP, f_dbl_prec* X, const f_int& INCX);
155 
156 // Triangular equation solve
157 FORTRAN_FUNC_DECL_UL(void,DTRSV,dtrsv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
158  , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N
159  , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX);
160 
161 // Triangular band equation solve
162 FORTRAN_FUNC_DECL_UL(void,DTBSV,dtbsv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
163  , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N
164  , const f_int& K
165  , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* X, const f_int& INCX);
166 
167 // Triangular packed equation solve
168 FORTRAN_FUNC_DECL_UL(void,DTPSV,dtpsv)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
169  , FORTRAN_CONST_CHAR_1_ARG(TRANS), FORTRAN_CONST_CHAR_1_ARG(DIAG), const f_int& N
170  , const f_dbl_prec* AP, f_dbl_prec* X, const f_int& INCX);
171 
172 // General rank-1 update
173 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,
174  const f_dbl_prec* Y, const f_int& INCY, f_dbl_prec* A, const f_int& LDA);
175 
176 // Hermitian rank-1 update
177 
178 // Hermitian packed rank-1 update
179 
180 // Hermitian rank-2 update
181 
182 // Hermitian packed rank-2 update
183 
184 // Symmetric rank-1 update
185 FORTRAN_FUNC_DECL_UL(void,DSYR,dsyr)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
186  , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX
187  , f_dbl_prec* A, const f_int& LDA);
188 
189 // Symmetric packed rank-1 update
190 FORTRAN_FUNC_DECL_UL(void,DSPR,dspr)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
191  , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX
192  , f_dbl_prec* AP);
193 
194 // Symmetric rank-2 update
195 FORTRAN_FUNC_DECL_UL(void,DSYR2,dsyr2)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
196  , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX
197  , const f_dbl_prec* Y, const f_int& INCY, f_dbl_prec* A, const f_int& LDA);
198 
199 // Symmetric packed rank-2 update
200 FORTRAN_FUNC_DECL_UL(void,DSPR2,dspr2)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
201  , const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* X, const f_int& INCX
202  , const f_dbl_prec* Y, const f_int& INCY, f_dbl_prec* AP);
203 
204 // ////////////////////////////////////////
205 // Level 3 BLAS (matrix-matrix operations)
206 
207 // General rectangular matrix-matrix product
208 FORTRAN_FUNC_DECL_UL(void,DGEMM,dgemm)(FORTRAN_CONST_CHAR_1_ARG(TRANSA)
209  , FORTRAN_CONST_CHAR_1_ARG(TRANSB), const f_int& M, const f_int& N, const f_int& K
210  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* B
211  , const f_int& LDB, const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC);
212 
213 // Symmetric matrix-matrix product
214 FORTRAN_FUNC_DECL_UL(void,DSYMM,dsymm)(FORTRAN_CONST_CHAR_1_ARG(SIDE)
215  , FORTRAN_CONST_CHAR_1_ARG(UPLO), const f_int& M, const f_int& N
216  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* B
217  , const f_int& LDB, const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC);
218 
219 // Hermitian matrix-matrix product
220 
221 // Symmetric rank-k update
222 FORTRAN_FUNC_DECL_UL(void,DSYRK,dsyrk)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
223  , FORTRAN_CONST_CHAR_1_ARG(TRANS), const f_int& N, const f_int& K
224  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA
225  , const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC);
226 
227 // Hermitian rank-k update
228 
229 // Symmetric rank-2k update
230 FORTRAN_FUNC_DECL_UL(void,DSYR2K,dsyr2k)(FORTRAN_CONST_CHAR_1_ARG(UPLO)
231  , FORTRAN_CONST_CHAR_1_ARG(TRANS), const f_int& N, const f_int& K
232  , const f_dbl_prec& ALPHA, const f_dbl_prec* A, const f_int& LDA, const f_dbl_prec* B
233  , const f_int& LDB, const f_dbl_prec& BETA, f_dbl_prec* C, const f_int& LDC);
234 
235 // Hermitian rank-2k update
236 
237 // Triangular matrix-matrix product
238 FORTRAN_FUNC_DECL_UL(void,DTRMM,dtrmm)(FORTRAN_CONST_CHAR_1_ARG(SIDE)
239  , FORTRAN_CONST_CHAR_1_ARG(UPLO), FORTRAN_CONST_CHAR_1_ARG(TRANSA)
240  , FORTRAN_CONST_CHAR_1_ARG(DIAG)
241  , const f_int& M, const f_int& N, const f_dbl_prec& ALPHA, const f_dbl_prec* A
242  , const f_int& LDA, f_dbl_prec* B, const f_int& LDB);
243 
244 // Solution of triangular system
245 FORTRAN_FUNC_DECL_UL(void,DTRSM,dtrsm)(FORTRAN_CONST_CHAR_1_ARG(SIDE)
246  , FORTRAN_CONST_CHAR_1_ARG(UPLO), FORTRAN_CONST_CHAR_1_ARG(TRANSA)
247  , FORTRAN_CONST_CHAR_1_ARG(DIAG)
248  , const f_int& M, const f_int& N, const f_dbl_prec& ALPHA
249  , const f_dbl_prec* A, const f_int& LDA, f_dbl_prec* B, const f_int& LDB);
250 
251 } // end extern "C"
252 
253 } // end namespace BLAS_C_Decl
254 
255 // ////////////////////////////////////////////////////////
256 // C++ BLAS Function Declarations
257 
258 // Level 1 BLAS (vector-vector operations)
259 
260 void BLAS_Cpp::rotg(f_dbl_prec* a, f_dbl_prec* b, f_dbl_prec* c, f_dbl_prec* s) {
261  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DROTG,drotg)(a,b,c,s);
262 }
263 
264 // Apply plane rotation
265 
266 void BLAS_Cpp::rot(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY
267  , const f_dbl_prec& C, const f_dbl_prec& S)
268 {
269  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DROT,drot)(N, X, INCX, Y, INCY, C, S);
270 }
271 
272 // Interchange vectors
273 
274 void BLAS_Cpp::swap(const f_int& N, f_dbl_prec* X, const f_int& INCX, f_dbl_prec* Y, const f_int& INCY)
275 {
276  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSWAP,dswap)(N, X, INCX, Y, INCY);
277 }
278 
279 // DVector scaling
280 
281 void BLAS_Cpp::scal(const f_int& N, const f_dbl_prec& ALPHA, f_dbl_prec* X, const f_int& INCX)
282 {
283  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSCAL,dscal)(N, ALPHA, X, INCX);
284 }
285 
286 // DVector copy
287 
288 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)
289 {
290  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DCOPY,dcopy)(N, X, INCX, Y, INCY);
291 }
292 
293 // y = a*x + y
294 
295 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
296  , const f_int& INCY)
297 {
298  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DAXPY,daxpy)(N, A, X, INCX, Y, INCY);
299 }
300 
301 // Dot product
302 
303 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)
304 {
305  return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DDOT,ddot)(N, X, INCX, Y, INCY);
306 }
307 
308 // 2-Norm
309 
310 BLAS_Cpp::f_dbl_prec BLAS_Cpp::nrm2(const f_int& N, const f_dbl_prec* X, const f_int& INCX)
311 {
312  return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DNRM2,dnrm2)(N, X, INCX);
313 }
314 
315 // 1-Norm
316 
317 BLAS_Cpp::f_dbl_prec BLAS_Cpp::asum(const f_int& N, const f_dbl_prec* X, const f_int& INCX)
318 {
319  return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DASUM,dasum)(N, X, INCX);
320 }
321 
322 // Inifinity-Norm
323 
324 BLAS_Cpp::f_dbl_prec BLAS_Cpp::iamax(const f_int& N, const f_dbl_prec* X, const f_int& INCX)
325 {
326  return BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(IDAMAX,idamax)(N, X, INCX);
327 }
328 
329 // Level-2 BLAS (matrix-vector operations)
330 
331 // General rectangular matrix-vector products
332 
333 void BLAS_Cpp::gemv(Transp transa, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa
334  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy)
335 {
336  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);
337 }
338 
339 // General band matrix-vector products
340 
341 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
342  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy)
343 {
344  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);
345 }
346 
347 // Hermitian matrix-vector products
348 
349 // Hermitian band matrix-vector products
350 
351 // Hermitian packed matrix-vector products
352 
353 // Symmetric matrix-vector products
354 
355 void BLAS_Cpp::symv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa
356  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy)
357 {
358  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);
359 }
360 
361 // Symmetric band matrix-vector products
362 
363 void BLAS_Cpp::sbmv(Uplo uplo, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
364  , f_int lda, const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy)
365 {
366  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);
367 }
368 
369 // Symmetric packed matrix-vector products
370 
371 void BLAS_Cpp::spmv(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* pap
372  , const f_dbl_prec* x, f_int incx, f_dbl_prec beta, f_dbl_prec* py, f_int incy)
373 {
374  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSPMV,dspmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, pap, x, incx, beta, py, incy);
375 }
376 
377 // Triangular matrix-vector products
378 
379 void BLAS_Cpp::trmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa
380  , f_int lda, f_dbl_prec* px, f_int incx)
381 {
382  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRMV,dtrmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
383  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]),FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag])
384  ,n, pa, lda, px, incx);
385 }
386 
387 // Triangular band matrix-vector products
388 
389 void BLAS_Cpp::tbmv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa
390  , f_int lda, f_dbl_prec* px, f_int incx)
391 {
392  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTBMV,dtbmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
393  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag])
394  ,n, k, pa, lda, px, incx);
395 }
396 
397 // Triangular packed matrix-vector products
398 
399 void BLAS_Cpp::tpmv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap
400  , f_dbl_prec* px, f_int incx)
401 {
402  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTPMV,dtpmv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
403  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag])
404  ,n, pap, px, incx);
405 }
406 
407 // Triangular equation solve
408 
409 void BLAS_Cpp::trsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pa
410  , f_int lda, f_dbl_prec* px, f_int incx)
411 {
412  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRSV,dtrsv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
413  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag])
414  ,n, pa, lda, px, incx);
415 }
416 
417 // Triangular band equation solve
418 
419 void BLAS_Cpp::tbsv(Uplo uplo, Transp trans, Diag diag, f_int n, f_int k, const f_dbl_prec* pa
420  , f_int lda, f_dbl_prec* px, f_int incx)
421 {
422  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTBSV,dtbsv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
423  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag])
424  ,n, k, pa, lda, px, incx);
425 }
426 
427 // Triangular packed equation solve
428 
429 void BLAS_Cpp::tpsv(Uplo uplo, Transp trans, Diag diag, f_int n, const f_dbl_prec* pap
430  , f_dbl_prec* px, f_int incx)
431 {
432  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTPSV,dtpsv)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
433  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag])
434  ,n, pap, px, incx);
435 }
436 
437 // General rank-1 update
438 
439 void BLAS_Cpp::ger(f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
440  , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda)
441 {
442  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DGER,dger)(m, n, alpha, px, incx, py, incy, pa, lda);
443 }
444 
445 // Hermitian rank-1 update
446 
447 // Hermitian packed rank-1 update
448 
449 // Hermitian rank-2 update
450 
451 // Hermitian packed rank-2 update
452 
453 // Symmetric rank-1 update
454 
455 void BLAS_Cpp::syr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
456  , f_int incx, f_dbl_prec* pa, f_int lda)
457 {
458  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYR,dsyr)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, pa, lda);
459 }
460 
461 // Symmetric packed rank-1 update
462 
463 void BLAS_Cpp::spr(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
464  , f_int incx, f_dbl_prec* pap)
465 {
466  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSPR,dspr)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, pap);
467 }
468 
469 // Symmetric rank-2 update
470 
471 void BLAS_Cpp::syr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
472  , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pa, f_int lda)
473 {
474  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYR2,dsyr2)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, py, incy, pa, lda);
475 }
476 
477 // Symmetric packed rank-2 update
478 
479 void BLAS_Cpp::spr2(Uplo uplo, f_int n, f_dbl_prec alpha, const f_dbl_prec* px
480  , f_int incx, const f_dbl_prec* py, f_int incy, f_dbl_prec* pap)
481 {
482  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSPR2,dspr2)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), n, alpha, px, incx, py, incy, pap);
483 }
484 
485 // Level 3 BLAS (matrix-matrix operations)
486 
487 // General rectangular matrix-matrix product
488 
489 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
490  , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc)
491 {
492  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DGEMM,dgemm)(FORTRAN_CHAR_1_ARG_CALL(TransChar[transa])
493  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[transb]), m, n, k, alpha, pa, lda, pb, ldb
494  , beta, pc, ldc);
495 }
496 
497 // Symmetric matrix-matrix product
498 
499 void BLAS_Cpp::symm(Side side, Uplo uplo, f_int m, f_int n, f_dbl_prec alpha, const f_dbl_prec* pa
500  , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc)
501 {
502  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);
503 }
504 
505 // Hermitian matrix-matrix product
506 
507 // Symmetric rank-k update
508 
509 void BLAS_Cpp::syrk(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
510  , f_int lda, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc)
511 {
512  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYRK,dsyrk)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
513  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), n, k, alpha, pa, lda, beta, pc, ldc);
514 }
515 
516 // Hermitian rank-k update
517 
518 // Symmetric rank-2k update
519 
520 void BLAS_Cpp::syr2k(Uplo uplo, Transp trans, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec* pa
521  , f_int lda, const f_dbl_prec* pb, f_int ldb, f_dbl_prec beta, f_dbl_prec* pc, f_int ldc)
522 {
523  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DSYR2K,dsyr2k)(FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo])
524  ,FORTRAN_CHAR_1_ARG_CALL(TransChar[trans]), n, k, alpha, pa, lda, pb, ldb
525  ,beta, pc, ldc);
526 }
527 
528 // Hermitian rank-2k update
529 
530 // Triangular matrix-matrix product
531 
532 void BLAS_Cpp::trmm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha
533  , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb)
534 {
535  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRMM,dtrmm)(FORTRAN_CHAR_1_ARG_CALL(SideChar[side])
536  ,FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), FORTRAN_CHAR_1_ARG_CALL(TransChar[transa])
537  ,FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]), m, n, alpha, pa, lda, pb, ldb);
538 }
539 
540 // Solution of triangular system
541 
542 void BLAS_Cpp::trsm(Side side, Uplo uplo, Transp transa, Diag diag, f_int m, f_int n, f_dbl_prec alpha
543  , const f_dbl_prec* pa, f_int lda, f_dbl_prec* pb, f_int ldb)
544 {
545  BLAS_C_Decl::FORTRAN_FUNC_CALL_UL(DTRSM,dtrsm)(FORTRAN_CHAR_1_ARG_CALL(SideChar[side])
546  ,FORTRAN_CHAR_1_ARG_CALL(UploChar[uplo]), FORTRAN_CHAR_1_ARG_CALL(TransChar[transa])
547  ,FORTRAN_CHAR_1_ARG_CALL(DiagChar[diag]), m, n, alpha, pa, lda, pb, ldb);
548 }
Uplo
Side
Diag
Transp