From 5effdba2c64930c3c6bb52323e3f6e68cc8b6163 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 27 Feb 2012 14:28:07 +0100 Subject: SimplicialCholesky*: s/LLt/LLT and s/LDLt/LDLT for consistency with dense names --- Eigen/src/SparseCholesky/SimplicialCholesky.h | 122 +++++++++++++------------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'Eigen/src/SparseCholesky') diff --git a/Eigen/src/SparseCholesky/SimplicialCholesky.h b/Eigen/src/SparseCholesky/SimplicialCholesky.h index 9a4e865c9..e69fdf545 100644 --- a/Eigen/src/SparseCholesky/SimplicialCholesky.h +++ b/Eigen/src/SparseCholesky/SimplicialCholesky.h @@ -64,8 +64,8 @@ LDL License: #define EIGEN_SIMPLICIAL_CHOLESKY_H enum SimplicialCholeskyMode { - SimplicialCholeskyLLt, - SimplicialCholeskyLDLt + SimplicialCholeskyLLT, + SimplicialCholeskyLDLT }; /** \ingroup SparseCholesky_Module @@ -142,7 +142,7 @@ class SimplicialCholeskyBase inline const internal::solve_retval solve(const MatrixBase& b) const { - eigen_assert(m_isInitialized && "Simplicial LLt or LDLt is not initialized."); + eigen_assert(m_isInitialized && "Simplicial LLT or LDLT is not initialized."); eigen_assert(rows()==b.rows() && "SimplicialCholeskyBase::solve(): invalid number of rows of the right hand side matrix b"); return internal::solve_retval(*this, b.derived()); @@ -156,7 +156,7 @@ class SimplicialCholeskyBase inline const internal::sparse_solve_retval solve(const SparseMatrixBase& b) const { - eigen_assert(m_isInitialized && "Simplicial LLt or LDLt is not initialized."); + eigen_assert(m_isInitialized && "Simplicial LLT or LDLT is not initialized."); eigen_assert(rows()==b.rows() && "SimplicialCholesky::solve(): invalid number of rows of the right hand side matrix b"); return internal::sparse_solve_retval(*this, b.derived()); @@ -256,10 +256,10 @@ class SimplicialCholeskyBase protected: - template + template void factorize(const MatrixType& a); - void analyzePattern(const MatrixType& a, bool doLDLt); + void analyzePattern(const MatrixType& a, bool doLDLT); /** keeps off-diagonal entries; drops diagonal entries */ struct keep_diag { @@ -275,7 +275,7 @@ class SimplicialCholeskyBase bool m_analysisIsOk; CholMatrixType m_matrix; - VectorType m_diag; // the diagonal coefficients (LDLt mode) + VectorType m_diag; // the diagonal coefficients (LDLT mode) VectorXi m_parent; // elimination tree VectorXi m_nonZerosPerCol; PermutationMatrix m_P; // the permutation @@ -285,13 +285,13 @@ class SimplicialCholeskyBase RealScalar m_shiftScale; }; -template class SimplicialLLt; -template class SimplicialLDLt; +template class SimplicialLLT; +template class SimplicialLDLT; template class SimplicialCholesky; namespace internal { -template struct traits > +template struct traits > { typedef _MatrixType MatrixType; enum { UpLo = _UpLo }; @@ -304,7 +304,7 @@ template struct traits struct traits > +template struct traits > { typedef _MatrixType MatrixType; enum { UpLo = _UpLo }; @@ -326,8 +326,8 @@ template struct traits struct traits - class SimplicialLLt : public SimplicialCholeskyBase > + class SimplicialLLT : public SimplicialCholeskyBase > { public: typedef _MatrixType MatrixType; enum { UpLo = _UpLo }; - typedef SimplicialCholeskyBase Base; + typedef SimplicialCholeskyBase Base; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; typedef SparseMatrix CholMatrixType; typedef Matrix VectorType; - typedef internal::traits Traits; + typedef internal::traits Traits; typedef typename Traits::MatrixL MatrixL; typedef typename Traits::MatrixU MatrixU; public: /** Default constructor */ - SimplicialLLt() : Base() {} - /** Constructs and performs the LLt factorization of \a matrix */ - SimplicialLLt(const MatrixType& matrix) + SimplicialLLT() : Base() {} + /** Constructs and performs the LLT factorization of \a matrix */ + SimplicialLLT(const MatrixType& matrix) : Base(matrix) {} /** \returns an expression of the factor L */ inline const MatrixL matrixL() const { - eigen_assert(Base::m_factorizationIsOk && "Simplicial LLt not factorized"); + eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized"); return Traits::getL(Base::m_matrix); } /** \returns an expression of the factor U (= L^*) */ inline const MatrixU matrixU() const { - eigen_assert(Base::m_factorizationIsOk && "Simplicial LLt not factorized"); + eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized"); return Traits::getU(Base::m_matrix); } @@ -404,8 +404,8 @@ public: }; /** \ingroup SparseCholesky_Module - * \class SimplicialLDLt - * \brief A direct sparse LDLt Cholesky factorizations without square root. + * \class SimplicialLDLT + * \brief A direct sparse LDLT Cholesky factorizations without square root. * * This class provides a LDL^T Cholesky factorizations without square root of sparse matrices that are * selfadjoint and positive definite. The factorization allows for solving A.X = B where @@ -415,45 +415,45 @@ public: * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * - * \sa class SimplicialLLt + * \sa class SimplicialLLT */ template - class SimplicialLDLt : public SimplicialCholeskyBase > + class SimplicialLDLT : public SimplicialCholeskyBase > { public: typedef _MatrixType MatrixType; enum { UpLo = _UpLo }; - typedef SimplicialCholeskyBase Base; + typedef SimplicialCholeskyBase Base; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; typedef SparseMatrix CholMatrixType; typedef Matrix VectorType; - typedef internal::traits Traits; + typedef internal::traits Traits; typedef typename Traits::MatrixL MatrixL; typedef typename Traits::MatrixU MatrixU; public: /** Default constructor */ - SimplicialLDLt() : Base() {} + SimplicialLDLT() : Base() {} - /** Constructs and performs the LLt factorization of \a matrix */ - SimplicialLDLt(const MatrixType& matrix) + /** Constructs and performs the LLT factorization of \a matrix */ + SimplicialLDLT(const MatrixType& matrix) : Base(matrix) {} /** \returns a vector expression of the diagonal D */ inline const VectorType vectorD() const { - eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLt not factorized"); + eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized"); return Base::m_diag; } /** \returns an expression of the factor L */ inline const MatrixL matrixL() const { - eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLt not factorized"); + eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized"); return Traits::getL(Base::m_matrix); } /** \returns an expression of the factor U (= L^*) */ inline const MatrixU matrixU() const { - eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLt not factorized"); + eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized"); return Traits::getU(Base::m_matrix); } @@ -486,11 +486,11 @@ public: } }; -/** \deprecated use SimplicialLDLt or class SimplicialLLt +/** \deprecated use SimplicialLDLT or class SimplicialLLT * \ingroup SparseCholesky_Module * \class SimplicialCholesky * - * \sa class SimplicialLDLt, class SimplicialLLt + * \sa class SimplicialLDLT, class SimplicialLLT */ template class SimplicialCholesky : public SimplicialCholeskyBase > @@ -505,13 +505,13 @@ public: typedef SparseMatrix CholMatrixType; typedef Matrix VectorType; typedef internal::traits Traits; - typedef internal::traits > LDLtTraits; - typedef internal::traits > LLtTraits; + typedef internal::traits > LDLTTraits; + typedef internal::traits > LLTTraits; public: - SimplicialCholesky() : Base(), m_LDLt(true) {} + SimplicialCholesky() : Base(), m_LDLT(true) {} SimplicialCholesky(const MatrixType& matrix) - : Base(), m_LDLt(true) + : Base(), m_LDLT(true) { Base::compute(matrix); } @@ -520,11 +520,11 @@ public: { switch(mode) { - case SimplicialCholeskyLLt: - m_LDLt = false; + case SimplicialCholeskyLLT: + m_LDLT = false; break; - case SimplicialCholeskyLDLt: - m_LDLt = true; + case SimplicialCholeskyLDLT: + m_LDLT = true; break; default: break; @@ -550,7 +550,7 @@ public: */ void analyzePattern(const MatrixType& a) { - Base::analyzePattern(a, m_LDLt); + Base::analyzePattern(a, m_LDLT); } /** Performs a numeric decomposition of \a matrix @@ -561,7 +561,7 @@ public: */ void factorize(const MatrixType& a) { - if(m_LDLt) + if(m_LDLT) Base::template factorize(a); else Base::template factorize(a); @@ -584,10 +584,10 @@ public: if(Base::m_matrix.nonZeros()>0) // otherwise L==I { - if(m_LDLt) - LDLtTraits::getL(Base::m_matrix).solveInPlace(dest); + if(m_LDLT) + LDLTTraits::getL(Base::m_matrix).solveInPlace(dest); else - LLtTraits::getL(Base::m_matrix).solveInPlace(dest); + LLTTraits::getL(Base::m_matrix).solveInPlace(dest); } if(Base::m_diag.size()>0) @@ -595,10 +595,10 @@ public: if (Base::m_matrix.nonZeros()>0) // otherwise I==I { - if(m_LDLt) - LDLtTraits::getU(Base::m_matrix).solveInPlace(dest); + if(m_LDLT) + LDLTTraits::getU(Base::m_matrix).solveInPlace(dest); else - LLtTraits::getU(Base::m_matrix).solveInPlace(dest); + LLTTraits::getU(Base::m_matrix).solveInPlace(dest); } if(Base::m_P.size()>0) @@ -607,7 +607,7 @@ public: Scalar determinant() const { - if(m_LDLt) + if(m_LDLT) { return Base::m_diag.prod(); } @@ -619,11 +619,11 @@ public: } protected: - bool m_LDLt; + bool m_LDLT; }; template -void SimplicialCholeskyBase::analyzePattern(const MatrixType& a, bool doLDLt) +void SimplicialCholeskyBase::analyzePattern(const MatrixType& a, bool doLDLT) { eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); @@ -678,7 +678,7 @@ void SimplicialCholeskyBase::analyzePattern(const MatrixType& a, bool d Index* Lp = m_matrix.outerIndexPtr(); Lp[0] = 0; for(Index k = 0; k < size; ++k) - Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLt ? 0 : 1); + Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLT ? 0 : 1); m_matrix.resizeNonZeros(Lp[size]); @@ -690,7 +690,7 @@ void SimplicialCholeskyBase::analyzePattern(const MatrixType& a, bool d template -template +template void SimplicialCholeskyBase::factorize(const MatrixType& a) { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); @@ -711,7 +711,7 @@ void SimplicialCholeskyBase::factorize(const MatrixType& a) ap.template selfadjointView() = a.template selfadjointView().twistedBy(m_Pinv); bool ok = true; - m_diag.resize(DoLDLt ? size : 0); + m_diag.resize(DoLDLT ? size : 0); for(Index k = 0; k < size; ++k) { @@ -749,21 +749,21 @@ void SimplicialCholeskyBase::factorize(const MatrixType& a) /* the nonzero entry L(k,i) */ Scalar l_ki; - if(DoLDLt) + if(DoLDLT) l_ki = yi / m_diag[i]; else yi = l_ki = yi / Lx[Lp[i]]; Index p2 = Lp[i] + m_nonZerosPerCol[i]; Index p; - for(p = Lp[i] + (DoLDLt ? 0 : 1); p < p2; ++p) + for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p) y[Li[p]] -= internal::conj(Lx[p]) * yi; d -= internal::real(l_ki * internal::conj(yi)); Li[p] = k; /* store L(k,i) in column form of L */ Lx[p] = l_ki; ++m_nonZerosPerCol[i]; /* increment count of nonzeros in col i */ } - if(DoLDLt) + if(DoLDLT) { m_diag[k] = d; if(d == RealScalar(0)) -- cgit v1.2.3