11 #ifndef EIGEN_ORDERING_H 12 #define EIGEN_ORDERING_H 16 #include "Eigen_Colamd.h" 26 template<
typename MatrixType>
27 void ordering_helper_at_plus_a(
const MatrixType& A, MatrixType& symmat)
31 for (
int i = 0; i < C.rows(); i++)
33 for (
typename MatrixType::InnerIterator it(C, i); it; ++it)
41 #ifndef EIGEN_MPL2_ONLY 51 template <
typename StorageIndex>
60 template <
typename MatrixType>
61 void operator()(
const MatrixType& mat, PermutationType& perm)
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);
84 #endif // EIGEN_MPL2_ONLY 94 template <
typename StorageIndex>
101 template <
typename MatrixType>
117 template<
typename StorageIndex>
127 template <
typename MatrixType>
128 void operator() (
const MatrixType& mat, PermutationType& perm)
130 eigen_assert(mat.isCompressed() &&
"COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
132 StorageIndex m = StorageIndex(mat.rows());
133 StorageIndex n = StorageIndex(mat.cols());
134 StorageIndex nnz = StorageIndex(mat.nonZeros());
138 double knobs [COLAMD_KNOBS];
139 StorageIndex stats [COLAMD_STATS];
140 internal::colamd_set_defaults(knobs);
142 IndexVector p(n+1), A(Alen);
143 for(StorageIndex i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
144 for(StorageIndex i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
146 StorageIndex info = internal::colamd(m, n, Alen, A.data(), p.data(), knobs, stats);
147 EIGEN_UNUSED_VARIABLE(info);
148 eigen_assert( info &&
"COLAMD failed " );
151 for (StorageIndex i = 0; i < n; i++) perm.
indices()(p(i)) = i;
A versatible sparse matrix representation.
Definition: SparseMatrix.h:92
Functor computing the natural ordering (identity)
Definition: Ordering.h:95
Functor computing the approximate minimum degree ordering If the matrix is not structurally symmetric...
Definition: Ordering.h:52
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:43
Definition: Ordering.h:118
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:61
const IndicesType & indices() const
const version of indices().
Definition: PermutationMatrix.h:388
IndexType colamd_recommended(IndexType nnz, IndexType n_row, IndexType n_col)
Returns the recommended value of Alen.
Definition: Ordering.h:258
void operator()(const MatrixType &, PermutationType &perm)
Compute the permutation vector from a column-major sparse matrix.
Definition: Ordering.h:102
Definition: BandTriangularSolver.h:13
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Compute the permutation with a selfadjoint matrix.
Definition: Ordering.h:74
void resize(Index newSize)
Resizes to given size.
Definition: PermutationMatrix.h:136