33 #ifndef EIGEN_SELFADJOINT_MATRIX_MATRIX_MKL_H 34 #define EIGEN_SELFADJOINT_MATRIX_MATRIX_MKL_H 43 #define EIGEN_MKL_SYMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \ 44 template <typename Index, \ 45 int LhsStorageOrder, bool ConjugateLhs, \ 46 int RhsStorageOrder, bool ConjugateRhs> \ 47 struct 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, \ 57 char side='L', uplo='L'; \ 58 MKL_INT m, n, lda, ldb, ldc; \ 59 const EIGTYPE *a, *b; \ 60 MKLTYPE alpha_, beta_; \ 61 MatrixX##EIGPREFIX b_tmp; \ 70 assign_scalar_eig2mkl(alpha_, alpha); \ 71 assign_scalar_eig2mkl(beta_, myone); \ 74 lda = (MKL_INT)lhsStride; \ 75 ldb = (MKL_INT)rhsStride; \ 76 ldc = (MKL_INT)resStride; \ 79 if (LhsStorageOrder==RowMajor) uplo='U'; \ 82 if (RhsStorageOrder==RowMajor) { \ 83 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \ 84 b_tmp = rhs.adjoint(); \ 86 ldb = b_tmp.outerStride(); \ 89 MKLPREFIX##symm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \ 95 #define EIGEN_MKL_HEMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \ 96 template <typename Index, \ 97 int LhsStorageOrder, bool ConjugateLhs, \ 98 int RhsStorageOrder, bool ConjugateRhs> \ 99 struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,true,ConjugateLhs,RhsStorageOrder,false,ConjugateRhs,ColMajor> \ 102 Index rows, Index cols, \ 103 const EIGTYPE* _lhs, Index lhsStride, \ 104 const EIGTYPE* _rhs, Index rhsStride, \ 105 EIGTYPE* res, Index resStride, \ 108 char side='L', uplo='L'; \ 109 MKL_INT m, n, lda, ldb, ldc; \ 110 const EIGTYPE *a, *b; \ 111 MKLTYPE alpha_, beta_; \ 112 MatrixX##EIGPREFIX b_tmp; \ 113 Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder> a_tmp; \ 122 assign_scalar_eig2mkl(alpha_, alpha); \ 123 assign_scalar_eig2mkl(beta_, myone); \ 126 lda = (MKL_INT)lhsStride; \ 127 ldb = (MKL_INT)rhsStride; \ 128 ldc = (MKL_INT)resStride; \ 131 if (((LhsStorageOrder==ColMajor) && ConjugateLhs) || ((LhsStorageOrder==RowMajor) && (!ConjugateLhs))) { \ 132 Map<const Matrix<EIGTYPE, Dynamic, Dynamic, LhsStorageOrder>, 0, OuterStride<> > lhs(_lhs,m,m,OuterStride<>(lhsStride)); \ 133 a_tmp = lhs.conjugate(); \ 135 lda = a_tmp.outerStride(); \ 137 if (LhsStorageOrder==RowMajor) uplo='U'; \ 139 if (RhsStorageOrder==ColMajor && (!ConjugateRhs)) { \ 142 if (RhsStorageOrder==ColMajor && ConjugateRhs) { \ 143 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,m,n,OuterStride<>(rhsStride)); \ 144 b_tmp = rhs.conjugate(); \ 146 if (ConjugateRhs) { \ 147 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \ 148 b_tmp = rhs.adjoint(); \ 150 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > rhs(_rhs,n,m,OuterStride<>(rhsStride)); \ 151 b_tmp = rhs.transpose(); \ 154 ldb = b_tmp.outerStride(); \ 157 MKLPREFIX##hemm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \ 170 #define EIGEN_MKL_SYMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \ 171 template <typename Index, \ 172 int LhsStorageOrder, bool ConjugateLhs, \ 173 int RhsStorageOrder, bool ConjugateRhs> \ 174 struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,false,ConjugateLhs,RhsStorageOrder,true,ConjugateRhs,ColMajor> \ 178 Index rows, Index cols, \ 179 const EIGTYPE* _lhs, Index lhsStride, \ 180 const EIGTYPE* _rhs, Index rhsStride, \ 181 EIGTYPE* res, Index resStride, \ 184 char side='R', uplo='L'; \ 185 MKL_INT m, n, lda, ldb, ldc; \ 186 const EIGTYPE *a, *b; \ 187 MKLTYPE alpha_, beta_; \ 188 MatrixX##EIGPREFIX b_tmp; \ 196 assign_scalar_eig2mkl(alpha_, alpha); \ 197 assign_scalar_eig2mkl(beta_, myone); \ 200 lda = (MKL_INT)rhsStride; \ 201 ldb = (MKL_INT)lhsStride; \ 202 ldc = (MKL_INT)resStride; \ 205 if (RhsStorageOrder==RowMajor) uplo='U'; \ 208 if (LhsStorageOrder==RowMajor) { \ 209 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(rhsStride)); \ 210 b_tmp = lhs.adjoint(); \ 212 ldb = b_tmp.outerStride(); \ 215 MKLPREFIX##symm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \ 221 #define EIGEN_MKL_HEMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX) \ 222 template <typename Index, \ 223 int LhsStorageOrder, bool ConjugateLhs, \ 224 int RhsStorageOrder, bool ConjugateRhs> \ 225 struct product_selfadjoint_matrix<EIGTYPE,Index,LhsStorageOrder,false,ConjugateLhs,RhsStorageOrder,true,ConjugateRhs,ColMajor> \ 228 Index rows, Index cols, \ 229 const EIGTYPE* _lhs, Index lhsStride, \ 230 const EIGTYPE* _rhs, Index rhsStride, \ 231 EIGTYPE* res, Index resStride, \ 234 char side='R', uplo='L'; \ 235 MKL_INT m, n, lda, ldb, ldc; \ 236 const EIGTYPE *a, *b; \ 237 MKLTYPE alpha_, beta_; \ 238 MatrixX##EIGPREFIX b_tmp; \ 239 Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder> a_tmp; \ 247 assign_scalar_eig2mkl(alpha_, alpha); \ 248 assign_scalar_eig2mkl(beta_, myone); \ 251 lda = (MKL_INT)rhsStride; \ 252 ldb = (MKL_INT)lhsStride; \ 253 ldc = (MKL_INT)resStride; \ 256 if (((RhsStorageOrder==ColMajor) && ConjugateRhs) || ((RhsStorageOrder==RowMajor) && (!ConjugateRhs))) { \ 257 Map<const Matrix<EIGTYPE, Dynamic, Dynamic, RhsStorageOrder>, 0, OuterStride<> > rhs(_rhs,n,n,OuterStride<>(rhsStride)); \ 258 a_tmp = rhs.conjugate(); \ 260 lda = a_tmp.outerStride(); \ 262 if (RhsStorageOrder==RowMajor) uplo='U'; \ 264 if (LhsStorageOrder==ColMajor && (!ConjugateLhs)) { \ 267 if (LhsStorageOrder==ColMajor && ConjugateLhs) { \ 268 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,m,n,OuterStride<>(lhsStride)); \ 269 b_tmp = lhs.conjugate(); \ 271 if (ConjugateLhs) { \ 272 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(lhsStride)); \ 273 b_tmp = lhs.adjoint(); \ 275 Map<const MatrixX##EIGPREFIX, 0, OuterStride<> > lhs(_lhs,n,m,OuterStride<>(lhsStride)); \ 276 b_tmp = lhs.transpose(); \ 279 ldb = b_tmp.outerStride(); \ 282 MKLPREFIX##hemm(&side, &uplo, &m, &n, &alpha_, (const MKLTYPE*)a, &lda, (const MKLTYPE*)b, &ldb, &beta_, (MKLTYPE*)res, &ldc); \ 295 #endif // EIGEN_SELFADJOINT_MATRIX_MATRIX_MKL_H #define EIGEN_MKL_HEMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX)
iterative scaling algorithm to equilibrate rows and column norms in matrices
#define EIGEN_MKL_SYMM_R(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX)
#define EIGEN_MKL_SYMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX)
#define EIGEN_MKL_HEMM_L(EIGTYPE, MKLTYPE, EIGPREFIX, MKLPREFIX)