33 #ifndef MADNESS_LINALG_CBLAS_H__INCLUDED
34 #define MADNESS_LINALG_CBLAS_H__INCLUDED
50 #if defined(FORTRAN_LINKAGE_LC) || (defined(HAVE_INTEL_MKL) && defined(MKL_DIRECT_CALL))
52 # define F77_SGEMM sgemm
53 # define F77_DGEMM dgemm
54 # define F77_CGEMM cgemm
55 # define F77_ZGEMM zgemm
57 # define F77_SCGEMM scgemm
58 # define F77_DZGEMM dzgemm
60 # define F77_SGEMV sgemv
61 # define F77_DGEMV dgemv
62 # define F77_CGEMV cgemv
63 # define F77_ZGEMV zgemv
64 # define F77_SSCAL sscal
65 # define F77_DSCAL dscal
66 # define F77_CSCAL cscal
67 # define F77_ZSCAL zscal
68 # define F77_CSSCAL csscal
69 # define F77_ZDSCAL zdscal
70 # define F77_SDOT sdot
71 # define F77_DDOT ddot
72 # define F77_CDOTU cdotu
73 # define F77_ZDOTU zdotu
74 # define F77_SAXPY saxpy
75 # define F77_DAXPY daxpy
76 # define F77_CAXPY caxpy
77 # define F77_ZAXPY zaxpy
79 #elif defined(FORTRAN_LINKAGE_LCU)
81 # define F77_SGEMM sgemm_
82 # define F77_DGEMM dgemm_
83 # define F77_CGEMM cgemm_
84 # define F77_ZGEMM zgemm_
86 # define F77_SCGEMM scgemm_
87 # define F77_DZGEMM dzgemm_
89 # define F77_SGEMV sgemv_
90 # define F77_DGEMV dgemv_
91 # define F77_CGEMV cgemv_
92 # define F77_ZGEMV zgemv_
93 # define F77_SSCAL sscal_
94 # define F77_DSCAL dscal_
95 # define F77_CSCAL cscal_
96 # define F77_ZSCAL zscal_
97 # define F77_CSSCAL csscal_
98 # define F77_ZDSCAL zdscal_
99 # define F77_SDOT sdot_
100 # define F77_DDOT ddot_
101 # define F77_CDOTU cdotu_
102 # define F77_ZDOTU zdotu_
103 # define F77_SAXPY saxpy_
104 # define F77_DAXPY daxpy_
105 # define F77_CAXPY caxpy_
106 # define F77_ZAXPY zaxpy_
108 #elif defined(FORTRAN_LINKAGE_LCUU)
110 # define F77_SGEMM sgemm__
111 # define F77_DGEMM dgemm__
112 # define F77_CGEMM cgemm__
113 # define F77_ZGEMM zgemm__
114 #ifdef HAVE_INTEL_MKL
115 # define F77_SCGEMM scgemm__
116 # define F77_DZGEMM dzgemm__
118 # define F77_SGEMV sgemv__
119 # define F77_DGEMV dgemv__
120 # define F77_CGEMV cgemv__
121 # define F77_ZGEMV zgemv__
122 # define F77_SSCAL sscal__
123 # define F77_DSCAL dscal__
124 # define F77_CSCAL cscal__
125 # define F77_ZSCAL zscal__
126 # define F77_CSSCAL csscal__
127 # define F77_ZDSCAL zdscal__
128 # define F77_SDOT sdot__
129 # define F77_DDOT ddot__
130 # define F77_CDOTU cdotu__
131 # define F77_ZDOTU zdotu__
132 # define F77_SAXPY saxpy__
133 # define F77_DAXPY daxpy__
134 # define F77_CAXPY caxpy__
135 # define F77_ZAXPY zaxpy__
137 #elif defined(FORTRAN_LINKAGE_UC)
139 # define F77_SGEMM SGEMM
140 # define F77_DGEMM DGEMM
141 # define F77_CGEMM CGEMM
142 # define F77_ZGEMM ZGEMM
143 #ifdef HAVE_INTEL_MKL
144 # define F77_SCGEMM SCGEMM
145 # define F77_DZGEMM DZGEMM
147 # define F77_SGEMV SGEMV
148 # define F77_DGEMV DGEMV
149 # define F77_CGEMV CGEMV
150 # define F77_ZGEMV ZGEMV
151 # define F77_SSCAL SSCAL
152 # define F77_DSCAL DSCAL
153 # define F77_CSCAL CSCAL
154 # define F77_ZSCAL ZSCAL
155 # define F77_CSSCAL CSSCAL
156 # define F77_ZDSCAL ZDSCAL
157 # define F77_SDOT SDOTU
158 # define F77_DDOT DDOTU
159 # define F77_CDOTU CDOTU
160 # define F77_ZDOTU ZDOTU
161 # define F77_SAXPY SAXPY
162 # define F77_DAXPY DAXPY
163 # define F77_CAXPY CAXPY
164 # define F77_ZAXPY ZAXPY
166 #elif defined(FORTRAN_LINKAGE_UCU)
168 # define F77_SGEMM SGEMM_
169 # define F77_DGEMM DGEMM_
170 # define F77_CGEMM CGEMM_
171 # define F77_ZGEMM ZGEMM_
172 #ifdef HAVE_INTEL_MKL
173 # define F77_SCGEMM SCGEMM_
174 # define F77_DZGEMM DZGEMM_
176 # define F77_SGEMV SGEMV_
177 # define F77_DGEMV DGEMV_
178 # define F77_CGEMV CGEMV_
179 # define F77_ZGEMV ZGEMV_
180 # define F77_SSCAL SSCAL_
181 # define F77_DSCAL DSCAL_
182 # define F77_CSCAL CSCAL_
183 # define F77_ZSCAL ZSCAL_
184 # define F77_CSSCAL CSSCAL_
185 # define F77_ZDSCAL ZDSCAL_
186 # define F77_SDOT SDOT_
187 # define F77_DDOT DDOTSUB_
188 # define F77_CDOTU CDOTU_
189 # define F77_ZDOTU ZDOTU_
190 # define F77_SAXPY SAXPY_
191 # define F77_DAXPY DAXPY_
192 # define F77_CAXPY CAXPY_
193 # define F77_ZAXPY ZAXPY_
197 # error "cblas.h does not support the current Fortran symbol convention -- please, edit and check in the changes."
201 #if defined(FORTRAN_LINKAGE_LC)
202 # define F77_SGER sger
203 # define F77_DGER dger
204 # define F77_CGER cger
205 # define F77_ZGER zger
206 #elif defined(FORTRAN_LINKAGE_LCU)
207 # define F77_SGER sger_
208 # define F77_DGER dger_
209 # define F77_CGER cger_
210 # define F77_ZGER zger_
211 #elif defined(FORTRAN_LINKAGE_LCUU)
212 # define F77_SGER sger__
213 # define F77_DGER dger__
214 # define F77_CGER cger__
215 # define F77_ZGER zger__
216 #elif defined(FORTRAN_LINKAGE_UC)
217 # define F77_SGER SGER
218 # define F77_DGER DGER
219 # define F77_CGER CGER
220 # define F77_ZGER ZGER
221 #elif defined(FORTRAN_LINKAGE_UCU)
222 # define F77_SGER SGER_
223 # define F77_DGER DGER_
224 # define F77_CGER CGER_
225 # define F77_ZGER ZGER_
228 # error "cblas.h does not support the current Fortran symbol convention -- please, edit and check in the changes."
248 #ifndef MKL_DIRECT_CALL
255 const float*,
const integer*,
const float*,
float*,
const integer*);
258 const double*,
const integer*,
const double*,
double*,
const integer*);
268 #ifdef HAVE_INTEL_MKL
269 void F77_SCGEMM(
const char*,
const char*,
const integer*,
const integer*,
273 void F77_DZGEMM(
const char*,
const char*,
const integer*,
const integer*,
282 const float*,
float*,
const integer*);
285 const double*,
double*,
const integer*);
305 const double *,
const integer*);
359 static const char *
op[] = {
"n",
"t" };
360 F77_SGEMM(
op[OpA],
op[OpB], &
m, &n, &
k, &
alpha,
a, &lda,
b, &ldb, &
beta,
c, &ldc);
369 static const char *
op[] = {
"n",
"t" };
370 F77_DGEMM(
op[OpA],
op[OpB], &
m, &n, &
k, &
alpha,
a, &lda,
b, &ldb, &
beta,
c, &ldc);
378 static const char *
op[] = {
"n",
"t",
"c"};
389 static const char *
op[] = {
"n",
"t",
"c"};
395 #ifdef HAVE_INTEL_MKL
409 static const char *opT[] = {
"t",
"n",
"c" };
421 c[i*ldc+j] = ctrans[j*n+i];
428 c[i*ldc+j] =
beta*
c[i*ldc+j] + ctrans[j*n+i];
439 static const char *
op[] = {
"n",
"t",
"c"};
458 static const char *opT[] = {
"t",
"n",
"c" };
470 c[i*ldc+j] = ctrans[j*n+i];
477 c[i*ldc+j] =
beta*
c[i*ldc+j] + ctrans[j*n+i];
488 static const char *
op[] = {
"n",
"t",
"c"};
517 const float alpha,
const float *
A,
const integer lda,
const float *x,
521 static const char *
op[] = {
"n",
"t" };
522 F77_SGEMV(
op[OpA], &
m, &n, &
alpha,
A, &lda, x, &incx, &
beta, y, &incy);
526 const double alpha,
const double *
A,
const integer lda,
const double *x,
530 static const char *
op[] = {
"n",
"t" };
531 F77_DGEMV(
op[OpA], &
m, &n, &
alpha,
A, &lda, x, &incx, &
beta, y, &incy);
538 static const char *
op[] = {
"n",
"t",
"c"};
548 static const char *
op[] = {
"n",
"t",
"c"};
571 const float *x,
const integer incx,
const float *y,
const integer incy,
578 const double *x,
const integer incx,
const double *y,
const integer incy,
612 const float* y,
const integer incy)
614 return F77_SDOT(&n, x, &incx, y, &incy);
618 const double* y,
const integer incy)
620 return F77_DDOT(&n, x, &incx, y, &incy);
688 float* y,
const integer incy) {
693 double* y,
const integer incy) {
void F77_SGEMV(const char *, const integer *, const integer *, const float *, const float *, const integer *, const float *, const integer *, const float *, float *, const integer *)
float F77_SDOT(const integer *, const float *, const integer *, const float *, const integer *)
void F77_CAXPY(const integer *, const complex_real4 *, const complex_real4 *, const integer *, complex_real4 *, const integer *)
void F77_DGEMV(const char *, const integer *, const integer *, const double *, const double *, const integer *, const double *, const integer *, const double *, double *, const integer *)
void F77_SSCAL(const integer *, const float *, float *, const integer *)
void F77_SGEMM(const char *, const char *, const integer *, const integer *, const integer *, const float *, const float *, const integer *, const float *, const integer *, const float *, float *, const integer *)
void F77_ZGEMM(const char *, const char *, const integer *, const integer *, const integer *, const complex_real8 *, const complex_real8 *, const integer *, const complex_real8 *, const integer *, const complex_real8 *, complex_real8 *, const integer *)
void F77_ZGER(const integer *, const integer *, const complex_real8 *, const complex_real8 *, const integer *, const complex_real8 *, const integer *, complex_real8 *, const integer *)
void F77_DGEMM(const char *, const char *, const integer *, const integer *, const integer *, const double *, const double *, const integer *, const double *, const integer *, const double *, double *, const integer *)
void F77_ZDOTU(complex_real8 *, const integer *, const complex_real8 *, const integer *, const complex_real8 *, const integer *)
void F77_CDOTU(complex_real4 *, const integer *, const complex_real4 *, const integer *, const complex_real4 *, const integer *)
void F77_SGER(const integer *, const integer *, const float *, const float *, const integer *, const float *, const integer *, float *, const integer *)
void F77_ZSCAL(const integer *, const complex_real8 *, complex_real8 *, const integer *)
void F77_CSSCAL(const integer *, const float *, complex_real4 *, const integer *)
void F77_SAXPY(const integer *, const float *, const float *, const integer *, float *, const integer *)
void F77_DGER(const integer *, const integer *, const double *, const double *, const integer *, const double *, const integer *, double *, const integer *)
double F77_DDOT(const integer *, const double *, const integer *, const double *, const integer *)
void F77_ZDSCAL(const integer *, const double *, complex_real8 *, const integer *)
void F77_CGEMV(const char *, const integer *, const integer *, const complex_real4 *, const complex_real4 *, const integer *, const complex_real4 *, const integer *, const complex_real4 *, complex_real4 *, const integer *)
void F77_DAXPY(const integer *, const double *, const double *, const integer *, double *, const integer *)
void F77_ZAXPY(const integer *, const complex_real8 *, const complex_real8 *, const integer *, complex_real8 *, const integer *)
void F77_DSCAL(const integer *, const double *, double *, const integer *)
void F77_CSCAL(const integer *, const complex_real4 *, complex_real4 *, const integer *)
void F77_CGEMM(const char *, const char *, const integer *, const integer *, const integer *, const complex_real4 *, const complex_real4 *, const integer *, const complex_real4 *, const integer *, const complex_real4 *, complex_real4 *, const integer *)
void F77_CGER(const integer *, const integer *, const complex_real4 *, const complex_real4 *, const integer *, const complex_real4 *, const integer *, complex_real4 *, const integer *)
void F77_ZGEMV(const char *, const integer *, const integer *, const complex_real8 *, const complex_real8 *, const integer *, const complex_real8 *, const integer *, const complex_real8 *, complex_real8 *, const integer *)
Define types used by CBLAS API.
Definition: test_ar.cc:118
int integer
Definition: crayio.c:25
Correspondence between C++ and Fortran types.
std::complex< double > complex_real8
Fortran double complex.
Definition: fortran_ctypes.h:83
std::complex< float > complex_real4
Fortran single complex.
Definition: fortran_ctypes.h:88
double real8
Fortran double precision.
Definition: fortran_ctypes.h:73
float real4
Fortran single precision.
Definition: fortran_ctypes.h:78
const double m
Definition: gfit.cc:199
const double beta
Definition: gygi_soltion.cc:62
Tensor< double > op(const Tensor< double > &x)
Definition: kain.cc:508
Macros and tools pertaining to the configuration of MADNESS.
#define MADNESS_PRAGMA_CLANG(x)
Definition: madness_config.h:200
#define MADNESS_PRAGMA_GCC(x)
Definition: madness_config.h:205
Defines madness::MadnessException for exception handling.
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition: madness_exception.h:134
void gemv(const CBLAS_TRANSPOSE OpA, const integer m, const integer n, const float alpha, const float *A, const integer lda, const float *x, const integer incx, const float beta, float *y, const integer incy)
Multiplies a matrix by a vector.
Definition: cblas.h:516
void ger(const integer m, const integer n, const float alpha, const float *x, const integer incx, const float *y, const integer incy, float *A, const integer lda)
Multiplies vector by the transform of vector .
Definition: cblas.h:570
void scal(const integer n, const float alpha, float *x, const integer incx)
Scale a vector.
Definition: cblas.h:650
float dot(const integer n, const float *x, const integer incx, const float *y, const integer incy)
Compute the dot product of vectors and .
Definition: cblas.h:611
void axpy(const integer n, const float alpha, float *x, const integer incx, float *y, const integer incy)
Scale and add a vector to another.
Definition: cblas.h:687
void gemm(const CBLAS_TRANSPOSE OpA, const CBLAS_TRANSPOSE OpB, const integer m, const integer n, const integer k, const float alpha, const float *a, const integer lda, const float *b, const integer ldb, const float beta, float *c, const integer ldc)
Multiplies a matrix by a vector.
Definition: cblas.h:352
const blas_complex_float * to_cptr(const T *ptr)
Definition: cblas_types.h:86
const blas_complex_double * to_zptr(const T *ptr)
Definition: cblas_types.h:99
CBLAS_TRANSPOSE
Matrix operations for BLAS function calls.
Definition: cblas_types.h:77
@ ConjTrans
Definition: cblas_types.h:80
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
double pop(std::vector< double > &v)
Definition: timer.cc:11
static const double b
Definition: nonlinschro.cc:119
static const double a
Definition: nonlinschro.cc:118
static const double c
Definition: relops.cc:10
static const long k
Definition: rk.cc:44
const double alpha
Definition: test_coulomb.cc:54