11#ifndef EIGEN_ORDERING_H
12#define EIGEN_ORDERING_H
16#include "Eigen_Colamd.h"
26template<
typename MatrixType>
27void 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)
34 it.valueRef() =
typename MatrixType::Scalar(0);
49template <
typename StorageIndex>
58 template <
typename MatrixType>
63 internal::ordering_helper_at_plus_a(
mat,
symm);
67 internal::minimum_degree_ordering(
symm, perm);
71 template <
typename SrcType,
unsigned int SrcUpLo>
78 internal::minimum_degree_ordering(C, perm);
90template <
typename StorageIndex>
97 template <
typename MatrixType>
113template<
typename StorageIndex>
123 template <
typename MatrixType>
126 eigen_assert(
mat.isCompressed() &&
"COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
128 StorageIndex m = StorageIndex(
mat.rows());
129 StorageIndex n = StorageIndex(
mat.cols());
132 StorageIndex
Alen = internal::Colamd::recommended(nnz, m, n);
134 double knobs [internal::Colamd::NKnobs];
135 StorageIndex stats [internal::Colamd::NStats];
136 internal::Colamd::set_defaults(
knobs);
139 for(StorageIndex i=0; i <= n; i++) p(i) =
mat.outerIndexPtr()[i];
140 for(StorageIndex i=0; i < nnz; i++) A(i) =
mat.innerIndexPtr()[i];
142 StorageIndex info = internal::Colamd::compute_ordering(m, n,
Alen, A.data(), p.data(),
knobs, stats);
143 EIGEN_UNUSED_VARIABLE(info);
144 eigen_assert( info &&
"COLAMD failed " );
147 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:51
void operator()(const SparseSelfAdjointView< SrcType, SrcUpLo > &mat, PermutationType &perm)
Compute the permutation with a selfadjoint matrix.
Definition Ordering.h:72
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:59
Definition Ordering.h:115
void operator()(const MatrixType &mat, PermutationType &perm)
Compute the permutation vector perm form the sparse matrix mat.
Definition Ordering.h:124
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index nonZeros() const
Definition DenseBase.h:215
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Functor computing the natural ordering (identity)
Definition Ordering.h:92
void operator()(const MatrixType &, PermutationType &perm)
Compute the permutation vector from a column-major sparse matrix.
Definition Ordering.h:98
void resize(Index newSize)
Resizes to given size.
Definition PermutationMatrix.h:125
const IndicesType & indices() const
const version of indices().
Definition PermutationMatrix.h:360
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16