11 #ifndef EIGEN_ORDERING_H 12 #define EIGEN_ORDERING_H 16 #include "Eigen_Colamd.h" 25 template<
typename MatrixType>
26 void ordering_helper_at_plus_a(
const MatrixType& mat, MatrixType& symmat)
30 for (
int i = 0; i < C.rows(); i++)
32 for (
typename MatrixType::InnerIterator it(C, i); it; ++it)
40 #ifndef EIGEN_MPL2_ONLY 50 template <
typename StorageIndex>
59 template <
typename MatrixType>
60 void operator()(
const MatrixType& mat, PermutationType& perm)
64 internal::ordering_helper_at_plus_a(mat,symm);
68 internal::minimum_degree_ordering(symm, perm);
72 template <
typename SrcType,
unsigned int SrcUpLo>
79 internal::minimum_degree_ordering(C, perm);
83 #endif // EIGEN_MPL2_ONLY 93 template <
typename StorageIndex>
100 template <
typename MatrixType>
116 template<
typename StorageIndex>
126 template <
typename MatrixType>
127 void operator() (
const MatrixType& mat, PermutationType& perm)
129 eigen_assert(mat.isCompressed() &&
"COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
131 StorageIndex m = StorageIndex(mat.rows());
132 StorageIndex n = StorageIndex(mat.cols());
133 StorageIndex nnz = StorageIndex(mat.nonZeros());
135 StorageIndex Alen = internal::colamd_recommended(nnz, m, n);
137 double knobs [COLAMD_KNOBS];
138 StorageIndex stats [COLAMD_STATS];
139 internal::colamd_set_defaults(knobs);
141 IndexVector p(n+1), A(Alen);
142 for(StorageIndex i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
143 for(StorageIndex i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
145 StorageIndex info = internal::colamd(m, n, Alen, A.
data(), p.data(), knobs, stats);
146 EIGEN_UNUSED_VARIABLE(info);
147 eigen_assert( info &&
"COLAMD failed " );
150 for (StorageIndex i = 0; i < n; i++) perm.
indices()(p(i)) = i;
A versatible sparse matrix representation.
Definition: SparseMatrix.h:92
Definition: Ordering.h:94
Definition: Ordering.h:51
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:43
Definition: Ordering.h:117
void operator()(const MatrixType &mat, PermutationType &perm)
Definition: Ordering.h:60
void operator()(const MatrixType &, PermutationType &perm)
Definition: Ordering.h:101
Definition: Eigen_Colamd.h:54
const IndicesType & indices() const
Definition: PermutationMatrix.h:390
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Definition: Ordering.h:73
const Scalar * data() const
Definition: PlainObjectBase.h:228
void resize(Index newSize)
Definition: PermutationMatrix.h:137