Clean up informal language, vague TODOs, and dead code in comments

libeigen/eigen!2191

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-22 18:32:10 -08:00
parent 7d727d26bc
commit d5e67adbe7
63 changed files with 136 additions and 161 deletions

View File

@@ -51,7 +51,7 @@ class SparseLUTransposeView : public SparseSolverBase<SparseLUTransposeView<Conj
eigen_assert(m_sparseLU->info() == Success && "The matrix should be factorized first");
EIGEN_STATIC_ASSERT((Dest::Flags & RowMajorBit) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
// this ugly const_cast_derived() helps to detect aliasing when applying the permutations
// const_cast_derived() is needed to enable aliasing detection when applying the permutations.
for (Index j = 0; j < B.cols(); ++j) {
X.col(j) = m_sparseLU->colsPermutation() * B.const_cast_derived().col(j);
}
@@ -344,7 +344,7 @@ class SparseLU : public SparseSolverBase<SparseLU<MatrixType_, OrderingType_>>,
// on return, X is overwritten by the computed solution
X.resize(B.rows(), B.cols());
// this ugly const_cast_derived() helps to detect aliasing when applying the permutations
// const_cast_derived() is needed to enable aliasing detection when applying the permutations.
for (Index j = 0; j < B.cols(); ++j) X.col(j) = rowsPermutation() * B.const_cast_derived().col(j);
// Forward substitution with L
@@ -603,7 +603,7 @@ void SparseLU<MatrixType, OrderingType>::analyzePattern(const MatrixType& mat) {
* > A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol.
* If lwork = -1, it is the estimated amount of space needed, plus A->ncol.
*
* It seems that A was the name of the matrix in the past.
* Note: 'A' in the above description refers to the factored matrix (historical naming from SuperLU).
*
* \sa analyzePattern(), compute(), SparseLU(), info(), lastErrorMessage()
*/
@@ -616,7 +616,6 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) {
m_isInitialized = true;
// Apply the column permutation computed in analyzepattern()
// m_mat = matrix * m_perm_c.inverse();
m_mat = matrix;
if (m_perm_c.size()) {
m_mat.uncompress(); // NOTE: The effect of this command is only to create the InnerNonzeros pointers.
@@ -779,7 +778,7 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) {
}
// Update the determinant of the row permutation matrix
// FIXME: the following test is not correct, we should probably take iperm_c into account and pivrow is not
// FIXME: the following test is not correct; it should account for iperm_c, and pivrow is not
// directly the row pivot.
if (pivrow != jj) m_detPermR = -m_detPermR;

View File

@@ -27,11 +27,7 @@ namespace internal {
* NOTE : This class corresponds to the SCformat structure in SuperLU
*
*/
/* TODO
* InnerIterator as for sparsematrix
* SuperInnerIterator to iterate through all supernodes
* Function for triangular solve
*/
// TODO: add InnerIterator, SuperInnerIterator, and triangular solve support.
template <typename Scalar_, typename StorageIndex_>
class MappedSuperNodalMatrix {
public:

View File

@@ -52,7 +52,7 @@ void SparseLUImpl<Scalar, StorageIndex>::heap_relax_snode(const Index n, IndexVe
IndexVector post;
internal::treePostorder(StorageIndex(n), et, post); // Post order etree
IndexVector inv_post(n + 1);
for (StorageIndex i = 0; i < n + 1; ++i) inv_post(post(i)) = i; // inv_post = post.inverse()???
for (StorageIndex i = 0; i < n + 1; ++i) inv_post(post(i)) = i; // Compute the inverse postorder permutation.
// Renumber etree in postorder
IndexVector iwork(n);

View File

@@ -136,12 +136,9 @@ void SparseLUImpl<Scalar, StorageIndex>::dfs_kernel(const StorageIndex jj, Index
// segment is seen for the first time. (Note that
// "repfnz(krep)" may change later.)
// Baktrack dfs to its parent
if (traits.update_segrep(krep, jj))
// if (marker1(krep) < jcol )
{
if (traits.update_segrep(krep, jj)) {
segrep(nseg) = krep;
++nseg;
// marker1(krep) = jj;
}
kpar = parent(krep); // Pop recursion, mimic recursion