11 #ifndef EIGEN_ORDERING_H
12 #define EIGEN_ORDERING_H
14 #include "./InternalHeaderCheck.h"
18 #include "Eigen_Colamd.h"
28 template<
typename MatrixType>
29 void ordering_helper_at_plus_a(
const MatrixType& A, MatrixType& symmat)
33 for (
int i = 0; i < C.rows(); i++)
35 for (
typename MatrixType::InnerIterator it(C, i); it; ++it)
36 it.valueRef() =
typename MatrixType::Scalar(0);
51 template <
typename StorageIndex>
60 template <
typename MatrixType>
65 internal::ordering_helper_at_plus_a(mat,symm);
69 internal::minimum_degree_ordering(symm, perm);
73 template <
typename SrcType,
unsigned int SrcUpLo>
80 internal::minimum_degree_ordering(C, perm);
92 template <
typename StorageIndex>
99 template <
typename MatrixType>
115 template<
typename StorageIndex>
125 template <
typename MatrixType>
128 eigen_assert(mat.isCompressed() &&
"COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
130 StorageIndex m = StorageIndex(mat.rows());
131 StorageIndex n = StorageIndex(mat.cols());
132 StorageIndex nnz = StorageIndex(mat.nonZeros());
134 StorageIndex Alen = internal::Colamd::recommended(nnz, m, n);
136 double knobs [internal::Colamd::NKnobs];
137 StorageIndex stats [internal::Colamd::NStats];
138 internal::Colamd::set_defaults(knobs);
141 for(StorageIndex i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
142 for(StorageIndex i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
144 StorageIndex info = internal::Colamd::compute_ordering(m, n, Alen, A.
data(), p.data(), knobs, stats);
145 EIGEN_UNUSED_VARIABLE(info);
146 eigen_assert( info &&
"COLAMD failed " );
149 for (StorageIndex i = 0; i < n; i++) perm.
indices()(p(i)) = i;
Definition: Ordering.h:53
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Definition: Ordering.h:74
void operator()(const MatrixType &mat, PermutationType &perm)
Definition: Ordering.h:61
Definition: Ordering.h:117
void operator()(const MatrixType &mat, PermutationType &perm)
Definition: Ordering.h:126
Definition: Ordering.h:94
void operator()(const MatrixType &, PermutationType &perm)
Definition: Ordering.h:100
void resize(Index newSize)
Definition: PermutationMatrix.h:127
const IndicesType & indices() const
Definition: PermutationMatrix.h:362
const Scalar * data() const
Definition: PlainObjectBase.h:259
A versatible sparse matrix representation.
Definition: SparseMatrix.h:100
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:47
Namespace containing all symbols from the Eigen library.
Definition: Core:139