35#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_BLAS_HPP
36#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_BLAS_HPP
47 void F77NAME(
dcopy)(
const int &n,
const double *x,
const int &incx,
48 double *y,
const int &incy);
49 void F77NAME(
daxpy)(
const int &n,
const double &alpha,
const double *x,
50 const int &incx,
const double *y,
const int &incy);
51 void F77NAME(
dswap)(
const int &n,
double *x,
const int &incx,
double *y,
55 void F77NAME(
drot)(
const int &n,
double *x,
const int &incx,
double *y,
56 const int &incy,
const double &c,
const double &s);
57 double F77NAME(
ddot)(
const int &n,
const double *x,
const int &incx,
58 const double *y,
const int &incy);
59 double F77NAME(
dnrm2)(
const int &n,
const double *x,
const int &incx);
60 double F77NAME(
dasum)(
const int &n,
const double *x,
const int &incx);
65 const double &alpha,
const double *a,
const int &lda,
66 const double *x,
const int &incx,
const double &
beta,
67 double *y,
const int &incy);
69 const float &alpha,
const float *a,
const int &lda,
70 const float *x,
const int &incx,
const float &
beta,
71 float *y,
const int &incy);
74 const int &kl,
const int &ku,
const double &alpha,
75 const double *a,
const int &lda,
const double *x,
76 const int &incx,
const double &
beta,
double *y,
79 const int &kl,
const int &ku,
const float &alpha,
80 const float *a,
const int &lda,
const float *x,
81 const int &incx,
const float &
beta,
float *y,
84 void F77NAME(
dspmv)(
const char &uplo,
const int &n,
const double &alpha,
85 const double *a,
const double *x,
const int &incx,
86 const double &
beta,
double *y,
const int &incy);
87 void F77NAME(
sspmv)(
const char &uplo,
const int &n,
const float &alpha,
88 const float *a,
const float *x,
const int &incx,
89 const float &
beta,
float *y,
const int &incy);
92 const double &alpha,
const double *a,
const int &lda,
93 const double *x,
const int &incx,
const double &
beta,
94 double *y,
const int &incy);
96 const float &alpha,
const float *a,
const int &lda,
97 const float *x,
const int &incx,
const float &
beta,
98 float *y,
const int &incy);
100 void F77NAME(
dtpmv)(
const char &uplo,
const char &trans,
const char &diag,
101 const int &n,
const double *ap,
double *x,
103 void F77NAME(
stpmv)(
const char &uplo,
const char &trans,
const char &diag,
104 const int &n,
const float *ap,
float *x,
107 void F77NAME(
dger)(
const int &m,
const int &n,
const double &alpha,
108 const double *x,
const int &incx,
const double *y,
109 const int &incy,
double *a,
const int &lda);
110 void F77NAME(
sger)(
const int &m,
const int &n,
const float &alpha,
111 const float *x,
const int &incx,
const float *y,
112 const int &incy,
float *a,
const int &lda);
115 void F77NAME(
dgemm)(
const char &trans,
const char &transb,
const int &m1,
116 const int &n,
const int &k,
const double &alpha,
117 const double *a,
const int &lda,
const double *b,
118 const int &ldb,
const double &
beta,
double *c,
120 void F77NAME(
sgemm)(
const char &trans,
const char &transb,
const int &m1,
121 const int &n,
const int &k,
const float &alpha,
122 const float *a,
const int &lda,
const float *b,
123 const int &ldb,
const float &
beta,
float *c,
128static inline void Dcopy(
const int &n,
const double *x,
const int &incx,
129 double *y,
const int &incy)
135static inline void Daxpy(
const int &n,
const double &alpha,
const double *x,
136 const int &incx,
const double *y,
const int &incy)
142static inline void Dswap(
const int &n,
double *x,
const int &incx,
double *y,
149static inline void Dscal(
const int &n,
const double &alpha,
double *x,
156static inline void Drot(
const int &n,
double *x,
const int &incx,
double *y,
157 const int &incy,
const double &c,
const double &s)
163static inline double Ddot(
const int &n,
const double *x,
const int &incx,
164 const double *y,
const int &incy)
170static inline double Dnrm2(
const int &n,
const double *x,
const int &incx)
176static inline double Dasum(
const int &n,
const double *x,
const int &incx)
184static inline int Idamax(
const int &n,
const double *x,
const int &incx)
191static inline void Gemv(
const char &trans,
const int &m,
const int &n,
192 const double &alpha,
const double *a,
const int &lda,
193 const double *x,
const int &incx,
const double &
beta,
194 double *y,
const int &incy)
196 F77NAME(
dgemv)(trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
201static inline void Gemv(
const char &trans,
const int &m,
const int &n,
202 const float &alpha,
const float *a,
const int &lda,
203 const float *x,
const int &incx,
const float &
beta,
204 float *y,
const int &incy)
206 F77NAME(
sgemv)(trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
211static inline void Dgemv(
const char &trans,
const int &m,
const int &n,
212 const double &alpha,
const double *a,
const int &lda,
213 const double *x,
const int &incx,
const double &
beta,
214 double *y,
const int &incy)
216 F77NAME(
dgemv)(trans, m, n, alpha, a, lda, x, incx,
beta, y, incy);
221static inline void Gbmv(
const char &trans,
const int &m,
const int &n,
222 const int &kl,
const int &ku,
const double &alpha,
223 const double *a,
const int &lda,
const double *x,
224 const int &incx,
const double &
beta,
double *y,
227 F77NAME(
dgbmv)(trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
232static inline void Gbmv(
const char &trans,
const int &m,
const int &n,
233 const int &kl,
const int &ku,
const float &alpha,
234 const float *a,
const int &lda,
const float *x,
235 const int &incx,
const float &
beta,
float *y,
238 F77NAME(
sgbmv)(trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
243static inline void Dgbmv(
const char &trans,
const int &m,
const int &n,
244 const int &kl,
const int &ku,
const double &alpha,
245 const double *a,
const int &lda,
const double *x,
246 const int &incx,
const double &
beta,
double *y,
249 F77NAME(
dgbmv)(trans, m, n, kl, ku, alpha, a, lda, x, incx,
beta, y, incy);
254static inline void Spmv(
const char &uplo,
const int &n,
const double &alpha,
255 const double *a,
const double *x,
const int &incx,
256 const double &
beta,
double *y,
const int &incy)
263static inline void Spmv(
const char &uplo,
const int &n,
const float &alpha,
264 const float *a,
const float *x,
const int &incx,
265 const float &
beta,
float *y,
const int &incy)
272static inline void Dspmv(
const char &uplo,
const int &n,
const double &alpha,
273 const double *a,
const double *x,
const int &incx,
274 const double &
beta,
double *y,
const int &incy)
281static inline void Sbmv(
const char &uplo,
const int &m,
const int &k,
282 const double &alpha,
const double *a,
const int &lda,
283 const double *x,
const int &incx,
const double &
beta,
284 double *y,
const int &incy)
286 F77NAME(
dsbmv)(uplo, m, k, alpha, a, lda, x, incx,
beta, y, incy);
291static inline void Sbmv(
const char &uplo,
const int &m,
const int &k,
292 const float &alpha,
const float *a,
const int &lda,
293 const float *x,
const int &incx,
const float &
beta,
294 float *y,
const int &incy)
296 F77NAME(
ssbmv)(uplo, m, k, alpha, a, lda, x, incx,
beta, y, incy);
301static inline void Dsbmv(
const char &uplo,
const int &m,
const int &k,
302 const double &alpha,
const double *a,
const int &lda,
303 const double *x,
const int &incx,
const double &
beta,
304 double *y,
const int &incy)
306 F77NAME(
dsbmv)(uplo, m, k, alpha, a, lda, x, incx,
beta, y, incy);
310static inline void Tpmv(
const char &uplo,
const char &trans,
const char &diag,
311 const int &n,
const double *ap,
double *x,
318static inline void Tpmv(
const char &uplo,
const char &trans,
const char &diag,
319 const int &n,
const float *ap,
float *x,
326static inline void Dtpmv(
const char &uplo,
const char &trans,
const char &diag,
327 const int &n,
const double *ap,
double *x,
335static inline void Ger(
const int &m,
const int &n,
const double &alpha,
336 const double *x,
const int &incx,
const double *y,
337 const int &incy,
double *a,
const int &lda)
339 F77NAME(
dger)(m, n, alpha, x, incx, y, incy, a, lda);
344static inline void Ger(
const int &m,
const int &n,
const float &alpha,
345 const float *x,
const int &incx,
const float *y,
346 const int &incy,
float *a,
const int &lda)
348 F77NAME(
sger)(m, n, alpha, x, incx, y, incy, a, lda);
355static inline void Gemm(
const char &transa,
const char &transb,
const int &m,
356 const int &n,
const int &k,
const double &alpha,
357 const double *a,
const int &lda,
const double *b,
358 const int &ldb,
const double &
beta,
double *c,
362 (transa, transb, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc);
369static inline void Gemm(
const char &transa,
const char &transb,
const int &m,
370 const int &n,
const int &k,
const float &alpha,
371 const float *a,
const int &lda,
const float *b,
372 const int &ldb,
const float &
beta,
float *c,
376 (transa, transb, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc);
383static inline void Dgemm(
const char &transa,
const char &transb,
const int &m,
384 const int &n,
const int &k,
const double &alpha,
385 const double *a,
const int &lda,
const double *b,
386 const int &ldb,
const double &
beta,
double *c,
390 (transa, transb, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc);
395static inline void Cdgemm(
const int M,
const int N,
const int K,
const double a,
396 const double *
A, [[maybe_unused]]
const int ldA,
397 const double *B, [[maybe_unused]]
const int ldB,
398 const double b,
double *C,
399 [[maybe_unused]]
const int ldC)
401 Dgemm(
'N',
'N', N, M, K, a, B, N,
A, K, b, C, N);
#define F77NAME(x)
Fortran routines need an underscore.
int F77NAME() idamax(const int &n, const double *x, const int &incx)
static void Dgemv(const char &trans, 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)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n].
static void Dgbmv(const char &trans, const int &m, const int &n, const int &kl, const int &ku, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n] is banded.
static void Dswap(const int &n, double *x, const int &incx, double *y, const int &incy)
BLAS level 1: Swap x with y.
static void Drot(const int &n, double *x, const int &incx, double *y, const int &incy, const double &c, const double &s)
BLAS level 1: Plane rotation by c = cos(theta), s = sin(theta)
void F77NAME() daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
static void Sbmv(const char &uplo, const int &m, const int &k, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x m] is symmetric banded.
void F77NAME() dswap(const int &n, double *x, const int &incx, double *y, const int &incy)
void F77NAME() drot(const int &n, double *x, const int &incx, double *y, const int &incy, const double &c, const double &s)
static void Gemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
double F77NAME() dasum(const int &n, const double *x, const int &incx)
void F77NAME() dtpmv(const char &uplo, const char &trans, const char &diag, const int &n, const double *ap, double *x, const int &incx)
void F77NAME() stpmv(const char &uplo, const char &trans, const char &diag, const int &n, const float *ap, float *x, const int &incx)
static void Gemv(const char &trans, 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)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n].
static double Dasum(const int &n, const double *x, const int &incx)
BLAS level 1: output = .
void F77NAME() dspmv(const char &uplo, const int &n, const double &alpha, const double *a, const double *x, const int &incx, const double &beta, double *y, const int &incy)
void F77NAME() dscal(const int &n, const double &alpha, double *x, const int &incx)
double F77NAME() ddot(const int &n, const double *x, const int &incx, const double *y, const int &incy)
static void Gbmv(const char &trans, const int &m, const int &n, const int &kl, const int &ku, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n] is banded.
static void Dsbmv(const char &uplo, const int &m, const int &k, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x m] is symmetric banded.
static int Idamax(const int &n, const double *x, const int &incx)
BLAS level 1: output = 1st value where Note it is modified to return a value between (0,...
void F77NAME() ssbmv(const char &uplo, const int &m, const int &k, const float &alpha, const float *a, const int &lda, const float *x, const int &incx, const float &beta, float *y, const int &incy)
static void Dcopy(const int &n, const double *x, const int &incx, double *y, const int &incy)
BLAS level 1: Copy x to y.
void F77NAME() dsbmv(const char &uplo, const int &m, const int &k, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
void F77NAME() sspmv(const char &uplo, const int &n, const float &alpha, const float *a, const float *x, const int &incx, const float &beta, float *y, const int &incy)
void F77NAME() sgbmv(const char &trans, const int &m, const int &n, const int &kl, const int &ku, const float &alpha, const float *a, const int &lda, const float *x, const int &incx, const float &beta, float *y, const int &incy)
static double Dnrm2(const int &n, const double *x, const int &incx)
void F77NAME() dcopy(const int &n, const double *x, const int &incx, double *y, const int &incy)
void F77NAME() sger(const int &m, const int &n, const float &alpha, const float *x, const int &incx, const float *y, const int &incy, float *a, const int &lda)
void F77NAME() sgemv(const char &trans, 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 F77NAME() dgbmv(const char &trans, const int &m, const int &n, const int &kl, const int &ku, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
void F77NAME() dgemm(const char &trans, const char &transb, const int &m1, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
void F77NAME() dgemv(const char &trans, 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)
static double Ddot(const int &n, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: output = .
static void Cdgemm(const int M, const int N, const int K, const double a, const double *A, const int ldA, const double *B, const int ldB, const double b, double *C, const int ldC)
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
void F77NAME() sgemm(const char &trans, const char &transb, const int &m1, const int &n, const int &k, const float &alpha, const float *a, const int &lda, const float *b, const int &ldb, const float &beta, float *c, const int &ldc)
double F77NAME() dnrm2(const int &n, const double *x, const int &incx)
static void Tpmv(const char &uplo, const char &trans, const char &diag, const int &n, const double *ap, double *x, const int &incx)
BLAS level 2: Matrix vector multiply x = alpha A x where A[n x n].
static void Dspmv(const char &uplo, const int &n, const double &alpha, const double *a, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[n x n] is symmetric packed.
void F77NAME() dger(const int &m, const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy, double *a, const int &lda)
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
static void Ger(const int &m, const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy, double *a, const int &lda)
BLAS level 2: Matrix vector multiply A = alpha*x*y**T + A where A[m x n].
static void Spmv(const char &uplo, const int &n, const double &alpha, const double *a, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[n x n] is symmetric packed.
static void Dtpmv(const char &uplo, const char &trans, const char &diag, const int &n, const double *ap, double *x, const int &incx)
BLAS level 2: Matrix vector multiply x = alpha A x where A[n x n].
@ beta
Gauss Radau pinned at x=-1,.