ergo
gblas.h
Go to the documentation of this file.
1 /* Ergo, version 3.3, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2013 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Primary academic reference:
19  * Kohn−Sham Density Functional Theory Electronic Structure Calculations
20  * with Linearly Scaling Computational Time and Memory Usage,
21  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
22  * J. Chem. Theory Comput. 7, 340 (2011),
23  * <http://dx.doi.org/10.1021/ct100611z>
24  *
25  * For further information about Ergo, see <http://www.ergoscf.org>.
26  */
27 
43 #ifndef GBLAS
44 #define GBLAS
45 #include <ctime>
46 #include "Failure.h"
47 
48 /* We need to include config.h to get USE_LINALG_TEMPLATES and USE_SSE_INTRINSICS flags. */
49 #include "config.h"
50 
51 #include "template_lapack_common.h"
52 
53 #ifdef USE_SSE_INTRINSICS
54 #include "Memory_buffer_thread.h"
55 #include "gemm_sse/gemm_sse.h"
56 #endif
57 
58 /* LEVEL 3 */
59 extern "C" void dgemm_(const char *ta,const char *tb,
60  const int *n, const int *k, const int *l,
61  const double *alpha,const double *A,const int *lda,
62  const double *B, const int *ldb,
63  const double *beta, double *C, const int *ldc);
64 extern "C" void dpptrf_(const char *uplo,const int *n, double* ap, int *info);
65 extern "C" void dspgst_(const int *itype, const char *uplo,const int *n,
66  double* ap,const double *bp,int *info);
67 extern "C" void dtptri_(const char *uplo,const char *diag,const int *n,
68  double* ap,int *info);
69 /* unit triangular means that a value of 1.0 is assumed */
70 /* for the diagonal elements (hence diagonal not stored in packed format) */
71 extern "C" void dtrmm_(const char *side,const char *uplo,const char *transa,
72  const char *diag,const int *m,const int *n,
73  const double *alpha,const double *A,const int *lda,
74  double *B,const int *ldb);
75 extern "C" void dsygv_(const int *itype,const char *jobz,
76  const char *uplo,const int *n,
77  double *A,const int *lda,double *B,const int *ldb,
78  double* w,double* work,const int *lwork,int *info);
79 extern "C" void dggev_(const char *jobbl, const char *jobvr, const int *n,
80  double *A, const int *lda, double *B, const int *ldb,
81  double *alphar, double *alphai, double *beta,
82  double *vl, const int *ldvl,
83  double *vr, const int *ldvr,
84  double *work, const int *lwork, int *info);
85 extern "C" void dpotrf_(const char *uplo, const int *n, double *A,
86  const int *lda, int *info);
87 extern "C" void dtrtri_(const char *uplo,const char *diag,const int *n,
88  double *A, const int *lda, int *info);
89 extern "C" void dsyrk_(const char *uplo, const char *trans, const int *n,
90  const int *k, const double *alpha, const double *A,
91  const int *lda, const double *beta,
92  double *C, const int *ldc);
93 extern "C" void dsymm_(const char *side,const char *uplo,
94  const int *m,const int *n,
95  const double *alpha,const double *A,const int *lda,
96  const double *B,const int *ldb, const double* beta,
97  double *C,const int *ldc);
98 extern "C" void dpocon_(const char *uplo, const int *n, const double *A,
99  const int *lda, const double *anorm, double *rcond,
100  double *work, int *iwork, int *info);
101 extern "C" void dstevx_(const char *jobz, const char *range, const int *n,
102  double *d, double *e, const double *vl,
103  const double *vu, const int *il, const int *iu,
104  const double *abstol, int *m, double *w, double *z,
105  const int *ldz, double *work, int *iwork, int *ifail,
106  int *info);
107 extern "C" void dstevr_(const char *jobz, const char *range, const int *n,
108  double *d, double *e, const double *vl,
109  const double *vu, const int *il, const int *iu,
110  const double *abstol, int *m, double *w, double *z,
111  const int *ldz, int* isuppz, double *work, int* lwork,
112  int *iwork, int* liwork, int *info);
113 extern "C" void dsyev_(const char *jobz, const char *uplo, const int *n,
114  double *a, const int *lda, double *w, double *work,
115  const int *lwork, int *info);
116 
117 /* LEVEL 2 */
118 extern "C" void dgemv_(const char *ta, const int *m, const int *n,
119  const double *alpha, const double *A, const int *lda,
120  const double *x, const int *incx, const double *beta,
121  double *y, const int *incy);
122 extern "C" void dsymv_(const char *uplo, const int *n,
123  const double *alpha, const double *A, const int *lda,
124  const double *x, const int *incx, const double *beta,
125  double *y, const int *incy);
126 extern "C" void dtrmv_(const char *uplo, const char *trans, const char *diag,
127  const int *n, const double *A, const int *lda,
128  double *x, const int *incx);
129 /* LEVEL 1 */
130 extern "C" void dscal_(const int* n,const double* da, double* dx,
131  const int* incx);
132 extern "C" double ddot_(const int* n, const double* dx, const int* incx,
133  const double* dy, const int* incy);
134 extern "C" void daxpy_(const int* n, const double* da, const double* dx,
135  const int* incx, double* dy,const int* incy);
136 
137 /* Single precision */
138 /* LEVEL 3 */
139 extern "C" void sgemm_(const char *ta,const char *tb,
140  const int *n, const int *k, const int *l,
141  const float *alpha,const float *A,const int *lda,
142  const float *B, const int *ldb,
143  const float *beta, float *C, const int *ldc);
144 extern "C" void spptrf_(const char *uplo,const int *n, float* ap, int *info);
145 extern "C" void sspgst_(const int *itype, const char *uplo,const int *n,
146  float* ap,const float *bp,int *info);
147 extern "C" void stptri_(const char *uplo,const char *diag,const int *n,
148  float* ap,int *info);
149 /* unit triangular means that a value of 1.0 is assumed */
150 /* for the diagonal elements (hence diagonal not stored in packed format) */
151 extern "C" void strmm_(const char *side,const char *uplo,const char *transa,
152  const char *diag,const int *m,const int *n,
153  const float *alpha,const float *A,const int *lda,
154  float *B,const int *ldb);
155 extern "C" void ssygv_(const int *itype,const char *jobz,
156  const char *uplo,const int *n,
157  float *A,const int *lda,float *B,const int *ldb,
158  float* w,float* work,const int *lwork,int *info);
159 extern "C" void sggev_(const char *jobbl, const char *jobvr, const int *n,
160  float *A, const int *lda, float *B, const int *ldb,
161  float *alphar, float *alphai, float *beta,
162  float *vl, const int *ldvl,
163  float *vr, const int *ldvr,
164  float *work, const int *lwork, int *info);
165 extern "C" void spotrf_(const char *uplo, const int *n, float *A,
166  const int *lda, int *info);
167 extern "C" void strtri_(const char *uplo,const char *diag,const int *n,
168  float *A, const int *lda, int *info);
169 extern "C" void ssyrk_(const char *uplo, const char *trans, const int *n,
170  const int *k, const float *alpha, const float *A,
171  const int *lda, const float *beta,
172  float *C, const int *ldc);
173 extern "C" void ssymm_(const char *side,const char *uplo,
174  const int *m,const int *n,
175  const float *alpha,const float *A,const int *lda,
176  const float *B,const int *ldb, const float* beta,
177  float *C,const int *ldc);
178 extern "C" void spocon_(const char *uplo, const int *n, const float *A,
179  const int *lda, const float *anorm, float *rcond,
180  float *work, int *iwork, int *info);
181 extern "C" void sstevx_(const char *jobz, const char *range, const int *n,
182  float *d, float *e, const float *vl,
183  const float *vu, const int *il, const int *iu,
184  const float *abstol, int *m, float *w, float *z,
185  const int *ldz, float *work, int *iwork, int *ifail,
186  int *info);
187 extern "C" void sstevr_(const char *jobz, const char *range, const int *n,
188  float *d, float *e, const float *vl,
189  const float *vu, const int *il, const int *iu,
190  const float *abstol, int *m, float *w, float *z,
191  const int *ldz, int* isuppz, float *work, int* lwork,
192  int *iwork, int* liwork, int *info);
193 extern "C" void ssyev_(const char *jobz, const char *uplo, const int *n,
194  float *a, const int *lda, float *w, float *work,
195  const int *lwork, int *info);
196 
197 /* LEVEL 2 */
198 extern "C" void sgemv_(const char *ta, const int *m, const int *n,
199  const float *alpha, const float *A, const int *lda,
200  const float *x, const int *incx, const float *beta,
201  float *y, const int *incy);
202 extern "C" void ssymv_(const char *uplo, const int *n,
203  const float *alpha, const float *A, const int *lda,
204  const float *x, const int *incx, const float *beta,
205  float *y, const int *incy);
206 extern "C" void strmv_(const char *uplo, const char *trans, const char *diag,
207  const int *n, const float *A, const int *lda,
208  float *x, const int *incx);
209 /* LEVEL 1 */
210 extern "C" void sscal_(const int* n,const float* da, float* dx,
211  const int* incx);
212 #if 0
213 // sdot_ is unreliable because of varying return type in different
214 // implementations. We therefore always use template dot for single precision
215 extern "C" double sdot_(const int* n, const float* dx, const int* incx,
216  const float* dy, const int* incy);
217 #endif
218 extern "C" void saxpy_(const int* n, const float* da, const float* dx,
219  const int* incx, float* dy,const int* incy);
220 
221 namespace mat
222 {
223  struct Gblas {
224  static float time;
225  static bool timekeeping;
226  };
227 
228  /*************** Default version throws exception */
229  template<class T>
230  inline static void gemm(const char *ta,const char *tb,
231  const int *n, const int *k, const int *l,
232  const T *alpha,const T *A,const int *lda,
233  const T *B, const int *ldb,
234  const T *beta,T *C, const int *ldc) {
235 #ifdef USE_SSE_INTRINSICS
236  if (*ta == 'N' && *tb == 'N' && *n == 32 && *k == 32 && *l == 32 && *alpha == 1.0 && *beta == 1) {
237  static T * A_packed;
238  static T * B_packed;
239  static T * C_packed;
240  int pack_max_size = 10000;
241  if ( (pack_max_size*sizeof(T))%16 )
242  throw std::runtime_error("In gblas gemm: requested buffer size not multiple of 16 bytes");
243  static T * buffer;
244  Memory_buffer_thread::instance().get_buffer(pack_max_size*3, buffer);
245  A_packed = buffer;
246  B_packed = buffer + pack_max_size;
247  C_packed = buffer + 2*pack_max_size;
248  gemm_sse<T>(A,B,C,32,32,32,
249  A_packed, B_packed, C_packed,
250  pack_max_size, pack_max_size, pack_max_size);
251  }
252  else
253 #endif
254  template_blas_gemm(ta,tb,n,k,l,alpha,A,lda,B,ldb,beta,C,ldc);
255  }
256 
257 
258  /* Computes the Cholesky factorization of a symmetric *
259  * positive definite matrix in packed storage. */
260  template<class T>
261  inline static void pptrf(const char *uplo,const int *n, T* ap, int *info) {
262  template_lapack_pptrf(uplo,n,ap,info);
263  }
264 
265  template<class T>
266  inline static void spgst(const int *itype, const char *uplo,const int *n,
267  T* ap,const T *bp,int *info) {
268  template_lapack_spgst(itype,uplo,n,ap,bp,info);
269  }
270 
271  /* Computes the inverse of a triangular matrix in packed storage. */
272  template<class T>
273  inline static void tptri(const char *uplo,const char *diag,const int *n,
274  T* ap,int *info) {
275  template_lapack_tptri(uplo,diag,n,ap,info);
276  }
277 
278  template<class T>
279  inline static void trmm(const char *side,const char *uplo,
280  const char *transa, const char *diag,
281  const int *m,const int *n,
282  const T *alpha,const T *A,const int *lda,
283  T *B,const int *ldb) {
284  template_blas_trmm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb);
285  }
286 
287  /* Computes all eigenvalues and the eigenvectors of a generalized *
288  * symmetric-definite generalized eigenproblem, *
289  * Ax= lambda Bx, ABx= lambda x, or BAx= lambda x. */
290  template<class T>
291  inline static void sygv(const int *itype,const char *jobz,
292  const char *uplo,const int *n,
293  T *A,const int *lda,T *B,const int *ldb,
294  T* w,T* work,const int *lwork,int *info) {
295  template_lapack_sygv(itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info);
296  }
297 
298  template<class T>
299  inline static void ggev(const char *jobbl, const char *jobvr,
300  const int *n, T *A, const int *lda,
301  T *B, const int *ldb, T *alphar,
302  T *alphai, T *beta, T *vl,
303  const int *ldvl, T *vr, const int *ldvr,
304  T *work, const int *lwork, int *info) {
305  template_lapack_ggev(jobbl, jobvr, n, A, lda, B, ldb, alphar, alphai, beta, vl,
306  ldvl, vr, ldvr, work, lwork, info);
307  }
308 
309  /* Computes the Cholesky factorization of a symmetric *
310  * positive definite matrix in packed storage. */
311  template<class T>
312  inline static void potrf(const char *uplo, const int *n, T *A,
313  const int *lda, int *info) {
314  template_lapack_potrf(uplo, n, A, lda, info);
315  }
316 
317  /* Computes the inverse of a triangular matrix. */
318  template<class T>
319  inline static void trtri(const char *uplo,const char *diag,const int *n,
320  T *A, const int *lda, int *info) {
321  // Create copies of strings because they cannot be const inside trtri.
322  char uploCopy[2];
323  char diagCopy[2];
324  uploCopy[0] = uplo[0];
325  uploCopy[1] = '\0';
326  diagCopy[0] = diag[0];
327  diagCopy[1] = '\0';
328  template_lapack_trtri(uploCopy, diagCopy, n, A, lda, info);
329  }
330 
331  template<class T>
332  inline static void syrk(const char *uplo, const char *trans, const int *n,
333  const int *k, const T *alpha, const T *A,
334  const int *lda, const T *beta,
335  T *C, const int *ldc) {
336  template_blas_syrk(uplo, trans, n, k, alpha, A, lda, beta, C, ldc);
337  }
338 
339  template<class T>
340  inline static void symm(const char *side,const char *uplo,
341  const int *m,const int *n,
342  const T *alpha,const T *A,const int *lda,
343  const T *B,const int *ldb, const T* beta,
344  T *C,const int *ldc) {
345  template_blas_symm(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
346  }
347 
348  template<class T>
349  inline static void pocon(const char *uplo, const int *n, const T *A,
350  const int *lda, const T *anorm, T *rcond,
351  T *work, int *iwork, int *info) {
352  template_lapack_pocon(uplo, n, A, lda, anorm, rcond, work, iwork, info);
353  }
354 
355  template<class T>
356  inline static void stevx(const char *jobz, const char *range,
357  const int *n, T *d, T *e, const T *vl,
358  const T *vu, const int *il, const int *iu,
359  const T *abstol, int *m, T *w, T *z,
360  const int *ldz, T *work, int *iwork, int *ifail,
361  int *info) {
362  template_lapack_stevx(jobz, range, n, d, e, vl, vu, il, iu, abstol, m, w, z, ldz,
363  work, iwork, ifail, info);
364  }
365 
366  template<class T>
367  inline static void stevr(const char *jobz, const char *range, const int *n,
368  T *d, T *e, const T *vl,
369  const T *vu, const int *il, const int *iu,
370  const T *abstol, int *m, T *w, T *z,
371  const int *ldz, int* isuppz, T *work, int* lwork,
372  int *iwork, int* liwork, int *info) {
373  template_lapack_stevr(jobz, range, n, d, e, vl, vu, il, iu, abstol,
374  m, w, z, ldz, isuppz,
375  work, lwork, iwork, liwork, info);
376  }
377 
378 
379  template<class T>
380  inline static void syev(const char *jobz, const char *uplo, const int *n,
381  T *a, const int *lda, T *w, T *work,
382  const int *lwork, int *info) {
383  template_lapack_syev(jobz, uplo, n, a, lda, w, work, lwork, info);
384  }
385 
386 
387  /* LEVEL 2 */
388  template<class T>
389  inline static void gemv(const char *ta, const int *m, const int *n,
390  const T *alpha, const T *A,
391  const int *lda,
392  const T *x, const int *incx,
393  const T *beta, T *y, const int *incy) {
394  template_blas_gemv(ta, m, n, alpha, A, lda, x, incx, beta, y, incy);
395  }
396 
397  template<class T>
398  inline static void symv(const char *uplo, const int *n,
399  const T *alpha, const T *A,
400  const int *lda, const T *x,
401  const int *incx, const T *beta,
402  T *y, const int *incy) {
403  template_blas_symv(uplo, n, alpha, A, lda, x, incx, beta, y, incy);
404  }
405 
406  template<class T>
407  inline static void trmv(const char *uplo, const char *trans,
408  const char *diag, const int *n,
409  const T *A, const int *lda,
410  T *x, const int *incx) {
411  template_blas_trmv(uplo, trans, diag, n, A, lda, x, incx);
412  }
413 
414 
415  /* LEVEL 1 */
416  template<class T>
417  inline static void scal(const int* n,const T* da, T* dx,
418  const int* incx) {
419  template_blas_scal(n, da, dx, incx);
420  }
421 
422  template<class T>
423  inline static T dot(const int* n, const T* dx, const int* incx,
424  const T* dy, const int* incy) {
425  return template_blas_dot(n, dx, incx, dy, incy);
426  }
427 
428  template<class T>
429  inline static void axpy(const int* n, const T* da, const T* dx,
430  const int* incx, T* dy,const int* incy) {
431  template_blas_axpy(n, da, dx, incx, dy, incy);
432  }
433 
434 
435 
436 
437  /* Below follows specializations for double, single, etc.
438  These specializations are not needed if template_blas and template_lapack are used,
439  so in that case we skip this entire section. */
440 #ifndef USE_LINALG_TEMPLATES
441 
442 
443  /*************** Double specialization */
444  template<>
445  inline void gemm<double>(const char *ta,const char *tb,
446  const int *n, const int *k, const int *l,
447  const double *alpha,
448  const double *A,const int *lda,
449  const double *B, const int *ldb,
450  const double *beta,
451  double *C, const int *ldc) {
452  if (Gblas::timekeeping) {
453  clock_t start = clock();
454  dgemm_(ta,tb,n,k,l,alpha,A,lda,B,ldb,beta,C,ldc);
455  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
456  }
457  else {
458  dgemm_(ta,tb,n,k,l,alpha,A,lda,B,ldb,beta,C,ldc);
459  }
460  }
461 
462  template<>
463  inline void pptrf<double>(const char *uplo,const int *n,
464  double* ap, int *info) {
465  if (Gblas::timekeeping) {
466  clock_t start = clock();
467  dpptrf_(uplo,n,ap,info);
468  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
469  }
470  else {
471  dpptrf_(uplo,n,ap,info);
472  }
473  }
474 
475  template<>
476  inline void spgst<double>(const int *itype, const char *uplo,
477  const int *n,
478  double* ap,const double *bp,int *info) {
479  if (Gblas::timekeeping) {
480  clock_t start = clock();
481  dspgst_(itype,uplo,n,ap,bp,info);
482  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
483  }
484  else {
485  dspgst_(itype,uplo,n,ap,bp,info);
486  }
487  }
488 
489  template<>
490  inline void tptri<double>(const char *uplo,const char *diag,const int *n,
491  double* ap,int *info) {
492  if (Gblas::timekeeping) {
493  clock_t start = clock();
494  dtptri_(uplo,diag,n,ap,info);
495  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
496  }
497  else {
498  dtptri_(uplo,diag,n,ap,info);
499  }
500  }
501 
502  template<>
503  inline void trmm<double>(const char *side,const char *uplo,
504  const char *transa,
505  const char *diag,const int *m,const int *n,
506  const double *alpha,
507  const double *A,const int *lda,
508  double *B,const int *ldb) {
509  if (Gblas::timekeeping) {
510  clock_t start = clock();
511  dtrmm_(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb);
512  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
513  }
514  else {
515  dtrmm_(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb);
516  }
517  }
518 
519  template<>
520  inline void sygv<double>(const int *itype,const char *jobz,
521  const char *uplo,const int *n,
522  double *A,const int *lda,
523  double *B,const int *ldb,
524  double* w,double* work,
525  const int *lwork,int *info) {
526  if (Gblas::timekeeping) {
527  clock_t start = clock();
528  dsygv_(itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info);
529  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
530  }
531  else {
532  dsygv_(itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info);
533  }
534  }
535 
536  template<>
537  inline void ggev<double>(const char *jobbl, const char *jobvr,
538  const int *n, double *A, const int *lda,
539  double *B, const int *ldb, double *alphar,
540  double *alphai, double *beta, double *vl,
541  const int *ldvl, double *vr, const int *ldvr,
542  double *work, const int *lwork, int *info) {
543  if (Gblas::timekeeping) {
544  clock_t start = clock();
545  dggev_(jobbl, jobvr, n, A, lda, B, ldb, alphar, alphai, beta, vl,
546  ldvl, vr, ldvr, work, lwork, info);
547  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
548  }
549  else {
550  dggev_(jobbl, jobvr, n, A, lda, B, ldb, alphar, alphai, beta, vl,
551  ldvl, vr, ldvr, work, lwork, info);
552  }
553  }
554 
555 
556  template<>
557  inline void potrf<double>(const char *uplo, const int *n, double *A,
558  const int *lda, int *info) {
559  if (Gblas::timekeeping) {
560  clock_t start = clock();
561  dpotrf_(uplo, n, A, lda, info);
562  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
563  }
564  else {
565  dpotrf_(uplo, n, A, lda, info);
566  }
567  }
568 
569  template<>
570  inline void trtri<double>(const char *uplo,const char *diag,const int *n,
571  double *A, const int *lda, int *info) {
572  if (Gblas::timekeeping) {
573  clock_t start = clock();
574  dtrtri_(uplo, diag, n, A, lda, info);
575  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
576  }
577  else {
578  dtrtri_(uplo, diag, n, A, lda, info);
579  }
580  }
581 
582  template<>
583  inline void syrk<double>(const char *uplo, const char *trans,
584  const int *n, const int *k, const double *alpha,
585  const double *A, const int *lda,
586  const double *beta, double *C, const int *ldc) {
587  if (Gblas::timekeeping) {
588  clock_t start = clock();
589  dsyrk_(uplo, trans, n, k, alpha, A, lda, beta, C, ldc);
590  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
591  }
592  else {
593  dsyrk_(uplo, trans, n, k, alpha, A, lda, beta, C, ldc);
594  }
595  }
596 
597  template<>
598  inline void symm<double>(const char *side,const char *uplo,
599  const int *m,const int *n, const double *alpha,
600  const double *A,const int *lda,
601  const double *B,const int *ldb,
602  const double* beta,
603  double *C,const int *ldc) {
604  if (Gblas::timekeeping) {
605  clock_t start = clock();
606  dsymm_(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
607  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
608  }
609  else {
610  dsymm_(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
611  }
612  }
613 
614  template<>
615  inline void pocon<double>(const char *uplo, const int *n,
616  const double *A, const int *lda,
617  const double *anorm, double *rcond,
618  double *work, int *iwork, int *info) {
619  if (Gblas::timekeeping) {
620  clock_t start = clock();
621  dpocon_(uplo, n, A, lda, anorm, rcond, work, iwork, info);
622  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
623  }
624  else {
625  dpocon_(uplo, n, A, lda, anorm, rcond, work, iwork, info);
626  }
627  }
628 
629  template<>
630  inline void stevx<double>(const char *jobz, const char *range,
631  const int *n, double *d, double *e,
632  const double *vl,
633  const double *vu, const int *il, const int *iu,
634  const double *abstol, int *m, double *w,
635  double *z,
636  const int *ldz, double *work, int *iwork,
637  int *ifail, int *info) {
638  if (Gblas::timekeeping) {
639  clock_t start = clock();
640  dstevx_(jobz, range, n, d, e, vl, vu, il, iu, abstol, m, w, z, ldz,
641  work, iwork, ifail, info);
642  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
643  }
644  else {
645  dstevx_(jobz, range, n, d, e, vl, vu, il, iu, abstol, m, w, z, ldz,
646  work, iwork, ifail, info);
647  }
648  }
649 
650  template<>
651  inline void stevr<double>(const char *jobz, const char *range,
652  const int *n, double *d, double *e,
653  const double *vl, const double *vu,
654  const int *il, const int *iu,
655  const double *abstol,
656  int *m, double *w,
657  double *z, const int *ldz, int* isuppz,
658  double *work, int* lwork,
659  int *iwork, int* liwork, int *info) {
660  if (Gblas::timekeeping) {
661  clock_t start = clock();
662  dstevr_(jobz, range, n, d, e, vl, vu, il, iu, abstol,
663  m, w, z, ldz, isuppz, work, lwork, iwork, liwork, info);
664  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
665  }
666  else {
667  dstevr_(jobz, range, n, d, e, vl, vu, il, iu, abstol,
668  m, w, z, ldz, isuppz, work, lwork, iwork, liwork, info);
669  }
670  }
671 
672 
673 
674  template<>
675  inline void syev<double>(const char *jobz, const char *uplo, const int *n,
676  double *a, const int *lda, double *w,
677  double *work, const int *lwork, int *info) {
678  if (Gblas::timekeeping) {
679  clock_t start = clock();
680  dsyev_(jobz, uplo, n, a, lda, w, work, lwork, info);
681  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
682  }
683  else {
684  dsyev_(jobz, uplo, n, a, lda, w, work, lwork, info);
685  }
686  }
687 
688 
689  /* LEVEL 2 */
690  template<>
691  inline void gemv<double>(const char *ta, const int *m, const int *n,
692  const double *alpha, const double *A,
693  const int *lda,
694  const double *x, const int *incx,
695  const double *beta, double *y, const int *incy) {
696  if (Gblas::timekeeping) {
697  clock_t start = clock();
698  dgemv_(ta, m, n, alpha, A, lda, x, incx, beta, y, incy);
699  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
700  }
701  else {
702  dgemv_(ta, m, n, alpha, A, lda, x, incx, beta, y, incy);
703  }
704  }
705 
706  template<>
707  inline void symv<double>(const char *uplo, const int *n,
708  const double *alpha, const double *A,
709  const int *lda, const double *x,
710  const int *incx, const double *beta,
711  double *y, const int *incy) {
712  if (Gblas::timekeeping) {
713  clock_t start = clock();
714  dsymv_(uplo, n, alpha, A, lda, x, incx, beta, y, incy);
715  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
716  }
717  else {
718  dsymv_(uplo, n, alpha, A, lda, x, incx, beta, y, incy);
719  }
720  }
721 
722  template<>
723  inline void trmv<double>(const char *uplo, const char *trans,
724  const char *diag, const int *n,
725  const double *A, const int *lda,
726  double *x, const int *incx) {
727  if (Gblas::timekeeping) {
728  clock_t start = clock();
729  dtrmv_(uplo, trans, diag, n, A, lda, x, incx);
730  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
731  }
732  else {
733  dtrmv_(uplo, trans, diag, n, A, lda, x, incx);
734  }
735  }
736 
737 
738  /* LEVEL 1 */
739  template<>
740  inline void scal<double>(const int* n,const double* da, double* dx,
741  const int* incx) {
742  if (Gblas::timekeeping) {
743  clock_t start = clock();
744  dscal_(n, da, dx, incx);
745  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
746  }
747  else {
748  dscal_(n, da, dx, incx);
749  }
750  }
751 
752  template<>
753  inline double dot<double>(const int* n, const double* dx, const int* incx,
754  const double* dy, const int* incy) {
755  double tmp = 0;
756  if (Gblas::timekeeping) {
757  clock_t start = clock();
758  tmp = ddot_(n, dx, incx, dy, incy);
759  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
760  }
761  else {
762  tmp = ddot_(n, dx, incx, dy, incy);
763  }
764  return tmp;
765  }
766 
767  template<>
768  inline void axpy<double>(const int* n, const double* da, const double* dx,
769  const int* incx, double* dy,const int* incy) {
770  if (Gblas::timekeeping) {
771  clock_t start = clock();
772  daxpy_(n, da, dx, incx, dy, incy);
773  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
774  }
775  else {
776  daxpy_(n, da, dx, incx, dy, incy);
777  }
778  }
779 
780 
781  /*************** Single specialization */
782  template<>
783  inline void gemm<float>(const char *ta,const char *tb,
784  const int *n, const int *k, const int *l,
785  const float *alpha,
786  const float *A,const int *lda,
787  const float *B, const int *ldb,
788  const float *beta,
789  float *C, const int *ldc) {
790  if (Gblas::timekeeping) {
791  clock_t start = clock();
792  sgemm_(ta,tb,n,k,l,alpha,A,lda,B,ldb,beta,C,ldc);
793  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
794  }
795  else {
796  sgemm_(ta,tb,n,k,l,alpha,A,lda,B,ldb,beta,C,ldc);
797  }
798  }
799 
800  template<>
801  inline void pptrf<float>(const char *uplo,const int *n,
802  float* ap, int *info) {
803  if (Gblas::timekeeping) {
804  clock_t start = clock();
805  spptrf_(uplo,n,ap,info);
806  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
807  }
808  else {
809  spptrf_(uplo,n,ap,info);
810  }
811  }
812 
813  template<>
814  inline void spgst<float>(const int *itype, const char *uplo,
815  const int *n,
816  float* ap,const float *bp,int *info) {
817  if (Gblas::timekeeping) {
818  clock_t start = clock();
819  sspgst_(itype,uplo,n,ap,bp,info);
820  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
821  }
822  else {
823  sspgst_(itype,uplo,n,ap,bp,info);
824  }
825  }
826 
827  template<>
828  inline void tptri<float>(const char *uplo,const char *diag,
829  const int *n,
830  float* ap,int *info) {
831  if (Gblas::timekeeping) {
832  clock_t start = clock();
833  stptri_(uplo,diag,n,ap,info);
834  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
835  }
836  else {
837  stptri_(uplo,diag,n,ap,info);
838  }
839  }
840 
841  template<>
842  inline void trmm<float>(const char *side,const char *uplo,
843  const char *transa,
844  const char *diag,const int *m,const int *n,
845  const float *alpha,
846  const float *A,const int *lda,
847  float *B,const int *ldb) {
848  if (Gblas::timekeeping) {
849  clock_t start = clock();
850  strmm_(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb);
851  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
852  }
853  else {
854  strmm_(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb);
855  }
856  }
857 
858  template<>
859  inline void sygv<float>(const int *itype,const char *jobz,
860  const char *uplo,const int *n,
861  float *A,const int *lda,
862  float *B,const int *ldb,
863  float* w,float* work,
864  const int *lwork,int *info) {
865  if (Gblas::timekeeping) {
866  clock_t start = clock();
867  ssygv_(itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info);
868  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
869  }
870  else {
871  ssygv_(itype,jobz,uplo,n,A,lda,B,ldb,w,work,lwork,info);
872  }
873  }
874 
875  template<>
876  inline void ggev<float>(const char *jobbl, const char *jobvr,
877  const int *n, float *A, const int *lda,
878  float *B, const int *ldb, float *alphar,
879  float *alphai, float *beta, float *vl,
880  const int *ldvl, float *vr, const int *ldvr,
881  float *work, const int *lwork, int *info) {
882  if (Gblas::timekeeping) {
883  clock_t start = clock();
884  sggev_(jobbl, jobvr, n, A, lda, B, ldb, alphar, alphai, beta, vl,
885  ldvl, vr, ldvr, work, lwork, info);
886  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
887  }
888  else {
889  sggev_(jobbl, jobvr, n, A, lda, B, ldb, alphar, alphai, beta, vl,
890  ldvl, vr, ldvr, work, lwork, info);
891  }
892  }
893 
894 
895  template<>
896  inline void potrf<float>(const char *uplo, const int *n, float *A,
897  const int *lda, int *info) {
898  if (Gblas::timekeeping) {
899  clock_t start = clock();
900  spotrf_(uplo, n, A, lda, info);
901  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
902  }
903  else {
904  spotrf_(uplo, n, A, lda, info);
905  }
906  }
907 
908  template<>
909  inline void trtri<float>(const char *uplo,const char *diag,const int *n,
910  float *A, const int *lda, int *info) {
911  if (Gblas::timekeeping) {
912  clock_t start = clock();
913  strtri_(uplo, diag, n, A, lda, info);
914  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
915  }
916  else {
917  strtri_(uplo, diag, n, A, lda, info);
918  }
919  }
920 
921  template<>
922  inline void syrk<float>(const char *uplo, const char *trans,
923  const int *n, const int *k, const float *alpha,
924  const float *A, const int *lda,
925  const float *beta, float *C, const int *ldc) {
926  if (Gblas::timekeeping) {
927  clock_t start = clock();
928  ssyrk_(uplo, trans, n, k, alpha, A, lda, beta, C, ldc);
929  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
930  }
931  else {
932  ssyrk_(uplo, trans, n, k, alpha, A, lda, beta, C, ldc);
933  }
934  }
935 
936  template<>
937  inline void symm<float>(const char *side,const char *uplo,
938  const int *m,const int *n, const float *alpha,
939  const float *A,const int *lda,
940  const float *B,const int *ldb,
941  const float* beta,
942  float *C,const int *ldc) {
943  if (Gblas::timekeeping) {
944  clock_t start = clock();
945  ssymm_(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
946  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
947  }
948  else {
949  ssymm_(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
950  }
951  }
952 
953  template<>
954  inline void pocon<float>(const char *uplo, const int *n,
955  const float *A, const int *lda,
956  const float *anorm, float *rcond,
957  float *work, int *iwork, int *info) {
958  if (Gblas::timekeeping) {
959  clock_t start = clock();
960  spocon_(uplo, n, A, lda, anorm, rcond, work, iwork, info);
961  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
962  }
963  else {
964  spocon_(uplo, n, A, lda, anorm, rcond, work, iwork, info);
965  }
966  }
967 
968  template<>
969  inline void stevx<float>(const char *jobz, const char *range,
970  const int *n, float *d, float *e,
971  const float *vl,
972  const float *vu, const int *il, const int *iu,
973  const float *abstol, int *m, float *w,
974  float *z,
975  const int *ldz, float *work, int *iwork,
976  int *ifail, int *info) {
977  if (Gblas::timekeeping) {
978  clock_t start = clock();
979  sstevx_(jobz, range, n, d, e, vl, vu, il, iu, abstol, m, w, z, ldz,
980  work, iwork, ifail, info);
981  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
982  }
983  else {
984  sstevx_(jobz, range, n, d, e, vl, vu, il, iu, abstol, m, w, z, ldz,
985  work, iwork, ifail, info);
986  }
987  }
988 
989  template<>
990  inline void stevr<float>(const char *jobz, const char *range,
991  const int *n, float *d, float *e,
992  const float *vl, const float *vu,
993  const int *il, const int *iu,
994  const float *abstol,
995  int *m, float *w,
996  float *z, const int *ldz, int* isuppz,
997  float *work, int* lwork,
998  int *iwork, int* liwork, int *info) {
999  if (Gblas::timekeeping) {
1000  clock_t start = clock();
1001  sstevr_(jobz, range, n, d, e, vl, vu, il, iu, abstol,
1002  m, w, z, ldz, isuppz, work, lwork, iwork, liwork, info);
1003  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1004  }
1005  else {
1006  sstevr_(jobz, range, n, d, e, vl, vu, il, iu, abstol,
1007  m, w, z, ldz, isuppz, work, lwork, iwork, liwork, info);
1008  }
1009  }
1010 
1011  template<>
1012  inline void syev<float>(const char *jobz, const char *uplo, const int *n,
1013  float *a, const int *lda, float *w,
1014  float *work, const int *lwork, int *info) {
1015  if (Gblas::timekeeping) {
1016  clock_t start = clock();
1017  ssyev_(jobz, uplo, n, a, lda, w, work, lwork, info);
1018  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1019  }
1020  else {
1021  ssyev_(jobz, uplo, n, a, lda, w, work, lwork, info);
1022  }
1023  }
1024 
1025 
1026  /* LEVEL 2 */
1027  template<>
1028  inline void gemv<float>(const char *ta, const int *m, const int *n,
1029  const float *alpha, const float *A,
1030  const int *lda,
1031  const float *x, const int *incx,
1032  const float *beta, float *y, const int *incy) {
1033  if (Gblas::timekeeping) {
1034  clock_t start = clock();
1035  sgemv_(ta, m, n, alpha, A, lda, x, incx, beta, y, incy);
1036  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1037  }
1038  else {
1039  sgemv_(ta, m, n, alpha, A, lda, x, incx, beta, y, incy);
1040  }
1041  }
1042 
1043  template<>
1044  inline void symv<float>(const char *uplo, const int *n,
1045  const float *alpha, const float *A,
1046  const int *lda, const float *x,
1047  const int *incx, const float *beta,
1048  float *y, const int *incy) {
1049  if (Gblas::timekeeping) {
1050  clock_t start = clock();
1051  ssymv_(uplo, n, alpha, A, lda, x, incx, beta, y, incy);
1052  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1053  }
1054  else {
1055  ssymv_(uplo, n, alpha, A, lda, x, incx, beta, y, incy);
1056  }
1057  }
1058 
1059  template<>
1060  inline void trmv<float>(const char *uplo, const char *trans,
1061  const char *diag, const int *n,
1062  const float *A, const int *lda,
1063  float *x, const int *incx) {
1064  if (Gblas::timekeeping) {
1065  clock_t start = clock();
1066  strmv_(uplo, trans, diag, n, A, lda, x, incx);
1067  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1068  }
1069  else {
1070  strmv_(uplo, trans, diag, n, A, lda, x, incx);
1071  }
1072  }
1073 
1074  /* LEVEL 1 */
1075  template<>
1076  inline void scal<float>(const int* n,const float* da, float* dx,
1077  const int* incx) {
1078  if (Gblas::timekeeping) {
1079  clock_t start = clock();
1080  sscal_(n, da, dx, incx);
1081  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1082  }
1083  else {
1084  sscal_(n, da, dx, incx);
1085  }
1086  }
1087 #if 0
1088  // Sdot has different return type in different BLAS implementations
1089  // Therefore the specialization for single precision is removed
1090  template<>
1091  inline float dot<float>(const int* n, const float* dx, const int* incx,
1092  const float* dy, const int* incy) {
1093  float tmp;
1094  if (Gblas::timekeeping) {
1095  clock_t start = clock();
1096  sdot_(n, dx, incx, dy, incy);
1097  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1098  }
1099  else {
1100  sdot_(n, dx, incx, dy, incy);
1101  }
1102  return tmp;
1103  }
1104 #endif
1105 
1106  template<>
1107  inline void axpy<float>(const int* n, const float* da, const float* dx,
1108  const int* incx, float* dy,const int* incy) {
1109  if (Gblas::timekeeping) {
1110  clock_t start = clock();
1111  saxpy_(n, da, dx, incx, dy, incy);
1112  Gblas::time += ((float)(clock() - start)) / (CLOCKS_PER_SEC);
1113  }
1114  else {
1115  saxpy_(n, da, dx, incx, dy, incy);
1116  }
1117  }
1118 
1119  /* END OF SPECIALIZATIONS */
1120 #endif
1121 
1122 
1123 
1124 
1125 
1126 
1127 
1128 
1129 
1130  /* Other */
1131 
1132  template<class Treal>
1133  static void fulltopacked(const Treal* full, Treal* packed, const int size){
1134  int pind=0;
1135  for (int col=0;col<size;col++)
1136  {
1137  for(int row=0;row<=col;row++)
1138  {
1139  packed[pind]=full[col*size+row];
1140  pind++;
1141  }
1142  }
1143  }
1144 
1145  template<class Treal>
1146  static void packedtofull(const Treal* packed, Treal* full, const int size){
1147  int psize=(size+1)*size/2;
1148  int col=0;
1149  int row=0;
1150  for(int pind=0;pind<psize;pind++)
1151  {
1152  if (col==row)
1153  {
1154  full[col*size+row]=packed[pind];
1155  col++;
1156  row=0;
1157  }
1158  else
1159  {
1160  full[col*size+row]=packed[pind];
1161  full[row*size+col]=packed[pind];
1162  row++;
1163  }
1164  }
1165  }
1166 
1167  template<class Treal>
1168  static void tripackedtofull(const Treal* packed,Treal* full,
1169  const int size) {
1170  int psize=(size+1)*size/2;
1171  int col=0;
1172  int row=0;
1173  for(int pind=0;pind<psize;pind++)
1174  {
1175  if (col==row)
1176  {
1177  full[col*size+row]=packed[pind];
1178  col++;
1179  row=0;
1180  }
1181  else
1182  {
1183  full[col*size+row]=packed[pind];
1184  full[row*size+col]=0;
1185  row++;
1186  }
1187  }
1188  }
1189 
1190  template<class Treal>
1191  static void trifulltofull(Treal* trifull, const int size) {
1192  for(int col = 0; col < size - 1; col++)
1193  for(int row = col + 1; row < size; row++)
1194  trifull[col * size + row] = 0;
1195  }
1196 
1197 
1198 } /* namespace mat */
1199 
1200 #endif /* GBLAS */
void potrf< float >(const char *uplo, const int *n, float *A, const int *lda, int *info)
Definition: gblas.h:896
void trmm< float >(const char *side, const char *uplo, const char *transa, const char *diag, const int *m, const int *n, const float *alpha, const float *A, const int *lda, float *B, const int *ldb)
Definition: gblas.h:842
#define A
int template_blas_scal(const integer *n, const Treal *da, Treal *dx, const integer *incx)
Definition: template_blas_scal.h:41
void pptrf< float >(const char *uplo, const int *n, float *ap, int *info)
Definition: gblas.h:801
void gemv< float >(const char *ta, const int *m, const int *n, const float *alpha, const float *A, const int *lda, const float *x, const int *incx, const float *beta, float *y, const int *incy)
Definition: gblas.h:1028
static void trifulltofull(Treal *trifull, const int size)
Definition: gblas.h:1191
void spgst< float >(const int *itype, const char *uplo, const int *n, float *ap, const float *bp, int *info)
Definition: gblas.h:814
Definition: gblas.h:223
static bool timekeeping
Definition: gblas.h:225
void symm< float >(const char *side, const char *uplo, const int *m, const int *n, const float *alpha, const float *A, const int *lda, const float *B, const int *ldb, const float *beta, float *C, const int *ldc)
Definition: gblas.h:937
void spptrf_(const char *uplo, const int *n, float *ap, int *info)
void stevx< float >(const char *jobz, const char *range, const int *n, float *d, float *e, const float *vl, const float *vu, const int *il, const int *iu, const float *abstol, int *m, float *w, float *z, const int *ldz, float *work, int *iwork, int *ifail, int *info)
Definition: gblas.h:969
void sgemv_(const char *ta, const int *m, const int *n, const float *alpha, const float *A, const int *lda, const float *x, const int *incx, const float *beta, float *y, const int *incy)
void dspgst_(const int *itype, const char *uplo, const int *n, double *ap, const double *bp, int *info)
void pptrf< double >(const char *uplo, const int *n, double *ap, int *info)
Definition: gblas.h:463
void gemv< double >(const char *ta, const int *m, const int *n, const double *alpha, const double *A, const int *lda, const double *x, const int *incx, const double *beta, double *y, const int *incy)
Definition: gblas.h:691
double dot< double >(const int *n, const double *dx, const int *incx, const double *dy, const int *incy)
Definition: gblas.h:753
void axpy< float >(const int *n, const float *da, const float *dx, const int *incx, float *dy, const int *incy)
Definition: gblas.h:1107
int template_lapack_potrf(const char *uplo, const integer *n, Treal *a, const integer *lda, integer *info)
Definition: template_lapack_potrf.h:41
void strmv_(const char *uplo, const char *trans, const char *diag, const int *n, const float *A, const int *lda, float *x, const int *incx)
int template_lapack_pocon(const char *uplo, const integer *n, const Treal *a, const integer *lda, const Treal *anorm, Treal *rcond, Treal *work, integer *iwork, integer *info)
Definition: template_lapack_pocon.h:40
void sygv< double >(const int *itype, const char *jobz, const char *uplo, const int *n, double *A, const int *lda, double *B, const int *ldb, double *w, double *work, const int *lwork, int *info)
Definition: gblas.h:520
void pocon< float >(const char *uplo, const int *n, const float *A, const int *lda, const float *anorm, float *rcond, float *work, int *iwork, int *info)
Definition: gblas.h:954
int template_blas_trmm(const char *side, const char *uplo, const char *transa, const char *diag, const integer *m, const integer *n, const Treal *alpha, const Treal *a, const integer *lda, Treal *b, const integer *ldb)
Definition: template_blas_trmm.h:41
void strmm_(const char *side, const char *uplo, const char *transa, const char *diag, const int *m, const int *n, const float *alpha, const float *A, const int *lda, float *B, const int *ldb)
void symm< double >(const char *side, const char *uplo, const int *m, const int *n, const double *alpha, const double *A, const int *lda, const double *B, const int *ldb, const double *beta, double *C, const int *ldc)
Definition: gblas.h:598
static void symm(const char *side, const char *uplo, const int *m, const int *n, const T *alpha, const T *A, const int *lda, const T *B, const int *ldb, const T *beta, T *C, const int *ldc)
Definition: gblas.h:340
static void gemm(const char *ta, const char *tb, const int *n, const int *k, const int *l, const T *alpha, const T *A, const int *lda, const T *B, const int *ldb, const T *beta, T *C, const int *ldc)
Definition: gblas.h:230
void stevr< float >(const char *jobz, const char *range, const int *n, float *d, float *e, const float *vl, const float *vu, const int *il, const int *iu, const float *abstol, int *m, float *w, float *z, const int *ldz, int *isuppz, float *work, int *lwork, int *iwork, int *liwork, int *info)
Definition: gblas.h:990
static void pocon(const char *uplo, const int *n, const T *A, const int *lda, const T *anorm, T *rcond, T *work, int *iwork, int *info)
Definition: gblas.h:349
double ddot_(const int *n, const double *dx, const int *incx, const double *dy, const int *incy)
static void spgst(const int *itype, const char *uplo, const int *n, T *ap, const T *bp, int *info)
Definition: gblas.h:266
void dsymm_(const char *side, const char *uplo, const int *m, const int *n, const double *alpha, const double *A, const int *lda, const double *B, const int *ldb, const double *beta, double *C, const int *ldc)
int template_blas_trmv(const char *uplo, const char *trans, const char *diag, const integer *n, const Treal *a, const integer *lda, Treal *x, const integer *incx)
Definition: template_blas_trmv.h:40
static void trmv(const char *uplo, const char *trans, const char *diag, const int *n, const T *A, const int *lda, T *x, const int *incx)
Definition: gblas.h:407
void dsygv_(const int *itype, const char *jobz, const char *uplo, const int *n, double *A, const int *lda, double *B, const int *ldb, double *w, double *work, const int *lwork, int *info)
static void syrk(const char *uplo, const char *trans, const int *n, const int *k, const T *alpha, const T *A, const int *lda, const T *beta, T *C, const int *ldc)
Definition: gblas.h:332
void dtrmv_(const char *uplo, const char *trans, const char *diag, const int *n, const double *A, const int *lda, double *x, const int *incx)
void dgemm_(const char *ta, const char *tb, const int *n, const int *k, const int *l, const double *alpha, const double *A, const int *lda, const double *B, const int *ldb, const double *beta, double *C, const int *ldc)
Definition: allocate.cc:30
void ggev< float >(const char *jobbl, const char *jobvr, const int *n, float *A, const int *lda, float *B, const int *ldb, float *alphar, float *alphai, float *beta, float *vl, const int *ldvl, float *vr, const int *ldvr, float *work, const int *lwork, int *info)
Definition: gblas.h:876
void scal< double >(const int *n, const double *da, double *dx, const int *incx)
Definition: gblas.h:740
int template_lapack_spgst(const integer *itype, const char *uplo, const integer *n, Treal *ap, const Treal *bp, integer *info)
Definition: template_lapack_spgst.h:41
void syev< double >(const char *jobz, const char *uplo, const int *n, double *a, const int *lda, double *w, double *work, const int *lwork, int *info)
Definition: gblas.h:675
int template_blas_syrk(const char *uplo, const char *trans, const integer *n, const integer *k, const Treal *alpha, const Treal *a, const integer *lda, const Treal *beta, Treal *c__, const integer *ldc)
Definition: template_blas_syrk.h:40
void axpy< double >(const int *n, const double *da, const double *dx, const int *incx, double *dy, const int *incy)
Definition: gblas.h:768
void dstevr_(const char *jobz, const char *range, const int *n, double *d, double *e, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, int *m, double *w, double *z, const int *ldz, int *isuppz, double *work, int *lwork, int *iwork, int *liwork, int *info)
void sspgst_(const int *itype, const char *uplo, const int *n, float *ap, const float *bp, int *info)
void tptri< double >(const char *uplo, const char *diag, const int *n, double *ap, int *info)
Definition: gblas.h:490
void saxpy_(const int *n, const float *da, const float *dx, const int *incx, float *dy, const int *incy)
int template_blas_symm(const char *side, const char *uplo, const integer *m, const integer *n, const Treal *alpha, const Treal *a, const integer *lda, const Treal *b, const integer *ldb, const Treal *beta, Treal *c__, const integer *ldc)
Definition: template_blas_symm.h:40
void gemm< float >(const char *ta, const char *tb, const int *n, const int *k, const int *l, const float *alpha, const float *A, const int *lda, const float *B, const int *ldb, const float *beta, float *C, const int *ldc)
Definition: gblas.h:783
void dstevx_(const char *jobz, const char *range, const int *n, double *d, double *e, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, int *m, double *w, double *z, const int *ldz, double *work, int *iwork, int *ifail, int *info)
static void trtri(const char *uplo, const char *diag, const int *n, T *A, const int *lda, int *info)
Definition: gblas.h:319
static void sygv(const int *itype, const char *jobz, const char *uplo, const int *n, T *A, const int *lda, T *B, const int *ldb, T *w, T *work, const int *lwork, int *info)
Definition: gblas.h:291
void sygv< float >(const int *itype, const char *jobz, const char *uplo, const int *n, float *A, const int *lda, float *B, const int *ldb, float *w, float *work, const int *lwork, int *info)
Definition: gblas.h:859
void daxpy_(const int *n, const double *da, const double *dx, const int *incx, double *dy, const int *incy)
void spgst< double >(const int *itype, const char *uplo, const int *n, double *ap, const double *bp, int *info)
Definition: gblas.h:476
void sggev_(const char *jobbl, const char *jobvr, const int *n, float *A, const int *lda, float *B, const int *ldb, float *alphar, float *alphai, float *beta, float *vl, const int *ldvl, float *vr, const int *ldvr, float *work, const int *lwork, int *info)
static T dot(const int *n, const T *dx, const int *incx, const T *dy, const int *incy)
Definition: gblas.h:423
void ssyev_(const char *jobz, const char *uplo, const int *n, float *a, const int *lda, float *w, float *work, const int *lwork, int *info)
void scal< float >(const int *n, const float *da, float *dx, const int *incx)
Definition: gblas.h:1076
static void potrf(const char *uplo, const int *n, T *A, const int *lda, int *info)
Definition: gblas.h:312
static void syev(const char *jobz, const char *uplo, const int *n, T *a, const int *lda, T *w, T *work, const int *lwork, int *info)
Definition: gblas.h:380
static void axpy(const int *n, const T *da, const T *dx, const int *incx, T *dy, const int *incy)
Definition: gblas.h:429
void ssymv_(const char *uplo, const int *n, const float *alpha, const float *A, const int *lda, const float *x, const int *incx, const float *beta, float *y, const int *incy)
static float time
Definition: gblas.h:224
void dscal_(const int *n, const double *da, double *dx, const int *incx)
void dsymv_(const char *uplo, const int *n, const double *alpha, const double *A, const int *lda, const double *x, const int *incx, const double *beta, double *y, const int *incy)
void syrk< float >(const char *uplo, const char *trans, const int *n, const int *k, const float *alpha, const float *A, const int *lda, const float *beta, float *C, const int *ldc)
Definition: gblas.h:922
void syev< float >(const char *jobz, const char *uplo, const int *n, float *a, const int *lda, float *w, float *work, const int *lwork, int *info)
Definition: gblas.h:1012
void dpotrf_(const char *uplo, const int *n, double *A, const int *lda, int *info)
int template_lapack_trtri(const char *uplo, const char *diag, const integer *n, Treal *a, const integer *lda, integer *info)
Definition: template_lapack_trtri.h:40
void trtri< float >(const char *uplo, const char *diag, const int *n, float *A, const int *lda, int *info)
Definition: gblas.h:909
void dsyev_(const char *jobz, const char *uplo, const int *n, double *a, const int *lda, double *w, double *work, const int *lwork, int *info)
static void symv(const char *uplo, const int *n, const T *alpha, const T *A, const int *lda, const T *x, const int *incx, const T *beta, T *y, const int *incy)
Definition: gblas.h:398
static void ggev(const char *jobbl, const char *jobvr, const int *n, T *A, const int *lda, T *B, const int *ldb, T *alphar, T *alphai, T *beta, T *vl, const int *ldvl, T *vr, const int *ldvr, T *work, const int *lwork, int *info)
Definition: gblas.h:299
void dtrmm_(const char *side, const char *uplo, const char *transa, const char *diag, const int *m, const int *n, const double *alpha, const double *A, const int *lda, double *B, const int *ldb)
int template_lapack_pptrf(const char *uplo, const integer *n, Treal *ap, integer *info)
Definition: template_lapack_pptrf.h:41
int template_lapack_sygv(const integer *itype, const char *jobz, const char *uplo, const integer *n, Treal *a, const integer *lda, Treal *b, const integer *ldb, Treal *w, Treal *work, const integer *lwork, integer *info)
Definition: template_lapack_sygv.h:40
void stevx< double >(const char *jobz, const char *range, const int *n, double *d, double *e, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, int *m, double *w, double *z, const int *ldz, double *work, int *iwork, int *ifail, int *info)
Definition: gblas.h:630
void ggev< double >(const char *jobbl, const char *jobvr, const int *n, double *A, const int *lda, double *B, const int *ldb, double *alphar, double *alphai, double *beta, double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info)
Definition: gblas.h:537
void potrf< double >(const char *uplo, const int *n, double *A, const int *lda, int *info)
Definition: gblas.h:557
void gemm< double >(const char *ta, const char *tb, const int *n, const int *k, const int *l, const double *alpha, const double *A, const int *lda, const double *B, const int *ldb, const double *beta, double *C, const int *ldc)
Definition: gblas.h:445
void ssymm_(const char *side, const char *uplo, const int *m, const int *n, const float *alpha, const float *A, const int *lda, const float *B, const int *ldb, const float *beta, float *C, const int *ldc)
static void trmm(const char *side, const char *uplo, const char *transa, const char *diag, const int *m, const int *n, const T *alpha, const T *A, const int *lda, T *B, const int *ldb)
Definition: gblas.h:279
int template_lapack_tptri(const char *uplo, const char *diag, const integer *n, Treal *ap, integer *info)
Definition: template_lapack_tptri.h:41
void tptri< float >(const char *uplo, const char *diag, const int *n, float *ap, int *info)
Definition: gblas.h:828
void dtptri_(const char *uplo, const char *diag, const int *n, double *ap, int *info)
void sscal_(const int *n, const float *da, float *dx, const int *incx)
void pocon< double >(const char *uplo, const int *n, const double *A, const int *lda, const double *anorm, double *rcond, double *work, int *iwork, int *info)
Definition: gblas.h:615
void stevr< double >(const char *jobz, const char *range, const int *n, double *d, double *e, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, int *m, double *w, double *z, const int *ldz, int *isuppz, double *work, int *lwork, int *iwork, int *liwork, int *info)
Definition: gblas.h:651
void dsyrk_(const char *uplo, const char *trans, const int *n, const int *k, const double *alpha, const double *A, const int *lda, const double *beta, double *C, const int *ldc)
void ssygv_(const int *itype, const char *jobz, const char *uplo, const int *n, float *A, const int *lda, float *B, const int *ldb, float *w, float *work, const int *lwork, int *info)
void trmv< double >(const char *uplo, const char *trans, const char *diag, const int *n, const double *A, const int *lda, double *x, const int *incx)
Definition: gblas.h:723
int template_blas_gemv(const char *trans, const integer *m, const integer *n, const Treal *alpha, const Treal *a, const integer *lda, const Treal *x, const integer *incx, const Treal *beta, Treal *y, const integer *incy)
Definition: template_blas_gemv.h:41
void dpptrf_(const char *uplo, const int *n, double *ap, int *info)
static void scal(const int *n, const T *da, T *dx, const int *incx)
Definition: gblas.h:417
side
Definition: Matrix.h:73
int template_lapack_syev(const char *jobz, const char *uplo, const integer *n, Treal *a, const integer *lda, Treal *w, Treal *work, const integer *lwork, integer *info)
Definition: template_lapack_syev.h:40
static void fulltopacked(const Treal *full, Treal *packed, const int size)
Definition: gblas.h:1133
static void gemv(const char *ta, const int *m, const int *n, const T *alpha, const T *A, const int *lda, const T *x, const int *incx, const T *beta, T *y, const int *incy)
Definition: gblas.h:389
int template_blas_axpy(const integer *n, const Treal *da, const Treal *dx, const integer *incx, Treal *dy, const integer *incy)
Definition: template_blas_axpy.h:41
void sgemm_(const char *ta, const char *tb, const int *n, const int *k, const int *l, const float *alpha, const float *A, const int *lda, const float *B, const int *ldb, const float *beta, float *C, const int *ldc)
void trtri< double >(const char *uplo, const char *diag, const int *n, double *A, const int *lda, int *info)
Definition: gblas.h:570
static void stevr(const char *jobz, const char *range, const int *n, T *d, T *e, const T *vl, const T *vu, const int *il, const int *iu, const T *abstol, int *m, T *w, T *z, const int *ldz, int *isuppz, T *work, int *lwork, int *iwork, int *liwork, int *info)
Definition: gblas.h:367
void dggev_(const char *jobbl, const char *jobvr, const int *n, double *A, const int *lda, double *B, const int *ldb, double *alphar, double *alphai, double *beta, double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info)
void dtrtri_(const char *uplo, const char *diag, const int *n, double *A, const int *lda, int *info)
static void pptrf(const char *uplo, const int *n, T *ap, int *info)
Definition: gblas.h:261
void trmm< double >(const char *side, const char *uplo, const char *transa, const char *diag, const int *m, const int *n, const double *alpha, const double *A, const int *lda, double *B, const int *ldb)
Definition: gblas.h:503
void syrk< double >(const char *uplo, const char *trans, const int *n, const int *k, const double *alpha, const double *A, const int *lda, const double *beta, double *C, const int *ldc)
Definition: gblas.h:583
void spocon_(const char *uplo, const int *n, const float *A, const int *lda, const float *anorm, float *rcond, float *work, int *iwork, int *info)
int template_blas_symv(const char *uplo, const integer *n, const Treal *alpha, const Treal *a, const integer *lda, const Treal *x, const integer *incx, const Treal *beta, Treal *y, const integer *incy)
Definition: template_blas_symv.h:40
static void tptri(const char *uplo, const char *diag, const int *n, T *ap, int *info)
Definition: gblas.h:273
void dgemv_(const char *ta, const int *m, const int *n, const double *alpha, const double *A, const int *lda, const double *x, const int *incx, const double *beta, double *y, const int *incy)
int template_lapack_stevr(const char *jobz, const char *range, const integer *n, Treal *d__, Treal *e, const Treal *vl, const Treal *vu, const integer *il, const integer *iu, const Treal *abstol, integer *m, Treal *w, Treal *z__, const integer *ldz, integer *isuppz, Treal *work, integer *lwork, integer *iwork, integer *liwork, integer *info)
Definition: template_lapack_stevr.h:39
void symv< double >(const char *uplo, const int *n, const double *alpha, const double *A, const int *lda, const double *x, const int *incx, const double *beta, double *y, const int *incy)
Definition: gblas.h:707
int template_blas_gemm(const char *transa, const char *transb, const integer *m, const integer *n, const integer *k, const Treal *alpha, const Treal *a, const integer *lda, const Treal *b, const integer *ldb, const Treal *beta, Treal *c__, const integer *ldc)
Definition: template_blas_gemm.h:41
#define B
static void stevx(const char *jobz, const char *range, const int *n, T *d, T *e, const T *vl, const T *vu, const int *il, const int *iu, const T *abstol, int *m, T *w, T *z, const int *ldz, T *work, int *iwork, int *ifail, int *info)
Definition: gblas.h:356
void trmv< float >(const char *uplo, const char *trans, const char *diag, const int *n, const float *A, const int *lda, float *x, const int *incx)
Definition: gblas.h:1060
void dpocon_(const char *uplo, const int *n, const double *A, const int *lda, const double *anorm, double *rcond, double *work, int *iwork, int *info)
void strtri_(const char *uplo, const char *diag, const int *n, float *A, const int *lda, int *info)
void stptri_(const char *uplo, const char *diag, const int *n, float *ap, int *info)
void spotrf_(const char *uplo, const int *n, float *A, const int *lda, int *info)
void ssyrk_(const char *uplo, const char *trans, const int *n, const int *k, const float *alpha, const float *A, const int *lda, const float *beta, float *C, const int *ldc)
int template_lapack_ggev(const char *jobvl, const char *jobvr, const integer *n, Treal *a, const integer *lda, Treal *b, const integer *ldb, Treal *alphar, Treal *alphai, Treal *beta, Treal *vl, const integer *ldvl, Treal *vr, const integer *ldvr, Treal *work, const integer *lwork, integer *info)
Definition: template_lapack_ggev.h:40
void sstevr_(const char *jobz, const char *range, const int *n, float *d, float *e, const float *vl, const float *vu, const int *il, const int *iu, const float *abstol, int *m, float *w, float *z, const int *ldz, int *isuppz, float *work, int *lwork, int *iwork, int *liwork, int *info)
void symv< float >(const char *uplo, const int *n, const float *alpha, const float *A, const int *lda, const float *x, const int *incx, const float *beta, float *y, const int *incy)
Definition: gblas.h:1044
int template_lapack_stevx(const char *jobz, const char *range, const integer *n, Treal *d__, Treal *e, const Treal *vl, const Treal *vu, const integer *il, const integer *iu, const Treal *abstol, integer *m, Treal *w, Treal *z__, const integer *ldz, Treal *work, integer *iwork, integer *ifail, integer *info)
Definition: template_lapack_stevx.h:40
static void tripackedtofull(const Treal *packed, Treal *full, const int size)
Definition: gblas.h:1168
Treal template_blas_dot(const integer *n, const Treal *dx, const integer *incx, const Treal *dy, const integer *incy)
Definition: template_blas_dot.h:41
void sstevx_(const char *jobz, const char *range, const int *n, float *d, float *e, const float *vl, const float *vu, const int *il, const int *iu, const float *abstol, int *m, float *w, float *z, const int *ldz, float *work, int *iwork, int *ifail, int *info)
static void packedtofull(const Treal *packed, Treal *full, const int size)
Definition: gblas.h:1146