Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions
Eigen::COLAMDOrdering< Index > Class Template Reference

#include <Ordering.h>

Public Types

typedef PermutationMatrix< Dynamic, Dynamic, Index > PermutationType
 
typedef Matrix< Index, Dynamic, 1 > IndexVector
 

Public Member Functions

template<typename MatrixType >
void operator() (const MatrixType &mat, PermutationType &perm)
 

Detailed Description

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

Functor computing the column approximate minimum degree ordering The matrix should be in column-major format

Definition at line 115 of file Ordering.h.

Member Function Documentation

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

Compute the permutation vector form a sparse matrix

Definition at line 123 of file Ordering.h.

124  {
125  Index m = mat.rows();
126  Index n = mat.cols();
127  Index nnz = mat.nonZeros();
128  // Get the recommended value of Alen to be used by colamd
129  Index Alen = internal::colamd_recommended(nnz, m, n);
130  // Set the default parameters
131  double knobs [COLAMD_KNOBS];
132  Index stats [COLAMD_STATS];
134 
135  Index info;
136  IndexVector p(n+1), A(Alen);
137  for(Index i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
138  for(Index i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
139  // Call Colamd routine to compute the ordering
140  info = internal::colamd(m, n, Alen, A.data(), p.data(), knobs, stats);
141  eigen_assert( info && "COLAMD failed " );
142 
143  perm.resize(n);
144  for (Index i = 0; i < n; i++) perm.indices()(p(i)) = i;
145  }
static bool colamd(Index n_row, Index n_col, Index Alen, Index *A, Index *p, double knobs[COLAMD_KNOBS], Index stats[COLAMD_STATS])
Computes a column ordering using the column approximate minimum degree ordering.
Definition: Ordering.h:330
Index colamd_recommended(Index nnz, Index n_row, Index n_col)
Returns the recommended value of Alen.
Definition: Ordering.h:265
static void colamd_set_defaults(double knobs[COLAMD_KNOBS])
set default parameters The use of this routine is optional.
Definition: Ordering.h:294

The documentation for this class was generated from the following file: