34 #ifndef EIGEN_COLPIVOTINGHOUSEHOLDERQR_LAPACKE_H 35 #define EIGEN_COLPIVOTINGHOUSEHOLDERQR_LAPACKE_H 41 #define EIGEN_LAPACKE_QR_COLPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, EIGCOLROW, LAPACKE_COLROW) \ 42 template<> template<typename InputType> inline \ 43 ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >& \ 44 ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >::compute( \ 45 const EigenBase<InputType>& matrix) \ 49 typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \ 50 typedef MatrixType::RealScalar RealScalar; \ 51 Index rows = matrix.rows();\ 52 Index cols = matrix.cols();\ 55 Index size = m_qr.diagonalSize();\ 56 m_hCoeffs.resize(size);\ 58 m_colsTranspositions.resize(cols);\ 61 m_nonzero_pivots = 0; \ 62 m_maxpivot = RealScalar(0);\ 63 m_colsPermutation.resize(cols); \ 64 m_colsPermutation.indices().setZero(); \ 66 lapack_int lda = internal::convert_index<lapack_int,Index>(m_qr.outerStride()); \ 67 lapack_int matrix_order = LAPACKE_COLROW; \ 68 LAPACKE_##LAPACKE_PREFIX##geqp3( matrix_order, internal::convert_index<lapack_int,Index>(rows), internal::convert_index<lapack_int,Index>(cols), \ 69 (LAPACKE_TYPE*)m_qr.data(), lda, (lapack_int*)m_colsPermutation.indices().data(), (LAPACKE_TYPE*)m_hCoeffs.data()); \ 70 m_isInitialized = true; \ 71 m_maxpivot=m_qr.diagonal().cwiseAbs().maxCoeff(); \ 72 m_hCoeffs.adjointInPlace(); \ 73 RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); \ 74 lapack_int *perm = m_colsPermutation.indices().data(); \ 75 for(Index i=0;i<size;i++) { \ 76 m_nonzero_pivots += (abs(m_qr.coeff(i,i)) > premultiplied_threshold);\ 78 for(Index i=0;i<cols;i++) perm[i]--;\ 85 EIGEN_LAPACKE_QR_COLPIV(
double,
double, d,
ColMajor, LAPACK_COL_MAJOR)
86 EIGEN_LAPACKE_QR_COLPIV(
float,
float, s,
ColMajor, LAPACK_COL_MAJOR)
87 EIGEN_LAPACKE_QR_COLPIV(dcomplex, lapack_complex_double, z,
ColMajor, LAPACK_COL_MAJOR)
88 EIGEN_LAPACKE_QR_COLPIV(scomplex, lapack_complex_float, c,
ColMajor, LAPACK_COL_MAJOR)
90 EIGEN_LAPACKE_QR_COLPIV(
double,
double, d,
RowMajor, LAPACK_ROW_MAJOR)
91 EIGEN_LAPACKE_QR_COLPIV(
float,
float, s,
RowMajor, LAPACK_ROW_MAJOR)
92 EIGEN_LAPACKE_QR_COLPIV(dcomplex, lapack_complex_double, z,
RowMajor, LAPACK_ROW_MAJOR)
93 EIGEN_LAPACKE_QR_COLPIV(scomplex, lapack_complex_float, c,
RowMajor, LAPACK_ROW_MAJOR)
97 #endif // EIGEN_COLPIVOTINGHOUSEHOLDERQR_LAPACKE_H Definition: Constants.h:319
Namespace containing all symbols from the Eigen library.
Definition: Core:141
Definition: Constants.h:321