11 #ifndef EIGEN_ORDERING_H 12 #define EIGEN_ORDERING_H 15 #include "./InternalHeaderCheck.h" 16 #include "Eigen_Colamd.h" 27 template <
typename MatrixType>
28 void ordering_helper_at_plus_a(
const MatrixType& A, MatrixType& symmat) {
31 for (
int i = 0; i < C.rows(); i++) {
32 for (
typename MatrixType::InnerIterator it(C, i); it; ++it) it.valueRef() =
typename MatrixType::Scalar(0);
47 template <
typename StorageIndex>
55 template <
typename MatrixType>
59 internal::ordering_helper_at_plus_a(mat, symm);
63 internal::minimum_degree_ordering(symm, perm);
67 template <
typename SrcType,
unsigned int SrcUpLo>
74 internal::minimum_degree_ordering(C, perm);
86 template <
typename StorageIndex>
92 template <
typename MatrixType>
106 template <
typename StorageIndex>
115 template <
typename MatrixType>
117 eigen_assert(mat.isCompressed() &&
118 "COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it " 119 "to COLAMDOrdering");
121 StorageIndex m = StorageIndex(mat.rows());
122 StorageIndex n = StorageIndex(mat.cols());
123 StorageIndex nnz = StorageIndex(mat.nonZeros());
125 StorageIndex Alen = internal::Colamd::recommended(nnz, m, n);
127 double knobs[internal::Colamd::NKnobs];
128 StorageIndex stats[internal::Colamd::NStats];
129 internal::Colamd::set_defaults(knobs);
132 for (StorageIndex i = 0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
133 for (StorageIndex i = 0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
135 StorageIndex info = internal::Colamd::compute_ordering(m, n, Alen, A.
data(), p.data(), knobs, stats);
136 EIGEN_UNUSED_VARIABLE(info);
137 eigen_assert(info &&
"COLAMD failed ");
140 for (StorageIndex i = 0; i < n; i++) perm.
indices()(p(i)) = i;
A versatible sparse matrix representation.
Definition: SparseMatrix.h:121
const IndicesType & indices() const
Definition: PermutationMatrix.h:337
Definition: Ordering.h:87
Definition: Ordering.h:48
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:52
constexpr const Scalar * data() const
Definition: PlainObjectBase.h:247
void operator()(const MatrixType &mat, PermutationType &perm)
Definition: Ordering.h:116
Definition: Ordering.h:107
void operator()(const MatrixType &mat, PermutationType &perm)
Definition: Ordering.h:56
void operator()(const MatrixType &, PermutationType &perm)
Definition: Ordering.h:93
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Definition: Ordering.h:68
void resize(Index newSize)
Definition: PermutationMatrix.h:122