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) \
42template<> template<typename InputType> inline \
43ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >& \
44ColPivHouseholderQR<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]--;\
85EIGEN_LAPACKE_QR_COLPIV(
double,
double, d, ColMajor, LAPACK_COL_MAJOR)
86EIGEN_LAPACKE_QR_COLPIV(
float,
float, s, ColMajor, LAPACK_COL_MAJOR)
87EIGEN_LAPACKE_QR_COLPIV(dcomplex, lapack_complex_double, z, ColMajor, LAPACK_COL_MAJOR)
88EIGEN_LAPACKE_QR_COLPIV(scomplex, lapack_complex_float, c, ColMajor, LAPACK_COL_MAJOR)
90EIGEN_LAPACKE_QR_COLPIV(
double,
double, d, RowMajor, LAPACK_ROW_MAJOR)
91EIGEN_LAPACKE_QR_COLPIV(
float,
float, s, RowMajor, LAPACK_ROW_MAJOR)
92EIGEN_LAPACKE_QR_COLPIV(dcomplex, lapack_complex_double, z, RowMajor, LAPACK_ROW_MAJOR)
93EIGEN_LAPACKE_QR_COLPIV(scomplex, lapack_complex_float, c, RowMajor, LAPACK_ROW_MAJOR)
Namespace containing all symbols from the Eigen library.
Definition: Core:141