diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-09-07 10:42:04 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-09-07 10:42:04 +0200 |
commit | 7031a851d45a8526474ac1ac972ad12a48e99f1a (patch) | |
tree | 8a387115aa6617e8b17862430aab4546a7c24674 /Eigen/src/Cholesky/LLT.h | |
parent | 1702fcb72e14026af14d8af400b1a5fd4d959d19 (diff) |
Generalize matrix ctor and compute() method of dense decomposition to 1) limit temporaries, 2) forward expressions to nested decompositions, 3) fix ambiguous ctor instanciation for square decomposition
Diffstat (limited to 'Eigen/src/Cholesky/LLT.h')
-rw-r--r-- | Eigen/src/Cholesky/LLT.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h index 745b74d95..dc73304e8 100644 --- a/Eigen/src/Cholesky/LLT.h +++ b/Eigen/src/Cholesky/LLT.h @@ -87,11 +87,12 @@ template<typename _MatrixType, int _UpLo> class LLT explicit LLT(Index size) : m_matrix(size, size), m_isInitialized(false) {} - explicit LLT(const MatrixType& matrix) + template<typename InputType> + explicit LLT(const EigenBase<InputType>& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_isInitialized(false) { - compute(matrix); + compute(matrix.derived()); } /** \returns a view of the upper triangular matrix U */ @@ -131,7 +132,8 @@ template<typename _MatrixType, int _UpLo> class LLT template<typename Derived> void solveInPlace(MatrixBase<Derived> &bAndX) const; - LLT& compute(const MatrixType& matrix); + template<typename InputType> + LLT& compute(const EigenBase<InputType>& matrix); /** \returns the LLT decomposition matrix * @@ -381,14 +383,15 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Upper> * Output: \verbinclude TutorialLinAlgComputeTwice.out */ template<typename MatrixType, int _UpLo> -LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a) +template<typename InputType> +LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const EigenBase<InputType>& a) { check_template_parameters(); eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); m_matrix.resize(size, size); - m_matrix = a; + m_matrix = a.derived(); m_isInitialized = true; bool ok = Traits::inplace_decomposition(m_matrix); |