-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathcblas.cpp
More file actions
64 lines (53 loc) · 1.49 KB
/
cblas.cpp
File metadata and controls
64 lines (53 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* @file cblas.cpp
* @brief BLAS routines required by AMICI
*
**/
#include "amici/cblas.h"
#ifdef __APPLE__
#include <Accelerate/Accelerate.h>
#elif defined(AMICI_BLAS_MKL)
#include <mkl.h>
#else
extern "C" {
#include <cblas.h>
}
#endif
#ifndef BLAS_PREFIX
#define BLAS_PREFIX cblas_
#endif
#ifndef BLAS_SUFFIX
#define BLAS_SUFFIX
#endif
#define BLAS_CONCAT2(a, b, c) a##b##c
#define BLAS_CONCAT(a, b, c) BLAS_CONCAT2(a, b, c)
#define BLAS_FUNC(name) BLAS_CONCAT(BLAS_PREFIX, name, BLAS_SUFFIX)
namespace amici {
void amici_dgemm(
BLASLayout layout, BLASTranspose TransA, BLASTranspose TransB, int const M,
int const N, int const K, double const alpha, double const* A,
int const lda, double const* B, int const ldb, double const beta, double* C,
int const ldc
) {
BLAS_FUNC(dgemm)(
(CBLAS_ORDER)layout, (CBLAS_TRANSPOSE)TransA, (CBLAS_TRANSPOSE)TransB,
M, N, K, alpha, A, lda, B, ldb, beta, C, ldc
);
}
void amici_dgemv(
BLASLayout layout, BLASTranspose TransA, int const M, int const N,
double const alpha, double const* A, int const lda, double const* X,
int const incX, double const beta, double* Y, int const incY
) {
BLAS_FUNC(dgemv)(
(CBLAS_ORDER)layout, (CBLAS_TRANSPOSE)TransA, M, N, alpha, A, lda, X,
incX, beta, Y, incY
);
}
void amici_daxpy(
int const n, double const alpha, double const* x, int const incx, double* y,
int const incy
) {
BLAS_FUNC(daxpy)(n, alpha, x, incx, y, incy);
}
} // namespace amici