SparseLU: make COLAMDOrdering the default ordering method.

This commit is contained in:
Gael Guennebaud 2013-07-17 09:30:25 +02:00
parent bd689ccc28
commit bbaef8ebba
2 changed files with 59 additions and 56 deletions

View File

@ -14,9 +14,10 @@
namespace Eigen { namespace Eigen {
template <typename _MatrixType, typename _OrderingType> class SparseLU; template <typename _MatrixType, typename _OrderingType = COLAMDOrdering<typename _MatrixType::Index> > class SparseLU;
template <typename MappedSparseMatrixType> struct SparseLUMatrixLReturnType; template <typename MappedSparseMatrixType> struct SparseLUMatrixLReturnType;
template <typename MatrixLType, typename MatrixUType> struct SparseLUMatrixUReturnType; template <typename MatrixLType, typename MatrixUType> struct SparseLUMatrixUReturnType;
/** \ingroup SparseLU_Module /** \ingroup SparseLU_Module
* \class SparseLU * \class SparseLU
* *
@ -62,7 +63,7 @@ template <typename MatrixLType, typename MatrixUType> struct SparseLUMatrixURetu
* "unsupported/Eigen/src/IterativeSolvers/Scaling.h" * "unsupported/Eigen/src/IterativeSolvers/Scaling.h"
* *
* \tparam _MatrixType The type of the sparse matrix. It must be a column-major SparseMatrix<> * \tparam _MatrixType The type of the sparse matrix. It must be a column-major SparseMatrix<>
* \tparam _OrderingType The ordering method to use, either AMD, COLAMD or METIS * \tparam _OrderingType The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD
* *
* *
* \sa \ref TutorialSparseDirectSolvers * \sa \ref TutorialSparseDirectSolvers
@ -208,6 +209,7 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
eigen_assert(m_isInitialized && "Decomposition is not initialized."); eigen_assert(m_isInitialized && "Decomposition is not initialized.");
return m_info; return m_info;
} }
/** /**
* \returns A string describing the type of error * \returns A string describing the type of error
*/ */
@ -240,6 +242,7 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
return true; return true;
} }
/** /**
* \returns the absolute value of the determinant of the matrix of which * \returns the absolute value of the determinant of the matrix of which
* *this is the QR decomposition. * *this is the QR decomposition.
@ -276,8 +279,8 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
* of which **this is the QR decomposition * of which **this is the QR decomposition
* *
* \note This method is useful to work around the risk of overflow/underflow that's * \note This method is useful to work around the risk of overflow/underflow that's
* inherent to the determinant computation * inherent to the determinant computation.
*a *
* \sa absDeterminant(), signDeterminant() * \sa absDeterminant(), signDeterminant()
*/ */
Scalar logAbsDeterminant() const Scalar logAbsDeterminant() const

View File

@ -26,7 +26,7 @@
// SparseLU solve does not accept column major matrices for the destination. // SparseLU solve does not accept column major matrices for the destination.
// However, as expected, the generic check_sparse_square_solving routines produces row-major // However, as expected, the generic check_sparse_square_solving routines produces row-major
// rhs and destination matrices when compiled with EIGEN_DEFAULT_TO_ROW_MAJOR // rhs and destination matrices when compiled with EIGEN_DEFAULT_TO_ROW_MAJOR
//
#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
#undef EIGEN_DEFAULT_TO_ROW_MAJOR #undef EIGEN_DEFAULT_TO_ROW_MAJOR
#endif #endif
@ -37,7 +37,7 @@
template<typename T> void test_sparselu_T() template<typename T> void test_sparselu_T()
{ {
SparseLU<SparseMatrix<T, ColMajor>, COLAMDOrdering<int> > sparselu_colamd; SparseLU<SparseMatrix<T, ColMajor> /*, COLAMDOrdering<int>*/ > sparselu_colamd; // COLAMDOrdering is the default
SparseLU<SparseMatrix<T, ColMajor>, AMDOrdering<int> > sparselu_amd; SparseLU<SparseMatrix<T, ColMajor>, AMDOrdering<int> > sparselu_amd;
SparseLU<SparseMatrix<T, ColMajor, long int>, NaturalOrdering<long int> > sparselu_natural; SparseLU<SparseMatrix<T, ColMajor, long int>, NaturalOrdering<long int> > sparselu_natural;