33 #ifndef EIGEN_GENERAL_MATRIX_VECTOR_BLAS_H
34 #define EIGEN_GENERAL_MATRIX_VECTOR_BLAS_H
37 #include "../InternalHeaderCheck.h"
52 template <
typename Index,
typename LhsScalar,
int StorageOrder,
bool ConjugateLhs,
typename RhsScalar,
56 #define EIGEN_BLAS_GEMV_SPECIALIZE(Scalar) \
57 template <typename Index, bool ConjugateLhs, bool ConjugateRhs> \
58 struct general_matrix_vector_product<Index, Scalar, const_blas_data_mapper<Scalar, Index, ColMajor>, ColMajor, \
59 ConjugateLhs, Scalar, const_blas_data_mapper<Scalar, Index, RowMajor>, \
60 ConjugateRhs, Specialized> { \
61 static void run(Index rows, Index cols, const const_blas_data_mapper<Scalar, Index, ColMajor>& lhs, \
62 const const_blas_data_mapper<Scalar, Index, RowMajor>& rhs, Scalar* res, Index resIncr, \
65 general_matrix_vector_product<Index, Scalar, const_blas_data_mapper<Scalar, Index, ColMajor>, ColMajor, \
66 ConjugateLhs, Scalar, const_blas_data_mapper<Scalar, Index, RowMajor>, \
67 ConjugateRhs, BuiltIn>::run(rows, cols, lhs, rhs, res, resIncr, alpha); \
69 general_matrix_vector_product_gemv<Index, Scalar, ColMajor, ConjugateLhs, Scalar, ConjugateRhs>::run( \
70 rows, cols, lhs.data(), lhs.stride(), rhs.data(), rhs.stride(), res, resIncr, alpha); \
74 template <typename Index, bool ConjugateLhs, bool ConjugateRhs> \
75 struct general_matrix_vector_product<Index, Scalar, const_blas_data_mapper<Scalar, Index, RowMajor>, RowMajor, \
76 ConjugateLhs, Scalar, const_blas_data_mapper<Scalar, Index, ColMajor>, \
77 ConjugateRhs, Specialized> { \
78 static void run(Index rows, Index cols, const const_blas_data_mapper<Scalar, Index, RowMajor>& lhs, \
79 const const_blas_data_mapper<Scalar, Index, ColMajor>& rhs, Scalar* res, Index resIncr, \
81 general_matrix_vector_product_gemv<Index, Scalar, RowMajor, ConjugateLhs, Scalar, ConjugateRhs>::run( \
82 rows, cols, lhs.data(), lhs.stride(), rhs.data(), rhs.stride(), res, resIncr, alpha); \
91 #define EIGEN_BLAS_GEMV_SPECIALIZATION(EIGTYPE, BLASTYPE, BLASFUNC) \
92 template <typename Index, int LhsStorageOrder, bool ConjugateLhs, bool ConjugateRhs> \
93 struct general_matrix_vector_product_gemv<Index, EIGTYPE, LhsStorageOrder, ConjugateLhs, EIGTYPE, ConjugateRhs> { \
94 typedef Matrix<EIGTYPE, Dynamic, 1, ColMajor> GEMVVector; \
96 static void run(Index rows, Index cols, const EIGTYPE* lhs, Index lhsStride, const EIGTYPE* rhs, Index rhsIncr, \
97 EIGTYPE* res, Index resIncr, EIGTYPE alpha) { \
98 if (rows == 0 || cols == 0) return; \
99 BlasIndex m = convert_index<BlasIndex>(rows), n = convert_index<BlasIndex>(cols), \
100 lda = convert_index<BlasIndex>(lhsStride), incx = convert_index<BlasIndex>(rhsIncr), \
101 incy = convert_index<BlasIndex>(resIncr); \
102 const EIGTYPE beta(1); \
103 const EIGTYPE* x_ptr; \
104 char trans = (LhsStorageOrder == ColMajor) ? 'N' : (ConjugateLhs) ? 'C' : 'T'; \
105 if (LhsStorageOrder == RowMajor) { \
106 m = convert_index<BlasIndex>(cols); \
107 n = convert_index<BlasIndex>(rows); \
110 if (ConjugateRhs) { \
111 Map<const GEMVVector, 0, InnerStride<> > map_x(rhs, cols, 1, InnerStride<>(incx)); \
112 x_tmp = map_x.conjugate(); \
113 x_ptr = x_tmp.data(); \
118 BLASFUNC(&trans, &m, &n, (const BLASTYPE*)&numext::real_ref(alpha), (const BLASTYPE*)lhs, &lda, \
119 (const BLASTYPE*)x_ptr, &incx, (const BLASTYPE*)&numext::real_ref(beta), (BLASTYPE*)res, &incy); \
#define EIGEN_BLAS_GEMV_SPECIALIZE(Scalar)
Definition: GeneralMatrixVector_BLAS.h:56
#define EIGEN_BLAS_GEMV_SPECIALIZATION(EIGTYPE, BLASTYPE, BLASFUNC)
Definition: GeneralMatrixVector_BLAS.h:91
void dgemv_(const char *trans, int *m, int *n, double *alpha, double *A, int *LDA, double *x, int *incx, double *beta, double *y, int *incy)
This does matrix times vector and is from blas level 2.
int BLASFUNC() cgemv(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *)
int BLASFUNC() zgemv(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *)
int BLASFUNC() sgemv(char *, int *, int *, float *, float *, int *, float *, int *, float *, float *, int *)
int BLASFUNC() dgemv(char *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *)
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
std::complex< double > dcomplex
Definition: MKL_support.h:128
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
std::complex< float > scomplex
Definition: MKL_support.h:129
Definition: Eigen_Colamd.h:49
Definition: GeneralMatrixVector_BLAS.h:54