add reconstructedMatrix() to LLT, and LUs

=> they show that some improvements have still to be done
   for permutations, tr*tr, trapezoidal matrices
This commit is contained in:
Gael Guennebaud
2010-02-24 19:16:10 +01:00
parent a7e4c0f825
commit 7c98c04412
6 changed files with 87 additions and 6 deletions

View File

@@ -155,7 +155,7 @@ template<typename _MatrixType> class LDLT
return m_matrix;
}
const MatrixType reconstructedMatrix() const;
MatrixType reconstructedMatrix() const;
inline int rows() const { return m_matrix.rows(); }
inline int cols() const { return m_matrix.cols(); }
@@ -324,7 +324,7 @@ bool LDLT<MatrixType>::solveInPlace(MatrixBase<Derived> &bAndX) const
* i.e., it returns the product: P^T L D L^* P.
* This function is provided for debug purpose. */
template<typename MatrixType>
const MatrixType LDLT<MatrixType>::reconstructedMatrix() const
MatrixType LDLT<MatrixType>::reconstructedMatrix() const
{
ei_assert(m_isInitialized && "LDLT is not initialized.");
const int size = m_matrix.rows();

View File

@@ -133,6 +133,8 @@ template<typename _MatrixType, int _UpLo> class LLT
return m_matrix;
}
MatrixType reconstructedMatrix() const;
inline int rows() const { return m_matrix.rows(); }
inline int cols() const { return m_matrix.cols(); }
@@ -295,6 +297,16 @@ bool LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
return true;
}
/** \returns the matrix represented by the decomposition,
* i.e., it returns the product: L L^*.
* This function is provided for debug purpose. */
template<typename MatrixType, int _UpLo>
MatrixType LLT<MatrixType,_UpLo>::reconstructedMatrix() const
{
ei_assert(m_isInitialized && "LLT is not initialized.");
return matrixL() * matrixL().adjoint().toDenseMatrix();
}
/** \cholesky_module
* \returns the LLT decomposition of \c *this
*/