33#ifndef EIGEN_SELFADJOINT_MATRIX_MATRIX_BLAS_H
34#define EIGEN_SELFADJOINT_MATRIX_MATRIX_BLAS_H
43#define EIGEN_BLAS_SYMM_L(EIGTYPE, BLASTYPE, EIGPREFIX, BLASPREFIX) \
44template <typename Index, \
45 int LhsStorageOrder, bool ConjugateLhs, \
46 int RhsStorageOrder, bool ConjugateRhs> \
47struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,true,ConjugateLhs,RhsStorageOrder,false,ConjugateRhs,ColMajor> \
51 Index rows, Index cols, \
52 const EIGTYPE* _lhs, Index lhsStride, \
53 const EIGTYPE* _rhs, Index rhsStride, \
54 EIGTYPE* res, Index resStride, \
55 EIGTYPE alpha, level3_blocking<EIGTYPE, EIGTYPE>& ) \
57 char side='L', uplo='L'; \
58 BlasIndex m, n, lda, ldb, ldc; \
59 const EIGTYPE *a, *b; \
61 MatrixX##EIGPREFIX b_tmp; \
65 m = convert_index<BlasIndex>(rows); \
66 n = convert_index<BlasIndex>(cols); \
69 lda = convert_index<BlasIndex>(lhsStride); \
70 ldb = convert_index<BlasIndex>(rhsStride); \
71 ldc = convert_index<BlasIndex>(resStride); \
74 if (LhsStorageOrder==RowMajor) uplo='U'; \
77 if (RhsStorageOrder==RowMajor) { \
78 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \
79 b_tmp = rhs.adjoint(); \
81 ldb = convert_index<BlasIndex>(b_tmp.outerStride()); \
84 BLASPREFIX##symm_(&side, &uplo, &m, &n, &numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (const BLASTYPE*)b, &ldb, &numext::real_ref(beta), (BLASTYPE*)res, &ldc); \
90#define EIGEN_BLAS_HEMM_L(EIGTYPE, BLASTYPE, EIGPREFIX, BLASPREFIX) \
91template <typename Index, \
92 int LhsStorageOrder, bool ConjugateLhs, \
93 int RhsStorageOrder, bool ConjugateRhs> \
94struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,true,ConjugateLhs,RhsStorageOrder,false,ConjugateRhs,ColMajor> \
97 Index rows, Index cols, \
98 const EIGTYPE* _lhs, Index lhsStride, \
99 const EIGTYPE* _rhs, Index rhsStride, \
100 EIGTYPE* res, Index resStride, \
101 EIGTYPE alpha, level3_blocking<EIGTYPE, EIGTYPE>& ) \
103 char side='L', uplo='L'; \
104 BlasIndex m, n, lda, ldb, ldc; \
105 const EIGTYPE *a, *b; \
107 MatrixX##EIGPREFIX b_tmp; \
108 Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder> a_tmp; \
112 m = convert_index<BlasIndex>(rows); \
113 n = convert_index<BlasIndex>(cols); \
116 lda = convert_index<BlasIndex>(lhsStride); \
117 ldb = convert_index<BlasIndex>(rhsStride); \
118 ldc = convert_index<BlasIndex>(resStride); \
121 if (((LhsStorageOrder==ColMajor) && ConjugateLhs) || ((LhsStorageOrder==RowMajor) && (!ConjugateLhs))) { \
122 Map<const Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder>, 0, OuterStride<> > lhs(_lhs,m,m,OuterStride<>(lhsStride)); \
123 a_tmp = lhs.conjugate(); \
125 lda = convert_index<BlasIndex>(a_tmp.outerStride()); \
127 if (LhsStorageOrder==RowMajor) uplo='U'; \
129 if (RhsStorageOrder==ColMajor && (!ConjugateRhs)) { \
132 if (RhsStorageOrder==ColMajor && ConjugateRhs) { \
133 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,m,n,OuterStride<>(rhsStride)); \
134 b_tmp = rhs.conjugate(); \
136 if (ConjugateRhs) { \
137 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \
138 b_tmp = rhs.adjoint(); \
140 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \
141 b_tmp = rhs.transpose(); \
144 ldb = convert_index<BlasIndex>(b_tmp.outerStride()); \
147 BLASPREFIX##hemm_(&side, &uplo, &m, &n, &numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (const BLASTYPE*)b, &ldb, &numext::real_ref(beta), (BLASTYPE*)res, &ldc); \
152EIGEN_BLAS_SYMM_L(
double,
double, d, d)
153EIGEN_BLAS_SYMM_L(
float,
float, f, s)
154EIGEN_BLAS_HEMM_L(dcomplex,
double, cd, z)
155EIGEN_BLAS_HEMM_L(scomplex,
float, cf, c)
160#define EIGEN_BLAS_SYMM_R(EIGTYPE, BLASTYPE, EIGPREFIX, BLASPREFIX) \
161template <typename Index, \
162 int LhsStorageOrder, bool ConjugateLhs, \
163 int RhsStorageOrder, bool ConjugateRhs> \
164struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,false,ConjugateLhs,RhsStorageOrder,true,ConjugateRhs,ColMajor> \
168 Index rows, Index cols, \
169 const EIGTYPE* _lhs, Index lhsStride, \
170 const EIGTYPE* _rhs, Index rhsStride, \
171 EIGTYPE* res, Index resStride, \
172 EIGTYPE alpha, level3_blocking<EIGTYPE, EIGTYPE>& ) \
174 char side='R', uplo='L'; \
175 BlasIndex m, n, lda, ldb, ldc; \
176 const EIGTYPE *a, *b; \
178 MatrixX##EIGPREFIX b_tmp; \
181 m = convert_index<BlasIndex>(rows); \
182 n = convert_index<BlasIndex>(cols); \
185 lda = convert_index<BlasIndex>(rhsStride); \
186 ldb = convert_index<BlasIndex>(lhsStride); \
187 ldc = convert_index<BlasIndex>(resStride); \
190 if (RhsStorageOrder==RowMajor) uplo='U'; \
193 if (LhsStorageOrder==RowMajor) { \
194 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(rhsStride)); \
195 b_tmp = lhs.adjoint(); \
197 ldb = convert_index<BlasIndex>(b_tmp.outerStride()); \
200 BLASPREFIX##symm_(&side, &uplo, &m, &n, &numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (const BLASTYPE*)b, &ldb, &numext::real_ref(beta), (BLASTYPE*)res, &ldc); \
206#define EIGEN_BLAS_HEMM_R(EIGTYPE, BLASTYPE, EIGPREFIX, BLASPREFIX) \
207template <typename Index, \
208 int LhsStorageOrder, bool ConjugateLhs, \
209 int RhsStorageOrder, bool ConjugateRhs> \
210struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,false,ConjugateLhs,RhsStorageOrder,true,ConjugateRhs,ColMajor> \
213 Index rows, Index cols, \
214 const EIGTYPE* _lhs, Index lhsStride, \
215 const EIGTYPE* _rhs, Index rhsStride, \
216 EIGTYPE* res, Index resStride, \
217 EIGTYPE alpha, level3_blocking<EIGTYPE, EIGTYPE>& ) \
219 char side='R', uplo='L'; \
220 BlasIndex m, n, lda, ldb, ldc; \
221 const EIGTYPE *a, *b; \
223 MatrixX##EIGPREFIX b_tmp; \
224 Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder> a_tmp; \
227 m = convert_index<BlasIndex>(rows); \
228 n = convert_index<BlasIndex>(cols); \
231 lda = convert_index<BlasIndex>(rhsStride); \
232 ldb = convert_index<BlasIndex>(lhsStride); \
233 ldc = convert_index<BlasIndex>(resStride); \
236 if (((RhsStorageOrder==ColMajor) && ConjugateRhs) || ((RhsStorageOrder==RowMajor) && (!ConjugateRhs))) { \
237 Map<const Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder>, 0, OuterStride<> > rhs(_rhs,n,n,OuterStride<>(rhsStride)); \
238 a_tmp = rhs.conjugate(); \
240 lda = convert_index<BlasIndex>(a_tmp.outerStride()); \
242 if (RhsStorageOrder==RowMajor) uplo='U'; \
244 if (LhsStorageOrder==ColMajor && (!ConjugateLhs)) { \
247 if (LhsStorageOrder==ColMajor && ConjugateLhs) { \
248 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,m,n,OuterStride<>(lhsStride)); \
249 b_tmp = lhs.conjugate(); \
251 if (ConjugateLhs) { \
252 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(lhsStride)); \
253 b_tmp = lhs.adjoint(); \
255 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(lhsStride)); \
256 b_tmp = lhs.transpose(); \
259 ldb = convert_index<BlasIndex>(b_tmp.outerStride()); \
262 BLASPREFIX##hemm_(&side, &uplo, &m, &n, &numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (const BLASTYPE*)b, &ldb, &numext::real_ref(beta), (BLASTYPE*)res, &ldc); \
266EIGEN_BLAS_SYMM_R(
double,
double, d, d)
267EIGEN_BLAS_SYMM_R(
float,
float, f, s)
268EIGEN_BLAS_HEMM_R(dcomplex,
double, cd, z)
269EIGEN_BLAS_HEMM_R(scomplex,
float, cf, c)
Namespace containing all symbols from the Eigen library.
Definition: Core:287