aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Cholesky
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-08-15 23:12:39 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-08-15 23:12:39 -0400
commitee982709d37e219e9d67beaf777a5bf2131e835e (patch)
tree1872283f423b8cee76398908b9d28b20aaf2d7bb /Eigen/src/Cholesky
parent65fe5f76fde99891bd2b75640d8ed6a75d6e4cbb (diff)
in all decs, make the compute() methods return *this
(implements feature request #18)
Diffstat (limited to 'Eigen/src/Cholesky')
-rw-r--r--Eigen/src/Cholesky/LDLT.h7
-rw-r--r--Eigen/src/Cholesky/LLT.h8
2 files changed, 10 insertions, 5 deletions
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h
index 1cb1294ac..adca9fe2e 100644
--- a/Eigen/src/Cholesky/LDLT.h
+++ b/Eigen/src/Cholesky/LDLT.h
@@ -123,7 +123,7 @@ template<typename MatrixType> class LDLT
template<typename Derived>
bool solveInPlace(MatrixBase<Derived> &bAndX) const;
- void compute(const MatrixType& matrix);
+ LDLT& compute(const MatrixType& matrix);
protected:
/** \internal
@@ -142,7 +142,7 @@ template<typename MatrixType> class LDLT
/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix
*/
template<typename MatrixType>
-void LDLT<MatrixType>::compute(const MatrixType& a)
+LDLT<MatrixType>& LDLT<MatrixType>::compute(const MatrixType& a)
{
ei_assert(a.rows()==a.cols());
const int size = a.rows();
@@ -154,7 +154,7 @@ void LDLT<MatrixType>::compute(const MatrixType& a)
m_transpositions.setZero();
m_sign = ei_real(a.coeff(0,0))>0 ? 1:-1;
m_isInitialized = true;
- return;
+ return *this;
}
RealScalar cutoff = 0, biggest_in_corner;
@@ -235,6 +235,7 @@ void LDLT<MatrixType>::compute(const MatrixType& a)
}
m_isInitialized = true;
+ return *this;
}
/** Computes the solution x of \f$ A x = b \f$ using the current decomposition of A.
diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h
index ef04b8fe4..3ce85b2d9 100644
--- a/Eigen/src/Cholesky/LLT.h
+++ b/Eigen/src/Cholesky/LLT.h
@@ -105,7 +105,7 @@ template<typename MatrixType, int _UpLo> class LLT
template<typename Derived>
bool solveInPlace(MatrixBase<Derived> &bAndX) const;
- void compute(const MatrixType& matrix);
+ LLT& compute(const MatrixType& matrix);
protected:
/** \internal
@@ -213,9 +213,12 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,UpperTriangular>
};
/** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix
+ *
+ *
+ * \returns a reference to *this
*/
template<typename MatrixType, int _UpLo>
-void LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
+LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
{
assert(a.rows()==a.cols());
const int size = a.rows();
@@ -223,6 +226,7 @@ void LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
m_matrix = a;
m_isInitialized = Traits::inplace_decomposition(m_matrix);
+ return *this;
}
/** Computes the solution x of \f$ A x = b \f$ using the current decomposition of A.