diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-07-04 15:13:35 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-07-04 15:13:35 +0200 |
commit | 32a41ee659686fe1fb76156f7a55287acf14d4bb (patch) | |
tree | 55ba624046d61d3f57f14db2044e1c30cf2d3e14 /Eigen/src/QR/FullPivHouseholderQR.h | |
parent | 75e80792cc98b09d4ba92df67ab810d9af983e87 (diff) |
bug #707: add inplace decomposition through Ref<> for Cholesky, LU and QR decompositions.
Diffstat (limited to 'Eigen/src/QR/FullPivHouseholderQR.h')
-rw-r--r-- | Eigen/src/QR/FullPivHouseholderQR.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index e21966056..5c2f57d04 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -60,7 +60,6 @@ template<typename _MatrixType> class FullPivHouseholderQR enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, - Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; @@ -135,6 +134,26 @@ template<typename _MatrixType> class FullPivHouseholderQR compute(matrix.derived()); } + /** \brief Constructs a QR factorization from a given matrix + * + * This overloaded constructor is provided for inplace solving when \c MatrixType is a Eigen::Ref. + * + * \sa FullPivHouseholderQR(const EigenBase&) + */ + template<typename InputType> + explicit FullPivHouseholderQR(EigenBase<InputType>& matrix) + : m_qr(matrix.derived()), + m_hCoeffs((std::min)(matrix.rows(), matrix.cols())), + m_rows_transpositions((std::min)(matrix.rows(), matrix.cols())), + m_cols_transpositions((std::min)(matrix.rows(), matrix.cols())), + m_cols_permutation(matrix.cols()), + m_temp(matrix.cols()), + m_isInitialized(false), + m_usePrescribedThreshold(false) + { + computeInPlace(); + } + /** This method finds a solution x to the equation Ax=b, where A is the matrix of which * \c *this is the QR decomposition. * @@ -430,18 +449,16 @@ template<typename MatrixType> template<typename InputType> FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const EigenBase<InputType>& matrix) { - check_template_parameters(); - m_qr = matrix.derived(); - computeInPlace(); - return *this; } template<typename MatrixType> void FullPivHouseholderQR<MatrixType>::computeInPlace() { + check_template_parameters(); + using std::abs; Index rows = m_qr.rows(); Index cols = m_qr.cols(); |