Add const to non-mutating member functions across remaining modules

libeigen/eigen!2222

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-26 13:58:04 -08:00
parent 13b61529f4
commit 3adfa9bd37
22 changed files with 158 additions and 146 deletions

View File

@@ -53,7 +53,7 @@ class AMDOrdering {
* This routine is much faster if the input matrix is column-major
*/
template <typename MatrixType>
void operator()(const MatrixType& mat, PermutationType& perm) {
void operator()(const MatrixType& mat, PermutationType& perm) const {
// Compute the symmetric pattern
SparseMatrix<typename MatrixType::Scalar, ColMajor, StorageIndex> symm;
internal::ordering_helper_at_plus_a(mat, symm);
@@ -65,7 +65,7 @@ class AMDOrdering {
/** Compute the permutation with a selfadjoint matrix */
template <typename SrcType, unsigned int SrcUpLo>
void operator()(const SparseSelfAdjointView<SrcType, SrcUpLo>& mat, PermutationType& perm) {
void operator()(const SparseSelfAdjointView<SrcType, SrcUpLo>& mat, PermutationType& perm) const {
SparseMatrix<typename SrcType::Scalar, ColMajor, StorageIndex> C;
C = mat;
@@ -90,7 +90,7 @@ class NaturalOrdering {
/** Compute the permutation vector from a column-major sparse matrix */
template <typename MatrixType>
void operator()(const MatrixType& /*mat*/, PermutationType& perm) {
void operator()(const MatrixType& /*mat*/, PermutationType& perm) const {
perm.resize(0);
}
};
@@ -113,7 +113,7 @@ class COLAMDOrdering {
* \warning The input sparse matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()).
*/
template <typename MatrixType>
void operator()(const MatrixType& mat, PermutationType& perm) {
void operator()(const MatrixType& mat, PermutationType& perm) const {
eigen_assert(mat.isCompressed() &&
"COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it "
"to COLAMDOrdering");