33 #ifndef EIGEN_JACOBISVD_MKL_H
34 #define EIGEN_JACOBISVD_MKL_H
36 #include "Eigen/src/Core/util/MKL_support.h"
42 #define EIGEN_MKL_SVD(EIGTYPE, MKLTYPE, MKLRTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \
44 JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, ColPivHouseholderQRPreconditioner>& \
45 JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, ColPivHouseholderQRPreconditioner>::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, unsigned int computationOptions) \
47 typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
48 typedef MatrixType::Scalar Scalar; \
49 typedef MatrixType::RealScalar RealScalar; \
50 allocate(matrix.rows(), matrix.cols(), computationOptions); \
53 m_nonzeroSingularValues = m_diagSize; \
55 lapack_int lda = matrix.outerStride(), ldu, ldvt; \
56 lapack_int matrix_order = MKLCOLROW; \
58 MKLTYPE *u, *vt, dummy; \
59 jobu = (m_computeFullU) ? 'A' : (m_computeThinU) ? 'S' : 'N'; \
60 jobvt = (m_computeFullV) ? 'A' : (m_computeThinV) ? 'S' : 'N'; \
62 ldu = m_matrixU.outerStride(); \
63 u = (MKLTYPE*)m_matrixU.data(); \
64 } else { ldu=1; u=&dummy; }\
66 ldvt = (m_computeFullV) ? m_cols : (m_computeThinV) ? m_diagSize : 1; \
68 localV.resize(ldvt, m_cols); \
69 vt = (MKLTYPE*)localV.data(); \
70 } else { ldvt=1; vt=&dummy; }\
71 Matrix<MKLRTYPE, Dynamic, Dynamic> superb; superb.resize(m_diagSize, 1); \
72 MatrixType m_temp; m_temp = matrix; \
73 LAPACKE_##MKLPREFIX##gesvd( matrix_order, jobu, jobvt, m_rows, m_cols, (MKLTYPE*)m_temp.data(), lda, (MKLRTYPE*)m_singularValues.data(), u, ldu, vt, ldvt, superb.data()); \
74 if (computeV()) m_matrixV = localV.adjoint(); \
76 m_isInitialized = true; \
80 EIGEN_MKL_SVD(
double,
double,
double, d,
ColMajor, LAPACK_COL_MAJOR)
81 EIGEN_MKL_SVD(
float,
float,
float , s,
ColMajor, LAPACK_COL_MAJOR)
82 EIGEN_MKL_SVD(dcomplex, MKL_Complex16,
double, z, ColMajor, LAPACK_COL_MAJOR)
83 EIGEN_MKL_SVD(scomplex, MKL_Complex8,
float , c, ColMajor, LAPACK_COL_MAJOR)
85 EIGEN_MKL_SVD(
double,
double,
double, d,
RowMajor, LAPACK_ROW_MAJOR)
86 EIGEN_MKL_SVD(
float,
float,
float , s, RowMajor, LAPACK_ROW_MAJOR)
87 EIGEN_MKL_SVD(dcomplex, MKL_Complex16,
double, z, RowMajor, LAPACK_ROW_MAJOR)
88 EIGEN_MKL_SVD(scomplex, MKL_Complex8,
float , c, RowMajor, LAPACK_ROW_MAJOR)
92 #endif // EIGEN_JACOBISVD_MKL_H
Definition: Constants.h:264
Definition: Constants.h:266