33 #ifndef EIGEN_GENERAL_MATRIX_VECTOR_BLAS_H
34 #define EIGEN_GENERAL_MATRIX_VECTOR_BLAS_H
36 #include "../InternalHeaderCheck.h"
51 template<
typename Index,
typename LhsScalar,
int StorageOrder,
bool ConjugateLhs,
typename RhsScalar,
bool ConjugateRhs>
52 struct general_matrix_vector_product_gemv;
54 #define EIGEN_BLAS_GEMV_SPECIALIZE(Scalar) \
55 template<typename Index, bool ConjugateLhs, bool ConjugateRhs> \
56 struct general_matrix_vector_product<Index,Scalar,const_blas_data_mapper<Scalar,Index,ColMajor>,ColMajor,ConjugateLhs,Scalar,const_blas_data_mapper<Scalar,Index,RowMajor>,ConjugateRhs,Specialized> { \
58 Index rows, Index cols, \
59 const const_blas_data_mapper<Scalar,Index,ColMajor> &lhs, \
60 const const_blas_data_mapper<Scalar,Index,RowMajor> &rhs, \
61 Scalar* res, Index resIncr, Scalar alpha) \
64 general_matrix_vector_product<Index,Scalar,const_blas_data_mapper<Scalar,Index,ColMajor>,ColMajor,ConjugateLhs,Scalar,const_blas_data_mapper<Scalar,Index,RowMajor>,ConjugateRhs,BuiltIn>::run( \
65 rows, cols, lhs, rhs, res, resIncr, alpha); \
67 general_matrix_vector_product_gemv<Index,Scalar,ColMajor,ConjugateLhs,Scalar,ConjugateRhs>::run( \
68 rows, cols, lhs.data(), lhs.stride(), rhs.data(), rhs.stride(), res, resIncr, alpha); \
72 template<typename Index, bool ConjugateLhs, bool ConjugateRhs> \
73 struct general_matrix_vector_product<Index,Scalar,const_blas_data_mapper<Scalar,Index,RowMajor>,RowMajor,ConjugateLhs,Scalar,const_blas_data_mapper<Scalar,Index,ColMajor>,ConjugateRhs,Specialized> { \
75 Index rows, Index cols, \
76 const const_blas_data_mapper<Scalar,Index,RowMajor> &lhs, \
77 const const_blas_data_mapper<Scalar,Index,ColMajor> &rhs, \
78 Scalar* res, Index resIncr, Scalar alpha) \
80 general_matrix_vector_product_gemv<Index,Scalar,RowMajor,ConjugateLhs,Scalar,ConjugateRhs>::run( \
81 rows, cols, lhs.data(), lhs.stride(), rhs.data(), rhs.stride(), res, resIncr, alpha); \
90 #define EIGEN_BLAS_GEMV_SPECIALIZATION(EIGTYPE,BLASTYPE,BLASFUNC) \
91 template<typename Index, int LhsStorageOrder, bool ConjugateLhs, bool ConjugateRhs> \
92 struct general_matrix_vector_product_gemv<Index,EIGTYPE,LhsStorageOrder,ConjugateLhs,EIGTYPE,ConjugateRhs> \
94 typedef Matrix<EIGTYPE,Dynamic,1,ColMajor> GEMVVector;\
97 Index rows, Index cols, \
98 const EIGTYPE* lhs, Index lhsStride, \
99 const EIGTYPE* rhs, Index rhsIncr, \
100 EIGTYPE* res, Index resIncr, EIGTYPE alpha) \
102 BlasIndex m=convert_index<BlasIndex>(rows), n=convert_index<BlasIndex>(cols), \
103 lda=convert_index<BlasIndex>(lhsStride), incx=convert_index<BlasIndex>(rhsIncr), incy=convert_index<BlasIndex>(resIncr); \
104 const EIGTYPE beta(1); \
105 const EIGTYPE *x_ptr; \
106 char trans=(LhsStorageOrder==ColMajor) ? 'N' : (ConjugateLhs) ? 'C' : 'T'; \
107 if (LhsStorageOrder==RowMajor) { \
108 m = convert_index<BlasIndex>(cols); \
109 n = convert_index<BlasIndex>(rows); \
112 if (ConjugateRhs) { \
113 Map<const GEMVVector, 0, InnerStride<> > map_x(rhs,cols,1,InnerStride<>(incx)); \
114 x_tmp=map_x.conjugate(); \
115 x_ptr=x_tmp.data(); \
118 BLASFUNC(&trans, &m, &n, (const BLASTYPE*)&numext::real_ref(alpha), (const BLASTYPE*)lhs, &lda, (const BLASTYPE*)x_ptr, &incx, (const BLASTYPE*)&numext::real_ref(beta), (BLASTYPE*)res, &incy); \
#define EIGEN_BLAS_GEMV_SPECIALIZE(Scalar)
#define EIGEN_BLAS_GEMV_SPECIALIZATION(EIGTYPE, BLASTYPE, BLASFUNC)
int BLASFUNC() cgemv(const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *)
int BLASFUNC() dgemv(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *)
int BLASFUNC() zgemv(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *)
int BLASFUNC() sgemv(const char *, const int *, const int *, const float *, const float *, const int *, const float *, const int *, const float *, float *, const int *)
std::complex< double > dcomplex
std::complex< float > scomplex