34 #ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_MKL_H
35 #define EIGEN_COLPIVOTINGHOUSEHOLDERQR_MKL_H
37 #include "Eigen/src/Core/util/MKL_support.h"
43 #define EIGEN_MKL_QR_COLPIV(EIGTYPE, MKLTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \
45 ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >& \
46 ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >::compute( \
47 const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix) \
51 typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
52 typedef MatrixType::Scalar Scalar; \
53 typedef MatrixType::RealScalar RealScalar; \
54 Index rows = matrix.rows();\
55 Index cols = matrix.cols();\
56 Index size = matrix.diagonalSize();\
59 m_hCoeffs.resize(size);\
61 m_colsTranspositions.resize(cols);\
64 m_nonzero_pivots = 0; \
65 m_maxpivot = RealScalar(0);\
66 m_colsPermutation.resize(cols); \
67 m_colsPermutation.indices().setZero(); \
69 lapack_int lda = m_qr.outerStride(), i; \
70 lapack_int matrix_order = MKLCOLROW; \
71 LAPACKE_##MKLPREFIX##geqp3( matrix_order, rows, cols, (MKLTYPE*)m_qr.data(), lda, (lapack_int*)m_colsPermutation.indices().data(), (MKLTYPE*)m_hCoeffs.data()); \
72 m_isInitialized = true; \
73 m_maxpivot=m_qr.diagonal().cwiseAbs().maxCoeff(); \
74 m_hCoeffs.adjointInPlace(); \
75 RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); \
76 lapack_int *perm = m_colsPermutation.indices().data(); \
77 for(i=0;i<size;i++) { \
78 m_nonzero_pivots += (abs(m_qr.coeff(i,i)) > premultiplied_threshold);\
80 for(i=0;i<cols;i++) perm[i]--;\
87 EIGEN_MKL_QR_COLPIV(
double,
double, d,
ColMajor, LAPACK_COL_MAJOR)
88 EIGEN_MKL_QR_COLPIV(
float,
float, s,
ColMajor, LAPACK_COL_MAJOR)
89 EIGEN_MKL_QR_COLPIV(dcomplex, MKL_Complex16, z, ColMajor, LAPACK_COL_MAJOR)
90 EIGEN_MKL_QR_COLPIV(scomplex, MKL_Complex8, c, ColMajor, LAPACK_COL_MAJOR)
92 EIGEN_MKL_QR_COLPIV(
double,
double, d,
RowMajor, LAPACK_ROW_MAJOR)
93 EIGEN_MKL_QR_COLPIV(
float,
float, s, RowMajor, LAPACK_ROW_MAJOR)
94 EIGEN_MKL_QR_COLPIV(dcomplex, MKL_Complex16, z, RowMajor, LAPACK_ROW_MAJOR)
95 EIGEN_MKL_QR_COLPIV(scomplex, MKL_Complex8, c, RowMajor, LAPACK_ROW_MAJOR)
99 #endif // EIGEN_COLPIVOTINGHOUSEHOLDERQR_MKL_H
Definition: Constants.h:264
Definition: Constants.h:266