11 #ifndef EIGEN_ORDERING_H 12 #define EIGEN_ORDERING_H 26 template<
typename MatrixType>
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)
64 SparseMatrix<typename MatrixType::Scalar, ColMajor, StorageIndex> symm;
73 template <
typename SrcType,
unsigned int SrcUpLo>
76 SparseMatrix<typename SrcType::Scalar, ColMajor, StorageIndex> C; C = mat;
84 #endif // EIGEN_MPL2_ONLY 94 template <
typename StorageIndex>
101 template <
typename MatrixType>
102 void operator()(
const MatrixType& , PermutationType& perm)
117 template<
typename StorageIndex>
121 typedef PermutationMatrix<Dynamic, Dynamic, StorageIndex> PermutationType;
122 typedef Matrix<StorageIndex, Dynamic, 1> IndexVector;
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());
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);
151 for (StorageIndex i = 0; i < n; i++) perm.
indices()(p(i)) = i;
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
PermutationMatrix< Dynamic, Dynamic, StorageIndex > PermutationType
void ordering_helper_at_plus_a(const MatrixType &A, MatrixType &symmat)
PermutationMatrix< Dynamic, Dynamic, StorageIndex > PermutationType
IndexType colamd_recommended(IndexType nnz, IndexType n_row, IndexType n_col)
Returns the recommended value of Alen.
void minimum_degree_ordering(SparseMatrix< Scalar, ColMajor, StorageIndex > &C, PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm)
static bool colamd(IndexType n_row, IndexType n_col, IndexType Alen, IndexType *A, IndexType *p, double knobs[COLAMD_KNOBS], IndexType stats[COLAMD_STATS])
Computes a column ordering using the column approximate minimum degree ordering.
static void colamd_set_defaults(double knobs[COLAMD_KNOBS])
set default parameters The use of this routine is optional.
const IndicesType & indices() const
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
void resize(Index newSize)
#define EIGEN_UNUSED_VARIABLE(var)