added functions to fetch L and U Factors from IncompleteLUT

This commit is contained in:
Johannes Zipfel
2025-01-31 18:32:38 +00:00
committed by Rasmus Munk Larsen
parent b6849f675d
commit 2926b2e0a9
3 changed files with 119 additions and 1 deletions

View File

@@ -129,6 +129,12 @@ class IncompleteLUT : public SparseSolverBase<IncompleteLUT<Scalar_, StorageInde
compute(mat);
}
/** \brief Extraction Method for L-Factor */
const FactorType matrixL() const;
/** \brief Extraction Method for U-Factor */
const FactorType matrixU() const;
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
@@ -207,6 +213,28 @@ void IncompleteLUT<Scalar, StorageIndex>::setFillfactor(int fillfactor) {
this->m_fillfactor = fillfactor;
}
/**
* get L-Factor
* \return L-Factor is a matrix containing the lower triangular part of the sparse matrix. All elements of the matrix
* above the main diagonal are zero.
**/
template <typename Scalar, typename StorageIndex>
const typename IncompleteLUT<Scalar, StorageIndex>::FactorType IncompleteLUT<Scalar, StorageIndex>::matrixL() const {
eigen_assert(m_factorizationIsOk && "factorize() should be called first");
return m_lu.template triangularView<UnitLower>();
}
/**
* get U-Factor
* \return L-Factor is a matrix containing the upper triangular part of the sparse matrix. All elements of the matrix
* below the main diagonal are zero.
**/
template <typename Scalar, typename StorageIndex>
const typename IncompleteLUT<Scalar, StorageIndex>::FactorType IncompleteLUT<Scalar, StorageIndex>::matrixU() const {
eigen_assert(m_factorizationIsOk && "Factorization must be computed first.");
return m_lu.template triangularView<Upper>();
}
template <typename Scalar, typename StorageIndex>
template <typename MatrixType_>
void IncompleteLUT<Scalar, StorageIndex>::analyzePattern(const MatrixType_& amat) {
@@ -418,4 +446,4 @@ void IncompleteLUT<Scalar, StorageIndex>::factorize(const MatrixType_& amat) {
} // end namespace Eigen
#endif // EIGEN_INCOMPLETE_LUT_H
#endif // EIGEN_INCOMPLETE_LUT_H