DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
cblas_alt_template.h
Go to the documentation of this file.
1 #ifndef CBLAS_ALT_TEMPLATE_H
2 #define CBLAS_ALT_TEMPLATE_H
3 
4 //#include <cblas.h>
5 #include <stddef.h>
6 //#include <blas.h>
7 #ifdef small
8 #undef small
9 #endif
10 //#include <lapack.h>
11 #include <cblas_defvar.h>
12 
13 #ifdef NEW_MATLAB
14  typedef ptrdiff_t INTT;
15 #else
16  typedef int INTT;
17 #endif
18 
20 static char low='l';
21 static char lower='L';
22 static char nonUnit='n';
23 static char upper='u';
24 static INTT info=0;
25 static char incr='I';
26 static char decr='D';
27 static char all='A';
28 static char no='N';
29 static char reduced='S';
30 static char allV='V';
31 
32 #ifdef REMOVE_
33 #define dnrm2_ dnrm2
34 #define snrm2_ snrm2
35 #define dcopy_ dcopy
36 #define scopy_ scopy
37 #define daxpy_ daxpy
38 #define saxpy_ saxpy
39 #define dscal_ dscal
40 #define sscal_ sscal
41 #define dasum_ dasum
42 #define sasum_ sasum
43 #define ddot_ ddot
44 #define sdot_ sdot
45 #define dgemv_ dgemv
46 #define sgemv_ sgemv
47 #define dger_ dger
48 #define sger_ sger
49 #define dtrmv_ dtrmv
50 #define strmv_ strmv
51 #define dsyr_ dsyr
52 #define ssyr_ ssyr
53 #define dsymv_ dsymv
54 #define ssymv_ ssymv
55 #define dgemm_ dgemm
56 #define sgemm_ sgemm
57 #define dsyrk_ dsyrk
58 #define ssyrk_ ssyrk
59 #define dtrmm_ dtrmm
60 #define strmm_ strmm
61 #define dtrtri_ dtrtri
62 #define strtri_ strtri
63 #define idamax_ idamax
64 #define isamax_ isamax
65 #define dsytrf_ dsytrf
66 #define ssytrf_ ssytrf
67 #define dsytri_ dsytri
68 #define ssytri_ ssytri
69 #define dlasrt_ dlasrt
70 #define slasrt_ slasrt
71 #define dgesvd_ dgesvd
72 #define sgesvd_ sgesvd
73 #define dsyev_ dsyev
74 #define ssyev_ ssyev
75 #endif
76 
78 #ifdef HAVE_MKL // obsolete
79 extern "C" {
80 #endif
81  size_t cblas_idamin( int n, double* X, int incX);
82  size_t cblas_isamin( int n, float* X, int incX);
83 #ifdef HAVE_MKL
84 };
85 #endif
86 
87 #ifdef HAVE_MKL
88 extern "C" {
89  void vdSqr( int n, double* vecIn, double* vecOut);
90  void vsSqr( int n, float* vecIn, float* vecOut);
91  void vdSqrt( int n, double* vecIn, double* vecOut);
92  void vsSqrt( int n, float* vecIn, float* vecOut);
93  void vdInvSqrt( int n, double* vecIn, double* vecOut);
94  void vsInvSqrt( int n, float* vecIn, float* vecOut);
95  void vdSub( int n, double* vecIn, double* vecIn2, double* vecOut);
96  void vsSub( int n, float* vecIn, float* vecIn2, float* vecOut);
97  void vdDiv( int n, double* vecIn, double* vecIn2, double* vecOut);
98  void vsDiv( int n, float* vecIn, float* vecIn2, float* vecOut);
99  void vdExp( int n, double* vecIn, double* vecOut);
100  void vsExp( int n, float* vecIn, float* vecOut);
101  void vdInv( int n, double* vecIn, double* vecOut);
102  void vsInv( int n, float* vecIn, float* vecOut);
103  void vdAdd( int n, double* vecIn, double* vecIn2, double* vecOut);
104  void vsAdd( int n, float* vecIn, float* vecIn2, float* vecOut);
105  void vdMul( int n, double* vecIn, double* vecIn2, double* vecOut);
106  void vsMul( int n, float* vecIn, float* vecIn2, float* vecOut);
107  void vdAbs( int n, double* vecIn, double* vecOut);
108  void vsAbs( int n, float* vecIn, float* vecOut);
109 }
110 #endif
111 
112 
113 // INTTerfaces to a few BLAS function, Level 1
115 template <typename T> T cblas_nrm2( INTT n, T* X, INTT incX);
117 template <typename T> void cblas_copy( INTT n, T* X, INTT incX,
118  T* Y, INTT incY);
120 template <typename T> void cblas_axpy( INTT n, T a, T* X,
121  INTT incX, T* Y, INTT incY);
123 template <typename T> void cblas_scal( INTT n, T a, T* X,
124  INTT incX);
126 template <typename T> T cblas_asum( INTT n, T* X, INTT incX);
128 template <typename T> T cblas_dot( INTT n, T* X, INTT incX,
129  T* Y, INTT incY);
131 template <typename T> int cblas_iamin( INTT n, T* X, INTT incX);
133 template <typename T> int cblas_iamax( INTT n, T* X, INTT incX);
134 
135 // INTTerfaces to a few BLAS function, Level 2
136 
138 template <typename T> void cblas_gemv( CBLAS_ORDER order,
139  CBLAS_TRANSPOSE TransA, INTT M,
140  INTT N, T alpha, T *A, INTT lda, T *X,
141  INTT incX, T beta,T *Y, INTT incY);
143 template <typename T> void inline cblas_trmv( CBLAS_ORDER order, CBLAS_UPLO Uplo,
144  CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT N,
145  T *A, INTT lda, T *X, INTT incX);
147 template <typename T> void inline cblas_syr( CBLAS_ORDER order,
148  CBLAS_UPLO Uplo, INTT N, T alpha,
149  T *X, INTT incX, T *A, INTT lda);
150 
152 template <typename T> inline void cblas_symv( CBLAS_ORDER order,
153  CBLAS_UPLO Uplo, INTT N,
154  T alpha, T *A, INTT lda, T *X,
155  INTT incX, T beta,T *Y, INTT incY);
156 
157 
158 // INTTerfaces to a few BLAS function, Level 3
160 template <typename T> void cblas_gemm( CBLAS_ORDER order,
161  CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB,
162  INTT M, INTT N, INTT K, T alpha,
163  T *A, INTT lda, T *B, INTT ldb,
164  T beta, T *C, INTT ldc);
166 template <typename T> void cblas_syrk( CBLAS_ORDER order,
167  CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K,
168  T alpha, T *A, INTT lda,
169  T beta, T*C, INTT ldc);
171 template <typename T> void cblas_ger( CBLAS_ORDER order,
172  INTT M, INTT N, T alpha, T *X, INTT incX,
173  T* Y, INTT incY, T*A, INTT lda);
175 template <typename T> void cblas_trmm( CBLAS_ORDER order,
176  CBLAS_SIDE Side, CBLAS_UPLO Uplo,
177  CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag,
178  INTT M, INTT N, T alpha,
179  T*A, INTT lda,T *B, INTT ldb);
180 
181 // interfaces to a few functions from the intel Vector Mathematical Library
183 template <typename T> void vSqrt( int n, T* vecIn, T* vecOut);
185 template <typename T> void vInvSqrt( int n, T* vecIn, T* vecOut);
187 template <typename T> void vSqr( int n, T* vecIn, T* vecOut);
189 template <typename T> void vSub( int n, T* vecIn, T* vecIn2, T* vecOut);
191 template <typename T> void vDiv( int n, T* vecIn, T* vecIn2, T* vecOut);
193 template <typename T> void vExp( int n, T* vecIn, T* vecOut);
195 template <typename T> void vInv( int n, T* vecIn, T* vecOut);
197 template <typename T> void vAdd( int n, T* vecIn, T* vecIn2, T* vecOut);
199 template <typename T> void vMul( int n, T* vecIn, T* vecIn2, T* vecOut);
201 template <typename T> void vAbs( int n, T* vecIn, T* vecOut);
202 
203 // interfaces to a few LAPACK functions
205 template <typename T> void trtri(char& uplo, char& diag,
206  INTT n, T * a, INTT lda);
208 template <typename T> void sytri(char& uplo, INTT n, T* a, INTT lda);
209 //, INTT* ipiv,
210 // T* work);
212 template <typename T> void lasrt(char& id, INTT n, T *d);
213 //template <typename T> void lasrt2(char& id, INTT& n, T *d, int* key);
214 template <typename T> void gesvd( char& jobu, char& jobvt, INTT m,
215  INTT n, T* a, INTT lda, T* s,
216  T* u, INTT ldu, T* vt, INTT ldvt);
217 template <typename T> void syev( char& jobz, char& uplo, INTT n,
218  T* a, INTT lda, T* w);
219 
220 
221 /* ******************
222  * Implementations
223  * *****************/
224 
225 
226 extern "C" {
227 #if !defined(_MKL_LAPACK_H_) && !defined(_LAPACKE_H_)
228  void dtrtri_(char* uplo, char* diag, INTT* n, double * a, INTT* lda,
229  INTT* info);
230  void strtri_(char* uplo, char* diag, INTT* n, float * a, INTT* lda,
231  INTT* info);
232  void dsytrf_(char* uplo, INTT* n, double* a, INTT* lda, INTT* ipiv,
233  double* work, INTT* lwork, INTT* info);
234  void ssytrf_(char* uplo, INTT* n, float* a, INTT* lda, INTT* ipiv,
235  float* work, INTT* lwork, INTT* info);
236  void dsytri_(char* uplo, INTT* n, double* a, INTT* lda, INTT* ipiv,
237  double* work, INTT* info);
238  void ssytri_(char* uplo, INTT* n, float* a, INTT* lda, INTT* ipiv,
239  float* work, INTT* info);
240  void dlasrt_(char* id, INTT* n, double *d, INTT* info);
241  void slasrt_(char* id, INTT* n, float*d, INTT* info);
242  void dgesvd_(char*jobu, char *jobvt, INTT *m, INTT *n, double *a,
243  INTT *lda, double *s, double *u, INTT *ldu, double *vt,
244  INTT *ldvt, double *work, INTT *lwork, INTT *info);
245  void sgesvd_(char*jobu, char *jobvt, INTT *m, INTT *n, float *a,
246  INTT *lda, float *s, float *u, INTT *ldu, float *vt,
247  INTT *ldvt, float *work, INTT *lwork, INTT *info);
248  void dsyev_(char *jobz, char *uplo, INTT *n, double *a, INTT *lda,
249  double *w, double *work, INTT *lwork, INTT *info);
250  void ssyev_(char *jobz, char *uplo, INTT *n, float *a, INTT *lda,
251  float *w, float *work, INTT *lwork, INTT *info);
252 #endif
253  double dnrm2_(INTT *n,double *x,INTT *incX);
254  float snrm2_(INTT *n,float *x,INTT *incX);
255  void dcopy_(INTT *n,double *x,INTT *incX, double *y,INTT *incY);
256  void scopy_(INTT *n,float *x,INTT *incX, float *y,INTT *incY);
257  void daxpy_(INTT *n,double* a, double *x,INTT *incX, double *y,INTT *incY);
258  void saxpy_(INTT *n,float* a, float *x,INTT *incX, float *y,INTT *incY);
259  void dscal_(INTT *n,double* a, double *x,INTT *incX);
260  void sscal_(INTT *n,float* a, float *x,INTT *incX);
261  double dasum_(INTT *n,double *x,INTT *incX);
262  float sasum_(INTT *n,float *x,INTT *incX);
263  double ddot_(INTT *n,double *x,INTT *incX, double *y,INTT *incY);
264  float sdot_(INTT *n,float *x,INTT *incX, float *y,INTT *incY);
265  void dgemv_(char *trans, INTT *m, INTT *n, double *alpha, double *a,
266  INTT *lda, double *x, INTT *incx, double *beta, double *y,INTT *incy);
267  void sgemv_(char *trans, INTT *m, INTT *n, float *alpha, float *a,
268  INTT *lda, float *x, INTT *incx, float *beta, float *y,INTT *incy);
269  void dger_(INTT *m, INTT *n, double *alpha, double *x, INTT *incx,
270  double *y, INTT *incy, double *a, INTT *lda);
271  void sger_(INTT *m, INTT *n, float *alpha, float *x, INTT *incx,
272  float *y, INTT *incy, float *a, INTT *lda);
273  void dtrmv_(char *uplo, char *trans, char *diag, INTT *n, double *a,
274  INTT *lda, double *x, INTT *incx);
275  void strmv_(char *uplo, char *trans, char *diag, INTT *n, float *a,
276  INTT *lda, float *x, INTT *incx);
277  void dsyr_(char *uplo, INTT *n, double *alpha, double *x, INTT *incx,
278  double *a, INTT *lda);
279  void ssyr_(char *uplo, INTT *n, float *alpha, float *x, INTT *incx,
280  float *a, INTT *lda);
281  void dsymv_(char *uplo, INTT *n, double *alpha, double *a, INTT *lda,
282  double *x, INTT *incx, double *beta, double *y, INTT *incy);
283  void ssymv_(char *uplo, INTT *n, float *alpha, float *a, INTT *lda,
284  float *x, INTT *incx, float *beta, float *y, INTT *incy);
285  void dgemm_(char *transa, char *transb, INTT *m, INTT *n, INTT *k,
286  double *alpha, double *a, INTT *lda, double *b, INTT *ldb, double *beta,
287  double *c, INTT *ldc);
288  void sgemm_(char *transa, char *transb, INTT *m, INTT *n, INTT *k,
289  float *alpha, float *a, INTT *lda, float *b, INTT *ldb, float *beta,
290  float *c, INTT *ldc);
291  void dsyrk_(char *uplo, char *trans, INTT *n, INTT *k, double *alpha,
292  double *a, INTT *lda, double *beta, double *c, INTT *ldc);
293  void ssyrk_(char *uplo, char *trans, INTT *n, INTT *k, float *alpha,
294  float *a, INTT *lda, float *beta, float *c, INTT *ldc);
295  void dtrmm_(char *side,char *uplo,char *transa, char *diag, INTT *m,
296  INTT *n, double *alpha, double *a, INTT *lda, double *b,
297  INTT *ldb);
298  void strmm_(char *side,char *uplo,char *transa, char *diag, INTT *m,
299  INTT *n, float *alpha, float *a, INTT *lda, float *b,
300  INTT *ldb);
301  INTT idamax_(INTT *n, double *dx, INTT *incx);
302  INTT isamax_(INTT *n, float *dx, INTT *incx);
303 }
304 
305 
306 // Implementations of the INTTerfaces, BLAS Level 1
308 template <> inline double cblas_nrm2<double>( INTT n, double* X,
309  INTT incX) {
310  //return cblas_dnrm2(n,X,incX);
311  return dnrm2_(&n,X,&incX);
312 };
314 template <> inline float cblas_nrm2<float>( INTT n, float* X,
315  INTT incX) {
316  //return cblas_snrm2(n,X,incX);
317  return snrm2_(&n,X,&incX);
318 };
320 template <> inline void cblas_copy<double>( INTT n, double* X,
321  INTT incX, double* Y, INTT incY) {
322  //cblas_dcopy(n,X,incX,Y,incY);
323  dcopy_(&n,X,&incX,Y,&incY);
324 };
326 template <> inline void cblas_copy<float>( INTT n, float* X, INTT incX,
327  float* Y, INTT incY) {
328  //cblas_scopy(n,X,incX,Y,incY);
329  scopy_(&n,X,&incX,Y,&incY);
330 };
332 template <> inline void cblas_copy<int>( INTT n, int* X, INTT incX,
333  int* Y, INTT incY) {
334  for (int i = 0; i<n; ++i)
335  Y[incY*i]=X[incX*i];
336 };
338 template <> inline void cblas_copy<bool>( INTT n, bool* X, INTT incX,
339  bool* Y, INTT incY) {
340  for (int i = 0; i<n; ++i)
341  Y[incY*i]=X[incX*i];
342 };
343 
345 template <> inline void cblas_axpy<double>( INTT n, double a, double* X,
346  INTT incX, double* Y, INTT incY) {
347  //cblas_daxpy(n,a,X,incX,Y,incY);
348  daxpy_(&n,&a,X,&incX,Y,&incY);
349 };
351 template <> inline void cblas_axpy<float>( INTT n, float a, float* X,
352  INTT incX, float* Y, INTT incY) {
353  //cblas_saxpy(n,a,X,incX,Y,incY);
354  saxpy_(&n,&a,X,&incX,Y,&incY);
355 };
356 
358 template <> inline void cblas_axpy<int>( INTT n, int a, int* X,
359  INTT incX, int* Y, INTT incY) {
360  for (int i = 0; i<n; ++i)
361  Y[i] += a*X[i];
362 };
363 
365 template <> inline void cblas_axpy<bool>( INTT n, bool a, bool* X,
366  INTT incX, bool* Y, INTT incY) {
367  for (int i = 0; i<n; ++i)
368  Y[i] = a*X[i];
369 };
370 
371 
373 template <> inline void cblas_scal<double>( INTT n, double a, double* X,
374  INTT incX) {
375  //cblas_dscal(n,a,X,incX);
376  dscal_(&n,&a,X,&incX);
377 };
379 template <> inline void cblas_scal<float>( INTT n, float a, float* X,
380  INTT incX) {
381  //cblas_sscal(n,a,X,incX);
382  sscal_(&n,&a,X,&incX);
383 };
385 template <> inline void cblas_scal<int>( INTT n, int a, int* X,
386  INTT incX) {
387  for (int i = 0; i<n; ++i) X[i*incX]*=a;
388 };
390 template <> inline void cblas_scal<bool>( INTT n, bool a, bool* X,
391  INTT incX) {
393 };
394 
396 template <> inline double cblas_asum<double>( INTT n, double* X, INTT incX) {
397  //return cblas_dasum(n,X,1);
398  return dasum_(&n,X,&incX);
399 };
401 template <> inline float cblas_asum<float>( INTT n, float* X, INTT incX) {
402  //return cblas_sasum(n,X,1);
403  return sasum_(&n,X,&incX);
404 };
406 template <> inline double cblas_dot<double>( INTT n, double* X,
407  INTT incX, double* Y, INTT incY) {
408  //return cblas_ddot(n,X,incX,Y,incY);
409  return ddot_(&n,X,&incX,Y,&incY);
410 };
412 template <> inline float cblas_dot<float>( INTT n, float* X,
413  INTT incX, float* Y, INTT incY) {
414  //return cblas_sdot(n,X,incX,Y,incY);
415  return sdot_(&n,X,&incX,Y,&incY);
416 };
417 template <> inline int cblas_dot<int>( INTT n, int* X,
418  INTT incX, int* Y, INTT incY) {
419  int total=0;
420  int i,j;
421  j=0;
422  for (i = 0; i<n; ++i) {
423  total+=X[i*incX]*Y[j];
424  //j+=incY;
425  j+=(int)incY;
426  }
427  return total;
428 };
430 template <> inline bool cblas_dot<bool>( INTT n, bool* X,
431  INTT incX, bool* Y, INTT incY) {
433  return true;
434 };
435 
436 // Implementations of the INTTerfaces, BLAS Level 2
438 template <> inline void cblas_gemv<double>( CBLAS_ORDER order,
439  CBLAS_TRANSPOSE TransA, INTT M, INTT N,
440  double alpha, double *A, INTT lda,
441  double *X, INTT incX, double beta,
442  double *Y, INTT incY) {
443  //cblas_dgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY);
444  dgemv_(cblas_transpose(TransA),&M,&N,&alpha,A,&lda,X,&incX,&beta,Y,&incY);
445 };
447 template <> inline void cblas_gemv<float>( CBLAS_ORDER order,
448  CBLAS_TRANSPOSE TransA, INTT M, INTT N,
449  float alpha, float *A, INTT lda,
450  float *X, INTT incX, float beta,
451  float *Y, INTT incY) {
452  //cblas_sgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY);
453  sgemv_(cblas_transpose(TransA),&M,&N,&alpha,A,&lda,X,&incX,&beta,Y,&incY);
454 };
456 template <> inline void cblas_gemv<int>( CBLAS_ORDER order,
457  CBLAS_TRANSPOSE TransA, INTT M, INTT N,
458  int alpha, int *A, INTT lda,
459  int *X, INTT incX, int beta,
460  int *Y, INTT incY) {
462 };
464 template <> inline void cblas_gemv<bool>( CBLAS_ORDER order,
465  CBLAS_TRANSPOSE TransA, INTT M, INTT N,
466  bool alpha, bool *A, INTT lda,
467  bool *X, INTT incX, bool beta,
468  bool *Y, INTT incY) {
470 };
471 
473 template <> inline void cblas_ger<double>( CBLAS_ORDER order,
474  INTT M, INTT N, double alpha, double *X, INTT incX,
475  double* Y, INTT incY, double *A, INTT lda) {
476  //cblas_dger(order,M,N,alpha,X,incX,Y,incY,A,lda);
477  dger_(&M,&N,&alpha,X,&incX,Y,&incY,A,&lda);
478 };
480 template <> inline void cblas_ger<float>( CBLAS_ORDER order,
481  INTT M, INTT N, float alpha, float *X, INTT incX,
482  float* Y, INTT incY, float *A, INTT lda) {
483  //cblas_sger(order,M,N,alpha,X,incX,Y,incY,A,lda);
484  sger_(&M,&N,&alpha,X,&incX,Y,&incY,A,&lda);
485 };
487 template <> inline void cblas_trmv<double>( CBLAS_ORDER order, CBLAS_UPLO Uplo,
488  CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT N,
489  double *A, INTT lda, double *X, INTT incX) {
490  //cblas_dtrmv(order,Uplo,TransA,Diag,N,A,lda,X,incX);
491  dtrmv_(cblas_uplo(Uplo),cblas_transpose(TransA),cblas_diag(Diag),&N,A,&lda,X,&incX);
492 };
494 template <> inline void cblas_trmv<float>( CBLAS_ORDER order, CBLAS_UPLO Uplo,
495  CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT N,
496  float *A, INTT lda, float *X, INTT incX) {
497  //cblas_strmv(order,Uplo,TransA,Diag,N,A,lda,X,incX);
498  strmv_(cblas_uplo(Uplo),cblas_transpose(TransA),cblas_diag(Diag),&N,A,&lda,X,&incX);
499 };
501 template <> inline void cblas_syr( CBLAS_ORDER order,
502  CBLAS_UPLO Uplo,
503  INTT N, double alpha, double*X,
504  INTT incX, double *A, INTT lda) {
505  //cblas_dsyr(order,Uplo,N,alpha,X,incX,A,lda);
506  dsyr_(cblas_uplo(Uplo),&N,&alpha,X,&incX,A,&lda);
507 };
509 template <> inline void cblas_syr( CBLAS_ORDER order,
510  CBLAS_UPLO Uplo,
511  INTT N, float alpha, float*X,
512  INTT incX, float *A, INTT lda) {
513  //cblas_ssyr(order,Uplo,N,alpha,X,incX,A,lda);
514  ssyr_(cblas_uplo(Uplo),&N,&alpha,X,&incX,A,&lda);
515 };
517 template <> inline void cblas_symv( CBLAS_ORDER order,
518  CBLAS_UPLO Uplo, INTT N,
519  float alpha, float *A, INTT lda, float *X,
520  INTT incX, float beta,float *Y, INTT incY) {
521  //cblas_ssymv(order,Uplo,N,alpha,A,lda,X,incX,beta,Y,incY);
522  ssymv_(cblas_uplo(Uplo),&N,&alpha,A,&lda,X,&incX,&beta,Y,&incY);
523 }
525 template <> inline void cblas_symv( CBLAS_ORDER order,
526  CBLAS_UPLO Uplo, INTT N,
527  double alpha, double *A, INTT lda, double *X,
528  INTT incX, double beta,double *Y, INTT incY) {
529  //cblas_dsymv(order,Uplo,N,alpha,A,lda,X,incX,beta,Y,incY);
530  dsymv_(cblas_uplo(Uplo),&N,&alpha,A,&lda,X,&incX,&beta,Y,&incY);
531 }
532 
533 
534 // Implementations of the INTTerfaces, BLAS Level 3
536 template <> inline void cblas_gemm<double>( CBLAS_ORDER order,
537  CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB,
538  INTT M, INTT N, INTT K, double alpha,
539  double *A, INTT lda, double *B, INTT ldb,
540  double beta, double *C, INTT ldc) {
541  //cblas_dgemm(Order,TransA,TransB,M,N,K,alpha,A,lda,B,ldb,beta,C,ldc);
542  dgemm_(cblas_transpose(TransA),cblas_transpose(TransB),&M,&N,&K,&alpha,A,&lda,B,&ldb,&beta,C,&ldc);
543 };
545 template <> inline void cblas_gemm<float>( CBLAS_ORDER order,
546  CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB,
547  INTT M, INTT N, INTT K, float alpha,
548  float *A, INTT lda, float *B, INTT ldb,
549  float beta, float *C, INTT ldc) {
550  //cblas_sgemm(Order,TransA,TransB,M,N,K,alpha,A,lda,B,ldb,beta,C,ldc);
551  sgemm_(cblas_transpose(TransA),cblas_transpose(TransB),&M,&N,&K,&alpha,A,&lda,B,&ldb,&beta,C,&ldc);
552 };
553 template <> inline void cblas_gemm<int>( CBLAS_ORDER order,
554  CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB,
555  INTT M, INTT N, INTT K, int alpha,
556  int *A, INTT lda, int *B, INTT ldb,
557  int beta, int *C, INTT ldc) {
559 };
561 template <> inline void cblas_gemm<bool>( CBLAS_ORDER order,
562  CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB,
563  INTT M, INTT N, INTT K, bool alpha,
564  bool *A, INTT lda, bool *B, INTT ldb,
565  bool beta, bool *C, INTT ldc) {
567 };
568 
570 template <> inline void cblas_syrk<double>( CBLAS_ORDER order,
571  CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K,
572  double alpha, double *A, INTT lda,
573  double beta, double *C, INTT ldc) {
574  //cblas_dsyrk(Order,Uplo,Trans,N,K,alpha,A,lda,beta,C,ldc);
575  dsyrk_(cblas_uplo(Uplo),cblas_transpose(Trans),&N,&K,&alpha,A,&lda,&beta,C,&ldc);
576 };
578 template <> inline void cblas_syrk<float>( CBLAS_ORDER order,
579  CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K,
580  float alpha, float *A, INTT lda,
581  float beta, float *C, INTT ldc) {
582  //cblas_ssyrk(Order,Uplo,Trans,N,K,alpha,A,lda,beta,C,ldc);
583  ssyrk_(cblas_uplo(Uplo),cblas_transpose(Trans),&N,&K,&alpha,A,&lda,&beta,C,&ldc);
584 };
586 template <> inline void cblas_syrk<int>( CBLAS_ORDER order,
587  CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K,
588  int alpha, int *A, INTT lda,
589  int beta, int *C, INTT ldc) {
591 };
593 template <> inline void cblas_syrk<bool>( CBLAS_ORDER order,
594  CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K,
595  bool alpha, bool *A, INTT lda,
596  bool beta, bool *C, INTT ldc) {
598 };
599 
601 template <> inline void cblas_trmm<double>( CBLAS_ORDER order,
602  CBLAS_SIDE Side, CBLAS_UPLO Uplo,
603  CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag,
604  INTT M, INTT N, double alpha,
605  double *A, INTT lda,double *B, INTT ldb) {
606  //cblas_dtrmm(Order,Side,Uplo,TransA,Diag,M,N,alpha,A,lda,B,ldb);
607  dtrmm_(cblas_side(Side),cblas_uplo(Uplo),cblas_transpose(TransA),cblas_diag(Diag),&M,&N,&alpha,A,&lda,B,&ldb);
608 };
610 template <> inline void cblas_trmm<float>( CBLAS_ORDER order,
611  CBLAS_SIDE Side, CBLAS_UPLO Uplo,
612  CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag,
613  INTT M, INTT N, float alpha,
614  float *A, INTT lda,float *B, INTT ldb) {
615  //cblas_strmm(Order,Side,Uplo,TransA,Diag,M,N,alpha,A,lda,B,ldb);
616  strmm_(cblas_side(Side),cblas_uplo(Uplo),cblas_transpose(TransA),cblas_diag(Diag),&M,&N,&alpha,A,&lda,B,&ldb);
617 };
619 template <> inline int cblas_iamax<double>( INTT n, double* X,
620  INTT incX) {
621  //return cblas_idamax(n,X,incX);
622  return static_cast<int>(idamax_(&n,X,&incX)-1);
623 };
625 template <> inline int cblas_iamax<float>( INTT n, float* X,
626  INTT incX) {
627  //return cblas_isamax(n,X,incX);
628  return static_cast<int>(isamax_(&n,X,&incX)-1);
629 };
630 
631 // Implementations of the interfaces, LAPACK
633 template <> inline void trtri<double>(char& uplo, char& diag,
634  INTT n, double * a, INTT lda) {
635  //dtrtri_(&uplo,&diag,&n,a,&lda,&info);
636  dtrtri_(&uplo,&diag,&n,a,&lda,&info);
637 };
639 template <> inline void trtri<float>(char& uplo, char& diag,
640  INTT n, float* a, INTT lda) {
641  //strtri_(&uplo,&diag,&n,a,&lda,&info);
642  strtri_(&uplo,&diag,&n,a,&lda,&info);
643 };
644 
646 template <> inline void sytri<double>(char& uplo, INTT n, double* a, INTT lda) {
647 //, INTT* ipiv, double* work) {
648  //dsytri_(&uplo,&n,a,&lda,ipiv,work,&info);
649  INTT lwork=-1;
650  INTT* ipiv= new INTT[n];
651  double* query, *work;
652  query = new double[1];
653  dsytrf_(&uplo,&n,a,&lda,ipiv,query,&lwork,&info);
654  lwork=static_cast<INTT>(*query);
655  delete[](query);
656  work = new double[static_cast<int>(lwork)];
657  dsytrf_(&uplo,&n,a,&lda,ipiv,work,&lwork,&info);
658  delete[](work);
659  work = new double[static_cast<int>(2*n)];
660  dsytri_(&uplo,&n,a,&lda,ipiv,work,&info);
661  delete[](work);
662  delete[](ipiv);
663 };
665 template <> inline void sytri<float>(char& uplo, INTT n, float* a, INTT lda) {
666  INTT lwork=-1;
667  INTT* ipiv= new INTT[n];
668  float* query, *work;
669  query = new float[1];
670  ssytrf_(&uplo,&n,a,&lda,ipiv,query,&lwork,&info);
671  lwork=static_cast<INTT>(*query);
672  delete[](query);
673  work = new float[static_cast<int>(lwork)];
674  ssytrf_(&uplo,&n,a,&lda,ipiv,work,&lwork,&info);
675  delete[](work);
676  work = new float[static_cast<int>(2*n)];
677  ssytri_(&uplo,&n,a,&lda,ipiv,work,&info);
678  delete[](work);
679  delete[](ipiv);
680 };
682 template <> inline void lasrt(char& id, INTT n, double *d) {
683  //dlasrt_(&id,const_cast<int*>(&n),d,&info);
684  dlasrt_(&id,&n,d,&info);
685 };
687 template <> inline void lasrt(char& id, INTT n, float *d) {
688  //slasrt_(&id,const_cast<int*>(&n),d,&info);
689  slasrt_(&id,&n,d,&info);
690 };
691 //template <> inline void lasrt2(char& id, INTT& n, double *d,int* key) {
692 // //dlasrt2_(&id,const_cast<int*>(&n),d,key,&info);
693 // dlasrt2(&id,&n,d,key,&info);
694 //};
696 //template <> inline void lasrt2(char& id, INTT& n, float *d, int* key) {
697 // //slasrt2_(&id,const_cast<int*>(&n),d,key,&info);
698 // slasrt2(&id,&n,d,key,&info);
699 //};
700 template <> void inline gesvd( char& jobu, char& jobvt, INTT m,
701  INTT n, double* a, INTT lda, double* s,
702  double* u, INTT ldu, double* vt, INTT ldvt) {
703  double* query = new double[1];
704  INTT lwork=-1;
705  dgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt,
706  query, &lwork, &info );
707  lwork=static_cast<INTT>(*query);
708  delete[](query);
709  double* work = new double[static_cast<int>(lwork)];
710  dgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt,
711  work, &lwork, &info );
712  delete[](work);
713 }
714 template <> void inline gesvd( char& jobu, char& jobvt, INTT m,
715  INTT n, float* a, INTT lda, float* s,
716  float* u, INTT ldu, float* vt, INTT ldvt) {
717  float* query = new float[1];
718  INTT lwork=-1;
719  sgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt,
720  query, &lwork, &info );
721  lwork=static_cast<INTT>(*query);
722  delete[](query);
723  float* work = new float[static_cast<int>(lwork)];
724  sgesvd_(&jobu, &jobvt, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt,
725  work, &lwork, &info );
726  delete[](work);
727 }
728 
729 template <> void inline syev( char& jobz, char& uplo, INTT n,
730  float* a, INTT lda, float* w) {
731  float* query = new float[1];
732  INTT lwork=-1;
733  ssyev_(&jobz,&uplo,&n,a,&lda,w,query,&lwork,&info);
734  lwork=static_cast<INTT>(*query);
735  delete[](query);
736  float* work = new float[static_cast<int>(lwork)];
737  ssyev_(&jobz,&uplo,&n,a,&lda,w,work,&lwork,&info);
738  delete[](work);
739 };
740 
741 template <> void inline syev( char& jobz, char& uplo, INTT n,
742  double* a, INTT lda, double* w) {
743  double* query = new double[1];
744  INTT lwork=-1;
745  dsyev_(&jobz,&uplo,&n,a,&lda,w,query,&lwork,&info);
746  lwork=static_cast<INTT>(*query);
747  delete[](query);
748  double* work = new double[static_cast<int>(lwork)];
749  dsyev_(&jobz,&uplo,&n,a,&lda,w,work,&lwork,&info);
750  delete[](work);
751 };
752 
753 
754 
755 
757 #ifdef HAVE_MKL
758 template <> inline void vSqr<double>( int n, double* vecIn,
760  double* vecOut) {
761  vdSqr(n,vecIn,vecOut);
762 };
764 template <> inline void vSqr<float>( int n, float* vecIn,
765  float* vecOut) {
766  vsSqr(n,vecIn,vecOut);
767 };
768 template <> inline void vSqrt<double>( int n, double* vecIn,
769  double* vecOut) {
770  vdSqrt(n,vecIn,vecOut);
771 };
773 template <> inline void vSqrt<float>( int n, float* vecIn,
774  float* vecOut) {
775  vsSqrt(n,vecIn,vecOut);
776 };
777 template <> inline void vInvSqrt<double>( int n, double* vecIn,
778  double* vecOut) {
779  vdInvSqrt(n,vecIn,vecOut);
780 };
782 template <> inline void vInvSqrt<float>( int n, float* vecIn,
783  float* vecOut) {
784  vsInvSqrt(n,vecIn,vecOut);
785 };
786 
788 template <> inline void vSub<double>( int n, double* vecIn,
789  double* vecIn2, double* vecOut) {
790  vdSub(n,vecIn,vecIn2,vecOut);
791 };
793 template <> inline void vSub<float>( int n, float* vecIn,
794  float* vecIn2, float* vecOut) {
795  vsSub(n,vecIn,vecIn2,vecOut);
796 };
798 template <> inline void vDiv<double>( int n, double* vecIn,
799  double* vecIn2, double* vecOut) {
800  vdDiv(n,vecIn,vecIn2,vecOut);
801 };
803 template <> inline void vDiv<float>( int n, float* vecIn,
804  float* vecIn2, float* vecOut) {
805  vsDiv(n,vecIn,vecIn2,vecOut);
806 };
808 template <> inline void vExp<double>( int n, double* vecIn,
809  double* vecOut) {
810  vdExp(n,vecIn,vecOut);
811 };
813 template <> inline void vExp<float>( int n, float* vecIn,
814  float* vecOut) {
815  vsExp(n,vecIn,vecOut);
816 };
818 template <> inline void vInv<double>( int n, double* vecIn,
819  double* vecOut) {
820  vdInv(n,vecIn,vecOut);
821 };
823 template <> inline void vInv<float>( int n, float* vecIn,
824  float* vecOut) {
825  vsInv(n,vecIn,vecOut);
826 };
828 template <> inline void vAdd<double>( int n, double* vecIn,
829  double* vecIn2, double* vecOut) {
830  vdAdd(n,vecIn,vecIn2,vecOut);
831 };
833 template <> inline void vAdd<float>( int n, float* vecIn,
834  float* vecIn2, float* vecOut) {
835  vsAdd(n,vecIn,vecIn2,vecOut);
836 };
838 template <> inline void vMul<double>( int n, double* vecIn,
839  double* vecIn2, double* vecOut) {
840  vdMul(n,vecIn,vecIn2,vecOut);
841 };
843 template <> inline void vMul<float>( int n, float* vecIn,
844  float* vecIn2, float* vecOut) {
845  vsMul(n,vecIn,vecIn2,vecOut);
846 };
847 
849 template <> inline void vAbs( int n, double* vecIn,
850  double* vecOut) {
851  vdAbs(n,vecIn,vecOut);
852 };
854 template <> inline void vAbs( int n, float* vecIn,
855  float* vecOut) {
856  vsAbs(n,vecIn,vecOut);
857 };
858 
859 
862 template <> inline int cblas_iamin<double>( int n, double* x,
863  int incx) {
864  return (int) cblas_idamin(n,x,incx);
865 };
868 template <> inline int cblas_iamin<float>( int n, float* x,
869  int incx) {
870  return (int) cblas_isamin(n,x,incx);
871 };
873 #else
874 template <typename T> inline void vSqr( int n, T* vecIn, T* vecOut) {
876  for (int i = 0; i<n; ++i) vecOut[i]=vecIn[i]*vecIn[i];
877 };
878 template <typename T> inline void vSqrt( int n, T* vecIn, T* vecOut) {
879  for (int i = 0; i<n; ++i) vecOut[i]=spams::sqr<T>(vecIn[i]);
880 };
881 template <typename T> inline void vInvSqrt( int n, T* vecIn, T* vecOut) {
882  for (int i = 0; i<n; ++i) vecOut[i]=T(1.0)/spams::sqr<T>(vecIn[i]);
883 };
884 
886 template <typename T> inline void vSub( int n, T* vecIn1,
887  T* vecIn2, T* vecOut) {
888  for (int i = 0; i<n; ++i) vecOut[i]=vecIn1[i]-vecIn2[i];
889 };
891 template <typename T> inline void vInv( int n, T* vecIn, T* vecOut) {
892  for (int i = 0; i<n; ++i) vecOut[i]=1.0/vecIn[i];
893 };
895 template <typename T> inline void vExp( int n, T* vecIn, T* vecOut) {
896  for (int i = 0; i<n; ++i) vecOut[i]=exp(vecIn[i]);
897 };
899 template <typename T> inline void vAdd( int n, T* vecIn1,
900  T* vecIn2, T* vecOut) {
901  for (int i = 0; i<n; ++i) vecOut[i]=vecIn1[i]+vecIn2[i];
902 };
904 template <typename T> inline void vMul( int n, T* vecIn1,
905  T* vecIn2, T* vecOut) {
906  for (int i = 0; i<n; ++i) vecOut[i]=vecIn1[i]*vecIn2[i];
907 };
909 template <typename T> inline void vDiv( int n, T* vecIn1,
910  T* vecIn2, T* vecOut) {
911  for (int i = 0; i<n; ++i) vecOut[i]=vecIn1[i]/vecIn2[i];
912 };
914 template <typename T> inline void vAbs( int n, T* vecIn,
915  T* vecOut) {
916  for (int i = 0; i<n; ++i) vecOut[i]=spams::abs<T>(vecIn[i]);
917 };
918 
920 template <typename T> int inline cblas_iamin(INTT n, T* X, INTT incX) {
921  int imin=0;
922  double min=fabs(X[0]);
923  for (int j = 1; j<n; j+=incX) {
924  double cur = fabs(X[j]);
925  if (cur < min) {
926  imin=j;
927  min = cur;
928  }
929  }
930  return imin;
931 }
932 #endif
933 
934 #endif
float cblas_nrm2< float >(INTT n, float *X, INTT incX)
Implementation of the INTTerface for cblas_snrm2.
void strtri_(char *uplo, char *diag, INTT *n, float *a, INTT *lda, INTT *info)
void cblas_trmv< double >(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT N, double *A, INTT lda, double *X, INTT incX)
Implementation of the INTTerface for cblas_dtrmv.
void cblas_trmm< double >(CBLAS_ORDER order, CBLAS_SIDE Side, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT M, INTT N, double alpha, double *A, INTT lda, double *B, INTT ldb)
Implementation of the INTTerface for cblas_dtrmm.
void vAbs(int n, T *vecIn, T *vecOut)
interface to v*Abs
static char upper
T cblas_nrm2(INTT n, T *X, INTT incX)
INTTerface to cblas_*nrm2.
bool cblas_dot< bool >(INTT n, bool *X, INTT incX, bool *Y, INTT incY)
Implementation of the INTTerface for cblas_sdot.
void vExp(int n, T *vecIn, T *vecOut)
interface to v*Exp
void cblas_axpy< int >(INTT n, int a, int *X, INTT incX, int *Y, INTT incY)
Implementation of the INTTerface for cblas_saxpy.
CBLAS_TRANSPOSE
Definition: utl_cblas.h:6
double dasum_(INTT *n, double *x, INTT *incX)
void dgesvd_(char *jobu, char *jobvt, INTT *m, INTT *n, double *a, INTT *lda, double *s, double *u, INTT *ldu, double *vt, INTT *ldvt, double *work, INTT *lwork, INTT *info)
void cblas_copy< bool >(INTT n, bool *X, INTT incX, bool *Y, INTT incY)
Implementation of the INTTerface for cblas_scopy.
void dtrmv_(char *uplo, char *trans, char *diag, INTT *n, double *a, INTT *lda, double *x, INTT *incx)
void ssyr_(char *uplo, INTT *n, float *alpha, float *x, INTT *incx, float *a, INTT *lda)
void cblas_syrk< float >(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K, float alpha, float *A, INTT lda, float beta, float *C, INTT ldc)
Implementation of the INTTerface for cblas_ssyrk.
void dscal_(INTT *n, double *a, double *x, INTT *incX)
static char allV
void cblas_scal< bool >(INTT n, bool a, bool *X, INTT incX)
Implementation of the INTTerface for cblas_sscal.
float sasum_(INTT *n, float *x, INTT *incX)
void vAdd(int n, T *vecIn, T *vecIn2, T *vecOut)
interface to v*Add
int cblas_iamax(INTT n, T *X, INTT incX)
interface to cblas_i*amax
void cblas_trmv< float >(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT N, float *A, INTT lda, float *X, INTT incX)
Implementation of the INTTerface for cblas_strmv.
vcl_size_t cblas_idamin(int n, double *X, int incX)
external functions
static INTT info
void dgemm_(char *transa, char *transb, INTT *m, INTT *n, INTT *k, double *alpha, double *a, INTT *lda, double *b, INTT *ldb, double *beta, double *c, INTT *ldc)
int cblas_iamax< double >(INTT n, double *X, INTT incX)
Implementation of the interface for cblas_idamax.
void cblas_ger(CBLAS_ORDER order, INTT M, INTT N, T alpha, T *X, INTT incX, T *Y, INTT incY, T *A, INTT lda)
INTTerface to cblas_*ger.
char * cblas_side(CBLAS_SIDE Side)
Definition: cblas_defvar.h:59
static char reduced
void dsyrk_(char *uplo, char *trans, INTT *n, INTT *k, double *alpha, double *a, INTT *lda, double *beta, double *c, INTT *ldc)
double ddot_(INTT *n, double *x, INTT *incX, double *y, INTT *incY)
void trtri(char &uplo, char &diag, INTT n, T *a, INTT lda)
interface to *trtri
void cblas_gemv< float >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, INTT M, INTT N, float alpha, float *A, INTT lda, float *X, INTT incX, float beta, float *Y, INTT incY)
Implementation of the INTTerface for cblas_sgemv.
void cblas_gemv< int >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, INTT M, INTT N, int alpha, int *A, INTT lda, int *X, INTT incX, int beta, int *Y, INTT incY)
Implementation of the INTTerface for cblas_sgemv.
static char lower
CBLAS_ORDER
Definition: utl_cblas.h:5
vcl_size_t cblas_isamin(int n, float *X, int incX)
void dsytri_(char *uplo, INTT *n, double *a, INTT *lda, INTT *ipiv, double *work, INTT *info)
void sgemv_(char *trans, INTT *m, INTT *n, float *alpha, float *a, INTT *lda, float *x, INTT *incx, float *beta, float *y, INTT *incy)
void cblas_ger< double >(CBLAS_ORDER order, INTT M, INTT N, double alpha, double *X, INTT incX, double *Y, INTT incY, double *A, INTT lda)
Implementation of the INTTerface for cblas_dger.
CBLAS_SIDE
Definition: utl_cblas.h:10
void cblas_axpy< float >(INTT n, float a, float *X, INTT incX, float *Y, INTT incY)
Implementation of the INTTerface for cblas_saxpy.
void sytri< float >(char &uplo, INTT n, float *a, INTT lda)
Implemenation of the interface for ssytri.
static char low
a few static variables for lapack
void gesvd(char &jobu, char &jobvt, INTT m, INTT n, T *a, INTT lda, T *s, T *u, INTT ldu, T *vt, INTT ldvt)
void vInvSqrt(int n, T *vecIn, T *vecOut)
interface to v*Sqr
char * cblas_transpose(CBLAS_TRANSPOSE TransA)
Definition: cblas_defvar.h:22
void cblas_copy< double >(INTT n, double *X, INTT incX, double *Y, INTT incY)
Implementation of the INTTerface for cblas_dcopy.
void cblas_trmm(CBLAS_ORDER order, CBLAS_SIDE Side, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT M, INTT N, T alpha, T *A, INTT lda, T *B, INTT ldb)
INTTerface to cblas_*trmm.
void ssytrf_(char *uplo, INTT *n, float *a, INTT *lda, INTT *ipiv, float *work, INTT *lwork, INTT *info)
void cblas_gemm< double >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB, INTT M, INTT N, INTT K, double alpha, double *A, INTT lda, double *B, INTT ldb, double beta, double *C, INTT ldc)
Implementation of the INTTerface for cblas_dgemm.
static char nonUnit
void ssyrk_(char *uplo, char *trans, INTT *n, INTT *k, float *alpha, float *a, INTT *lda, float *beta, float *c, INTT *ldc)
void dsyev_(char *jobz, char *uplo, INTT *n, double *a, INTT *lda, double *w, double *work, INTT *lwork, INTT *info)
const T & min(const T &a, const T &b)
Return the minimum between a and b.
Definition: utlCore.h:257
void slasrt_(char *id, INTT *n, float *d, INTT *info)
void cblas_syr(CBLAS_ORDER order, CBLAS_UPLO Uplo, INTT N, T alpha, T *X, INTT incX, T *A, INTT lda)
INTTerface to cblas_*syr.
void dsymv_(char *uplo, INTT *n, double *alpha, double *a, INTT *lda, double *x, INTT *incx, double *beta, double *y, INTT *incy)
INTT isamax_(INTT *n, float *dx, INTT *incx)
void cblas_gemm< int >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB, INTT M, INTT N, INTT K, int alpha, int *A, INTT lda, int *B, INTT ldb, int beta, int *C, INTT ldc)
void cblas_axpy< double >(INTT n, double a, double *X, INTT incX, double *Y, INTT incY)
Implementation of the INTTerface for cblas_daxpy.
void ssymv_(char *uplo, INTT *n, float *alpha, float *a, INTT *lda, float *x, INTT *incx, float *beta, float *y, INTT *incy)
void cblas_trmv(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT N, T *A, INTT lda, T *X, INTT incX)
INTTerface to cblas_*trmv.
void cblas_scal< double >(INTT n, double a, double *X, INTT incX)
Implementation of the INTTerface for cblas_dscal.
void syev(char &jobz, char &uplo, INTT n, T *a, INTT lda, T *w)
float sdot_(INTT *n, float *x, INTT *incX, float *y, INTT *incY)
void cblas_gemv(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, INTT M, INTT N, T alpha, T *A, INTT lda, T *X, INTT incX, T beta, T *Y, INTT incY)
INTTerface to cblas_*gemv.
double cblas_dot< double >(INTT n, double *X, INTT incX, double *Y, INTT incY)
Implementation of the INTTerface for cblas_ddot.
void cblas_symv(CBLAS_ORDER order, CBLAS_UPLO Uplo, INTT N, T alpha, T *A, INTT lda, T *X, INTT incX, T beta, T *Y, INTT incY)
INTTerface to cblas_*symv.
INTT idamax_(INTT *n, double *dx, INTT *incx)
void dger_(INTT *m, INTT *n, double *alpha, double *x, INTT *incx, double *y, INTT *incy, double *a, INTT *lda)
void sytri(char &uplo, INTT n, T *a, INTT lda)
interface to *sytri // call sytrf
void cblas_syrk< double >(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K, double alpha, double *A, INTT lda, double beta, double *C, INTT ldc)
Implementation of the INTTerface for cblas_dsyrk.
void vInv(int n, T *vecIn, T *vecOut)
interface to v*Inv
void cblas_gemm(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB, INTT M, INTT N, INTT K, T alpha, T *A, INTT lda, T *B, INTT ldb, T beta, T *C, INTT ldc)
INTTerface to cblas_*gemm.
void sytri< double >(char &uplo, INTT n, double *a, INTT lda)
Implemenation of the interface for dsytri.
static char all
void dtrmm_(char *side, char *uplo, char *transa, char *diag, INTT *m, INTT *n, double *alpha, double *a, INTT *lda, double *b, INTT *ldb)
void cblas_copy< float >(INTT n, float *X, INTT incX, float *Y, INTT incY)
Implementation of the INTTerface for cblas_scopy.
double dnrm2_(INTT *n, double *x, INTT *incX)
void dlasrt_(char *id, INTT *n, double *d, INTT *info)
void saxpy_(INTT *n, float *a, float *x, INTT *incX, float *y, INTT *incY)
void scopy_(INTT *n, float *x, INTT *incX, float *y, INTT *incY)
static char no
void cblas_axpy(INTT n, T a, T *X, INTT incX, T *Y, INTT incY)
INTTerface to cblas_*axpy.
void cblas_gemm< float >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB, INTT M, INTT N, INTT K, float alpha, float *A, INTT lda, float *B, INTT ldb, float beta, float *C, INTT ldc)
Implementation of the INTTerface for cblas_sgemm.
void cblas_copy(INTT n, T *X, INTT incX, T *Y, INTT incY)
INTTerface to cblas_*copy.
static char incr
void ssytri_(char *uplo, INTT *n, float *a, INTT *lda, INTT *ipiv, float *work, INTT *info)
float cblas_dot< float >(INTT n, float *X, INTT incX, float *Y, INTT incY)
Implementation of the INTTerface for cblas_sdot.
void vSqr(int n, T *vecIn, T *vecOut)
interface to v*Sqr
void trtri< double >(char &uplo, char &diag, INTT n, double *a, INTT lda)
Implemenation of the interface for dtrtri.
void dsytrf_(char *uplo, INTT *n, double *a, INTT *lda, INTT *ipiv, double *work, INTT *lwork, INTT *info)
void cblas_syrk< int >(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K, int alpha, int *A, INTT lda, int beta, int *C, INTT ldc)
Implementation of the INTTerface for cblas_ssyrk.
void sgemm_(char *transa, char *transb, INTT *m, INTT *n, INTT *k, float *alpha, float *a, INTT *lda, float *b, INTT *ldb, float *beta, float *c, INTT *ldc)
void cblas_scal< float >(INTT n, float a, float *X, INTT incX)
Implementation of the INTTerface for cblas_sscal.
T cblas_asum(INTT n, T *X, INTT incX)
INTTerface to cblas_*asum.
void sgesvd_(char *jobu, char *jobvt, INTT *m, INTT *n, float *a, INTT *lda, float *s, float *u, INTT *ldu, float *vt, INTT *ldvt, float *work, INTT *lwork, INTT *info)
void cblas_syrk(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K, T alpha, T *A, INTT lda, T beta, T *C, INTT ldc)
INTTerface to cblas_*syrk.
char * cblas_uplo(CBLAS_UPLO Uplo)
Definition: cblas_defvar.h:37
CBLAS_UPLO
Definition: utl_cblas.h:8
void strmv_(char *uplo, char *trans, char *diag, INTT *n, float *a, INTT *lda, float *x, INTT *incx)
void vDiv(int n, T *vecIn, T *vecIn2, T *vecOut)
interface to v*Div
int cblas_dot< int >(INTT n, int *X, INTT incX, int *Y, INTT incY)
void dsyr_(char *uplo, INTT *n, double *alpha, double *x, INTT *incx, double *a, INTT *lda)
void dtrtri_(char *uplo, char *diag, INTT *n, double *a, INTT *lda, INTT *info)
void vSqrt(int n, T *vecIn, T *vecOut)
interface to v*Sqr
void cblas_ger< float >(CBLAS_ORDER order, INTT M, INTT N, float alpha, float *X, INTT incX, float *Y, INTT incY, float *A, INTT lda)
Implementation of the INTTerface for cblas_sger.
void dcopy_(INTT *n, double *x, INTT *incX, double *y, INTT *incY)
void vSub(int n, T *vecIn, T *vecIn2, T *vecOut)
interface to v*Sub
CBLAS_DIAG
Definition: utl_cblas.h:9
void cblas_scal< int >(INTT n, int a, int *X, INTT incX)
Implementation of the INTTerface for cblas_sscal.
char * cblas_diag(CBLAS_DIAG Diag)
Definition: cblas_defvar.h:48
void cblas_copy< int >(INTT n, int *X, INTT incX, int *Y, INTT incY)
Implementation of the INTTerface for cblas_scopy.
void sger_(INTT *m, INTT *n, float *alpha, float *x, INTT *incx, float *y, INTT *incy, float *a, INTT *lda)
T cblas_dot(INTT n, T *X, INTT incX, T *Y, INTT incY)
INTTerface to cblas_*adot.
int INTT
double cblas_nrm2< double >(INTT n, double *X, INTT incX)
Implementation of the INTTerface for cblas_dnrm2.
void lasrt(char &id, INTT n, T *d)
interaface to *lasrt
void cblas_axpy< bool >(INTT n, bool a, bool *X, INTT incX, bool *Y, INTT incY)
Implementation of the INTTerface for cblas_saxpy.
void trtri< float >(char &uplo, char &diag, INTT n, float *a, INTT lda)
Implemenation of the interface for strtri.
void dgemv_(char *trans, INTT *m, INTT *n, double *alpha, double *a, INTT *lda, double *x, INTT *incx, double *beta, double *y, INTT *incy)
void cblas_scal(INTT n, T a, T *X, INTT incX)
INTTerface to cblas_*scal.
void cblas_trmm< float >(CBLAS_ORDER order, CBLAS_SIDE Side, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, INTT M, INTT N, float alpha, float *A, INTT lda, float *B, INTT ldb)
Implementation of the INTTerface for cblas_strmm.
void cblas_gemv< double >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, INTT M, INTT N, double alpha, double *A, INTT lda, double *X, INTT incX, double beta, double *Y, INTT incY)
Implementation of the INTTerface for cblas_dgemv.
void daxpy_(INTT *n, double *a, double *x, INTT *incX, double *y, INTT *incY)
void cblas_gemm< bool >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB, INTT M, INTT N, INTT K, bool alpha, bool *A, INTT lda, bool *B, INTT ldb, bool beta, bool *C, INTT ldc)
Implementation of the INTTerface for cblas_sgemm.
void ssyev_(char *jobz, char *uplo, INTT *n, float *a, INTT *lda, float *w, float *work, INTT *lwork, INTT *info)
int cblas_iamin(INTT n, T *X, INTT incX)
interface to cblas_i*amin
int cblas_iamax< float >(INTT n, float *X, INTT incX)
Implementation of the interface for cblas_isamax.
void vMul(int n, T *vecIn, T *vecIn2, T *vecOut)
interface to v*Mul
void cblas_syrk< bool >(CBLAS_ORDER order, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE Trans, INTT N, INTT K, bool alpha, bool *A, INTT lda, bool beta, bool *C, INTT ldc)
Implementation of the INTTerface for cblas_ssyrk.
void cblas_gemv< bool >(CBLAS_ORDER order, CBLAS_TRANSPOSE TransA, INTT M, INTT N, bool alpha, bool *A, INTT lda, bool *X, INTT incX, bool beta, bool *Y, INTT incY)
Implementation of the INTTerface for cblas_sgemv.
void sscal_(INTT *n, float *a, float *x, INTT *incX)
float snrm2_(INTT *n, float *x, INTT *incX)
void strmm_(char *side, char *uplo, char *transa, char *diag, INTT *m, INTT *n, float *alpha, float *a, INTT *lda, float *b, INTT *ldb)
static char decr
float cblas_asum< float >(INTT n, float *X, INTT incX)
Implementation of the INTTerface for cblas_sasum.
double cblas_asum< double >(INTT n, double *X, INTT incX)
Implementation of the INTTerface for cblas_dasum.