aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/OrderingMethods
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-06-20 14:43:47 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-06-20 14:43:47 +0200
commit98ef44fe55925ba8f144889c0ec42be9bf572cc3 (patch)
treead33a92f5d5a482865d0957dfdf35b4b41b45d0c /Eigen/src/OrderingMethods
parent1fdef63d1f935283eca4d7735722832eca179a80 (diff)
Add assertion and warning on the requirements of SparseQR and COLAMDOrdering
Diffstat (limited to 'Eigen/src/OrderingMethods')
-rw-r--r--Eigen/src/OrderingMethods/Ordering.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Eigen/src/OrderingMethods/Ordering.h b/Eigen/src/OrderingMethods/Ordering.h
index b4da6531a..4e0609784 100644
--- a/Eigen/src/OrderingMethods/Ordering.h
+++ b/Eigen/src/OrderingMethods/Ordering.h
@@ -109,7 +109,7 @@ class NaturalOrdering
* \class COLAMDOrdering
*
* Functor computing the \em column \em approximate \em minimum \em degree ordering
- * The matrix should be in column-major format
+ * The matrix should be in column-major and \b compressed format (see SparseMatrix::makeCompressed()).
*/
template<typename Index>
class COLAMDOrdering
@@ -118,10 +118,14 @@ class COLAMDOrdering
typedef PermutationMatrix<Dynamic, Dynamic, Index> PermutationType;
typedef Matrix<Index, Dynamic, 1> IndexVector;
- /** Compute the permutation vector form a sparse matrix */
+ /** Compute the permutation vector \a perm form the sparse matrix \a mat
+ * \warning The input sparse matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()).
+ */
template <typename MatrixType>
void operator() (const MatrixType& mat, PermutationType& perm)
{
+ eigen_assert(mat.isCompressed() && "COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
+
Index m = mat.rows();
Index n = mat.cols();
Index nnz = mat.nonZeros();