MOAB  4.9.3pre
Eigen::COLAMDOrdering< StorageIndex > Class Template Reference

#include <Ordering.h>

List of all members.

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)

Detailed Description

template<typename StorageIndex>
class Eigen::COLAMDOrdering< StorageIndex >

Template Parameters:
StorageIndexThe 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.


Member Typedef Documentation

template<typename StorageIndex>
typedef Matrix<StorageIndex, Dynamic, 1> Eigen::COLAMDOrdering< StorageIndex >::IndexVector

Definition at line 122 of file Ordering.h.

template<typename StorageIndex>
typedef PermutationMatrix<Dynamic, Dynamic, StorageIndex> Eigen::COLAMDOrdering< StorageIndex >::PermutationType

Definition at line 121 of file Ordering.h.


Member Function Documentation

template<typename StorageIndex>
template<typename MatrixType >
void Eigen::COLAMDOrdering< StorageIndex >::operator() ( const MatrixType &  mat,
PermutationType perm 
) [inline]

Compute the permutation vector perm form the sparse matrix mat

Warning:
The input sparse matrix mat must be in compressed mode (see SparseMatrix::makeCompressed()).

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;
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines