aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/QR
diff options
context:
space:
mode:
authorGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2013-02-20 13:58:26 +0100
committerGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2013-02-20 13:58:26 +0100
commitbc18e06fe3e22ce252c2037bd30aa8a61d1cd64c (patch)
tree2e36da4f43762011cd450f910dd8a6c1b7bf9120 /Eigen/src/QR
parent962c99d462dc779b98d00f90616bbbbf6f7f9dd5 (diff)
Add matrixR() to get the triangular factor from the Householder QR
Diffstat (limited to 'Eigen/src/QR')
-rw-r--r--Eigen/src/QR/ColPivHouseholderQR.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/Eigen/src/QR/ColPivHouseholderQR.h b/Eigen/src/QR/ColPivHouseholderQR.h
index 807038f82..bca0ede61 100644
--- a/Eigen/src/QR/ColPivHouseholderQR.h
+++ b/Eigen/src/QR/ColPivHouseholderQR.h
@@ -145,7 +145,21 @@ template<typename _MatrixType> class ColPivHouseholderQR
eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return m_qr;
}
-
+
+ /** \returns a reference to the matrix where the Householder QR is stored
+ * To get the triangular factor R, use
+ * \code matrixR().template triangularView<Upper>() \endcode
+ * For rank-deficient matrices, use
+ * \code
+ * matrixR().topLeftCorner(rank(), rank()).template triangularView<Upper>()
+ * \endcode
+ */
+ const MatrixType& matrixR() const
+ {
+ eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
+ return m_qr;
+ }
+
ColPivHouseholderQR& compute(const MatrixType& matrix);
const PermutationType& colsPermutation() const
@@ -336,6 +350,18 @@ template<typename _MatrixType> class ColPivHouseholderQR
* diagonal coefficient of R.
*/
RealScalar maxPivot() const { return m_maxpivot; }
+
+ /** \brief Reports whether the QR factorization was succesful.
+ *
+ * \note This routine is provided for uniformity with other factorization modules
+ * \returns \c Success if computation was succesful,
+ * \c NumericalIssue if the QR can not be computed
+ */
+ ComputationInfo info() const
+ {
+ eigen_assert(m_isInitialized && "Decomposition is not initialized.");
+ return Success;
+ }
protected:
MatrixType m_qr;
@@ -345,6 +371,7 @@ template<typename _MatrixType> class ColPivHouseholderQR
RowVectorType m_temp;
RealRowVectorType m_colSqNorms;
bool m_isInitialized, m_usePrescribedThreshold;
+ mutable ComputationInfo m_info;
RealScalar m_prescribedThreshold, m_maxpivot;
Index m_nonzero_pivots;
Index m_det_pq;
@@ -488,7 +515,7 @@ struct solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
.transpose()
);
- dec().matrixQR()
+ dec().matrixR()
.topLeftCorner(nonzero_pivots, nonzero_pivots)
.template triangularView<Upper>()
.solveInPlace(c.topRows(nonzero_pivots));