|
MOAB
4.9.3pre
|
#include <Ordering.h>
Public Types | |
| typedef PermutationMatrix < Dynamic, Dynamic, StorageIndex > | PermutationType |
| typedef Matrix< StorageIndex, Dynamic, 1 > | IndexVector |
Public Member Functions | |
| template<typename MatrixType > | |
| void | operator() (const MatrixType &mat, PermutationType &perm) |
| StorageIndex | The type of indices of the matrix |
Functor computing the column approximate minimum degree ordering The matrix should be in column-major and compressed format (see SparseMatrix::makeCompressed()).
Definition at line 118 of file Ordering.h.
| typedef Matrix<StorageIndex, Dynamic, 1> Eigen::COLAMDOrdering< StorageIndex >::IndexVector |
Definition at line 122 of file Ordering.h.
| typedef PermutationMatrix<Dynamic, Dynamic, StorageIndex> Eigen::COLAMDOrdering< StorageIndex >::PermutationType |
Definition at line 121 of file Ordering.h.
| void Eigen::COLAMDOrdering< StorageIndex >::operator() | ( | const MatrixType & | mat, |
| PermutationType & | perm | ||
| ) | [inline] |
Compute the permutation vector perm form the sparse matrix mat
Definition at line 128 of file Ordering.h.
{
eigen_assert(mat.isCompressed() && "COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
StorageIndex m = StorageIndex(mat.rows());
StorageIndex n = StorageIndex(mat.cols());
StorageIndex nnz = StorageIndex(mat.nonZeros());
// Get the recommended value of Alen to be used by colamd
StorageIndex Alen = internal::colamd_recommended(nnz, m, n);
// Set the default parameters
double knobs [COLAMD_KNOBS];
StorageIndex stats [COLAMD_STATS];
internal::colamd_set_defaults(knobs);
IndexVector p(n+1), A(Alen);
for(StorageIndex i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
for(StorageIndex i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
// Call Colamd routine to compute the ordering
StorageIndex info = internal::colamd(m, n, Alen, A.data(), p.data(), knobs, stats);
EIGEN_UNUSED_VARIABLE(info);
eigen_assert( info && "COLAMD failed " );
perm.resize(n);
for (StorageIndex i = 0; i < n; i++) perm.indices()(p(i)) = i;
}