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 Index>
59 template <
typename MatrixType>
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 Index>
100 template <
typename MatrixType>
114 template<
typename Index>
124 template <
typename MatrixType>
125 void operator() (
const MatrixType& mat, PermutationType& perm)
127 eigen_assert(mat.isCompressed() &&
"COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
129 Index m = mat.rows();
130 Index n = mat.cols();
131 Index nnz = mat.nonZeros();
135 double knobs [COLAMD_KNOBS];
136 Index stats [COLAMD_STATS];
137 internal::colamd_set_defaults(knobs);
139 IndexVector p(n+1), A(Alen);
140 for(Index i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
141 for(Index i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
143 Index info = internal::colamd(m, n, Alen, A.
data(), p.data(), knobs, stats);
144 EIGEN_UNUSED_VARIABLE(info);
145 eigen_assert( info &&
"COLAMD failed " );
148 for (Index i = 0; i < n; i++) perm.
indices()(p(i)) = i;
A versatible sparse matrix representation.
Definition: SparseMatrix.h:85
EIGEN_STRONG_INLINE const Scalar * data() const
Definition: PlainObjectBase.h:212
Functor computing the natural ordering (identity)
Definition: Ordering.h:94
void operator()(const MatrixType &mat, PermutationType &perm)
Compute the permutation vector from a sparse matrix This routine is much faster if the input matrix i...
Definition: Ordering.h:60
Functor computing the approximate minimum degree ordering If the matrix is not structurally symmetric...
Definition: Ordering.h:51
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:49
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Compute the permutation with a selfadjoint matrix.
Definition: Ordering.h:73
void operator()(const MatrixType &, PermutationType &perm)
Compute the permutation vector from a column-major sparse matrix.
Definition: Ordering.h:101
Functor computing the column approximate minimum degree ordering The matrix should be in column-major...
Definition: Ordering.h:115
Definition: BandTriangularSolver.h:13
const IndicesType & indices() const
const version of indices().
Definition: PermutationMatrix.h:387
Index colamd_recommended(Index nnz, Index n_row, Index n_col)
Returns the recommended value of Alen.
Definition: Ordering.h:258
void resize(Index newSize)
Resizes to given size.
Definition: PermutationMatrix.h:142