11#ifndef EIGEN_ORDERING_H
12#define EIGEN_ORDERING_H
16#include "Eigen_Colamd.h"
25template<
typename MatrixType>
26void 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
50template <
typename StorageIndex>
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);
93template <
typename StorageIndex>
100 template <
typename MatrixType>
116template<
typename StorageIndex>
126 template <
typename MatrixType>
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);
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;
Functor computing the approximate minimum degree ordering If the matrix is not structurally symmetric...
Definition Ordering.h:52
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Compute the permutation with a selfadjoint matrix.
Definition Ordering.h:73
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
Definition Ordering.h:118
void operator()(const MatrixType &mat, PermutationType &perm)
Compute the permutation vector perm form the sparse matrix mat.
Definition Ordering.h:127
Functor computing the natural ordering (identity)
Definition Ordering.h:95
void operator()(const MatrixType &, PermutationType &perm)
Compute the permutation vector from a column-major sparse matrix.
Definition Ordering.h:101
void resize(Index newSize)
Resizes to given size.
Definition PermutationMatrix.h:137
const IndicesType & indices() const
const version of indices().
Definition PermutationMatrix.h:390
Pseudo expression representing a solving operation.
Definition Solve.h:63