33 #ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_MKL_H
34 #define EIGEN_TRIANGULAR_SOLVER_MATRIX_MKL_H
41 #define EIGEN_MKL_TRSM_L(EIGTYPE, MKLTYPE, MKLPREFIX) \
42 template <typename Index, int Mode, bool Conjugate, int TriStorageOrder> \
43 struct triangular_solve_matrix<EIGTYPE,Index,OnTheLeft,Mode,Conjugate,TriStorageOrder,ColMajor> \
46 IsLower = (Mode&Lower) == Lower, \
47 IsUnitDiag = (Mode&UnitDiag) ? 1 : 0, \
48 IsZeroDiag = (Mode&ZeroDiag) ? 1 : 0, \
49 conjA = ((TriStorageOrder==ColMajor) && Conjugate) ? 1 : 0 \
52 Index size, Index otherSize, \
53 const EIGTYPE* _tri, Index triStride, \
54 EIGTYPE* _other, Index otherStride, level3_blocking<EIGTYPE,EIGTYPE>& ) \
56 MKL_INT m = size, n = otherSize, lda, ldb; \
57 char side = 'L', uplo, diag='N', transa; \
61 assign_scalar_eig2mkl(alpha, myone); \
66 transa = (TriStorageOrder==RowMajor) ? ((Conjugate) ? 'C' : 'T') : 'N'; \
68 uplo = IsLower ? 'L' : 'U'; \
69 if (TriStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
71 typedef Matrix<EIGTYPE, Dynamic, Dynamic, TriStorageOrder> MatrixTri; \
72 Map<const MatrixTri, 0, OuterStride<> > tri(_tri,size,size,OuterStride<>(triStride)); \
76 a_tmp = tri.conjugate(); \
78 lda = a_tmp.outerStride(); \
83 if (IsUnitDiag) diag='U'; \
85 MKLPREFIX##trsm(&side, &uplo, &transa, &diag, &m, &n, &alpha, (const MKLTYPE*)a, &lda, (MKLTYPE*)_other, &ldb); \
89 EIGEN_MKL_TRSM_L(
double,
double, d)
90 EIGEN_MKL_TRSM_L(dcomplex, MKL_Complex16, z)
91 EIGEN_MKL_TRSM_L(
float,
float, s)
92 EIGEN_MKL_TRSM_L(scomplex, MKL_Complex8, c)
96 #define EIGEN_MKL_TRSM_R(EIGTYPE, MKLTYPE, MKLPREFIX) \
97 template <typename Index, int Mode, bool Conjugate, int TriStorageOrder> \
98 struct triangular_solve_matrix<EIGTYPE,Index,OnTheRight,Mode,Conjugate,TriStorageOrder,ColMajor> \
101 IsLower = (Mode&Lower) == Lower, \
102 IsUnitDiag = (Mode&UnitDiag) ? 1 : 0, \
103 IsZeroDiag = (Mode&ZeroDiag) ? 1 : 0, \
104 conjA = ((TriStorageOrder==ColMajor) && Conjugate) ? 1 : 0 \
107 Index size, Index otherSize, \
108 const EIGTYPE* _tri, Index triStride, \
109 EIGTYPE* _other, Index otherStride, level3_blocking<EIGTYPE,EIGTYPE>& ) \
111 MKL_INT m = otherSize, n = size, lda, ldb; \
112 char side = 'R', uplo, diag='N', transa; \
116 assign_scalar_eig2mkl(alpha, myone); \
121 transa = (TriStorageOrder==RowMajor) ? ((Conjugate) ? 'C' : 'T') : 'N'; \
123 uplo = IsLower ? 'L' : 'U'; \
124 if (TriStorageOrder==RowMajor) uplo = (uplo == 'L') ? 'U' : 'L'; \
126 typedef Matrix<EIGTYPE, Dynamic, Dynamic, TriStorageOrder> MatrixTri; \
127 Map<const MatrixTri, 0, OuterStride<> > tri(_tri,size,size,OuterStride<>(triStride)); \
131 a_tmp = tri.conjugate(); \
133 lda = a_tmp.outerStride(); \
138 if (IsUnitDiag) diag='U'; \
140 MKLPREFIX##trsm(&side, &uplo, &transa, &diag, &m, &n, &alpha, (const MKLTYPE*)a, &lda, (MKLTYPE*)_other, &ldb); \
145 EIGEN_MKL_TRSM_R(
double,
double, d)
146 EIGEN_MKL_TRSM_R(dcomplex, MKL_Complex16, z)
147 EIGEN_MKL_TRSM_R(
float,
float, s)
148 EIGEN_MKL_TRSM_R(scomplex, MKL_Complex8, c)
155 #endif // EIGEN_TRIANGULAR_SOLVER_MATRIX_MKL_H