diff options
-rw-r--r-- | cmake/FindTaucs.cmake | 30 | ||||
-rw-r--r-- | doc/unsupported_modules.dox | 3 | ||||
-rw-r--r-- | unsupported/Eigen/CMakeLists.txt | 2 | ||||
-rw-r--r-- | unsupported/Eigen/SparseExtra | 10 | ||||
-rw-r--r-- | unsupported/Eigen/TaucsSupport | 48 | ||||
-rw-r--r-- | unsupported/Eigen/src/SparseExtra/TaucsSupport.h | 219 | ||||
-rw-r--r-- | unsupported/test/CMakeLists.txt | 10 | ||||
-rw-r--r-- | unsupported/test/sparse_ldlt.cpp | 4 | ||||
-rw-r--r-- | unsupported/test/sparse_llt.cpp | 21 |
9 files changed, 1 insertions, 346 deletions
diff --git a/cmake/FindTaucs.cmake b/cmake/FindTaucs.cmake deleted file mode 100644 index f1615b87c..000000000 --- a/cmake/FindTaucs.cmake +++ /dev/null @@ -1,30 +0,0 @@ - -if (TAUCS_INCLUDES AND TAUCS_LIBRARIES) - set(TAUCS_FIND_QUIETLY TRUE) -endif (TAUCS_INCLUDES AND TAUCS_LIBRARIES) - -find_package(LAPACK) - -if(LAPACK_FOUND) - - find_path(TAUCS_INCLUDES - NAMES - taucs.h - PATHS - $ENV{TAUCSDIR} - ${INCLUDE_INSTALL_DIR} - ) - - find_library(TAUCS_LIBRARIES taucs PATHS $ENV{TAUCSDIR} ${LIB_INSTALL_DIR}) - - if(TAUCS_LIBRARIES) - set(TAUCS_LIBRARIES ${TAUCS_LIBRARIES} ${LAPACK_LIBRARIES}) - endif(TAUCS_LIBRARIES) - -endif(LAPACK_FOUND) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(TAUCS DEFAULT_MSG - TAUCS_INCLUDES TAUCS_LIBRARIES) - -mark_as_advanced(TAUCS_INCLUDES TAUCS_LIBRARIES) diff --git a/doc/unsupported_modules.dox b/doc/unsupported_modules.dox index 9f0517c4c..1d303c25e 100644 --- a/doc/unsupported_modules.dox +++ b/doc/unsupported_modules.dox @@ -53,9 +53,6 @@ namespace Eigen { * \defgroup SuperLUSupport_Module */ /** \ingroup Unsupported_modules - * \defgroup TaucsSupport_Module */ - -/** \ingroup Unsupported_modules * \defgroup UmfPackSupport_Module */ /** \ingroup Unsupported_modules diff --git a/unsupported/Eigen/CMakeLists.txt b/unsupported/Eigen/CMakeLists.txt index a858e5113..024ac2738 100644 --- a/unsupported/Eigen/CMakeLists.txt +++ b/unsupported/Eigen/CMakeLists.txt @@ -1,6 +1,6 @@ set(Eigen_HEADERS AdolcForward BVH IterativeSolvers MatrixFunctions MoreVectorization AutoDiff AlignedVector3 Polynomials CholmodSupport FFT NonLinearOptimization SparseExtra SuperLUSupport UmfPackSupport IterativeSolvers - NumericalDiff Skyline TaucsSupport MPRealSupport + NumericalDiff Skyline MPRealSupport ) install(FILES diff --git a/unsupported/Eigen/SparseExtra b/unsupported/Eigen/SparseExtra index 54a011f26..712a63271 100644 --- a/unsupported/Eigen/SparseExtra +++ b/unsupported/Eigen/SparseExtra @@ -29,16 +29,6 @@ namespace Eigen { struct DefaultBackend {}; -/* -enum SparseBackend { - DefaultBackend, - Taucs, - Cholmod, - SuperLU, - UmfPack -}; -*/ - // solver flags enum { diff --git a/unsupported/Eigen/TaucsSupport b/unsupported/Eigen/TaucsSupport deleted file mode 100644 index dca2c095b..000000000 --- a/unsupported/Eigen/TaucsSupport +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef EIGEN_TAUCSSUPPORT_MODULE_H -#define EIGEN_TAUCSSUPPORT_MODULE_H - -#include "SparseExtra" - -#include "src/Core/util/DisableMSVCWarnings.h" - -// taucs.h declares a lot of mess -#define isnan -#define finite -#define isinf -extern "C" { - #include <taucs.h> -} -#undef isnan -#undef finite -#undef isinf - -#ifdef min - #undef min -#endif -#ifdef max - #undef max -#endif -#ifdef complex - #undef complex -#endif - -namespace Eigen { - -/** \ingroup Unsupported_modules - * \defgroup TaucsSupport_Module Taucs support module - * - * - * - * - * \code - * #include <Eigen/TaucsSupport> - * \endcode - */ - -# include "src/SparseExtra/TaucsSupport.h" - -} // namespace Eigen - -#include "src/Core/util/EnableMSVCWarnings.h" - -#endif // EIGEN_TAUCSSUPPORT_MODULE_H diff --git a/unsupported/Eigen/src/SparseExtra/TaucsSupport.h b/unsupported/Eigen/src/SparseExtra/TaucsSupport.h deleted file mode 100644 index efc89b596..000000000 --- a/unsupported/Eigen/src/SparseExtra/TaucsSupport.h +++ /dev/null @@ -1,219 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr> -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see <http://www.gnu.org/licenses/>. - -#ifndef EIGEN_TAUCSSUPPORT_H -#define EIGEN_TAUCSSUPPORT_H - -template<typename MatrixType> -taucs_ccs_matrix ei_asTaucsMatrix(MatrixType& mat) -{ - typedef typename MatrixType::Scalar Scalar; -enum { Flags = MatrixType::Flags }; - taucs_ccs_matrix res; - res.n = mat.cols(); - res.m = mat.rows(); - res.flags = 0; - res.colptr = mat._outerIndexPtr(); - res.rowind = mat._innerIndexPtr(); - res.values.v = mat._valuePtr(); - if (ei_is_same_type<Scalar,int>::ret) - res.flags |= TAUCS_INT; - else if (ei_is_same_type<Scalar,float>::ret) - res.flags |= TAUCS_SINGLE; - else if (ei_is_same_type<Scalar,double>::ret) - res.flags |= TAUCS_DOUBLE; - else if (ei_is_same_type<Scalar,std::complex<float> >::ret) - res.flags |= TAUCS_SCOMPLEX; - else if (ei_is_same_type<Scalar,std::complex<double> >::ret) - res.flags |= TAUCS_DCOMPLEX; - else - { - ei_assert(false && "Scalar type not supported by TAUCS"); - } - - // FIXME 1) shapes are not in the Flags and 2) it seems Taucs ignores these flags anyway and only accept lower symmetric matrices - if (Flags & Upper) - res.flags |= TAUCS_UPPER; - if (Flags & Lower) - res.flags |= TAUCS_LOWER; - if (Flags & SelfAdjoint) - res.flags |= (NumTraits<Scalar>::IsComplex ? TAUCS_HERMITIAN : TAUCS_SYMMETRIC); - else if ((Flags & Upper) || (Flags & Lower)) - res.flags |= TAUCS_TRIANGULAR; - - return res; -} - -template<typename Scalar, int Flags, typename Index> -MappedSparseMatrix<Scalar,Flags,Index> ei_map_taucs(taucs_ccs_matrix& taucsMat) -{ - return MappedSparseMatrix<Scalar,Flags,Index> - (taucsMat.m, taucsMat.n, taucsMat.colptr[taucsMat.n], - taucsMat.colptr, taucsMat.rowind, reinterpret_cast<Scalar*>(taucsMat.values.v)); -} - -template<typename MatrixType> -class SparseLLT<MatrixType,Taucs> : public SparseLLT<MatrixType> -{ - protected: - typedef SparseLLT<MatrixType> Base; - typedef typename Base::Index Index; - typedef typename Base::Scalar Scalar; - typedef typename Base::RealScalar RealScalar; - typedef typename Base::CholMatrixType CholMatrixType; - using Base::MatrixLIsDirty; - using Base::SupernodalFactorIsDirty; - using Base::m_flags; - using Base::m_matrix; - using Base::m_status; - using Base::m_succeeded; - - public: - - SparseLLT(int flags = SupernodalMultifrontal) - : Base(flags), m_taucsSupernodalFactor(0) - { - } - - SparseLLT(const MatrixType& matrix, int flags = SupernodalMultifrontal) - : Base(flags), m_taucsSupernodalFactor(0) - { - compute(matrix); - } - - ~SparseLLT() - { - if (m_taucsSupernodalFactor) - taucs_supernodal_factor_free(m_taucsSupernodalFactor); - } - - inline const CholMatrixType& matrixL() const; - - template<typename Derived> - void solveInPlace(MatrixBase<Derived> &b) const; - - void compute(const MatrixType& matrix); - - protected: - void* m_taucsSupernodalFactor; -}; - -template<typename MatrixType> -void SparseLLT<MatrixType,Taucs>::compute(const MatrixType& a) -{ - if (m_taucsSupernodalFactor) - { - taucs_supernodal_factor_free(m_taucsSupernodalFactor); - m_taucsSupernodalFactor = 0; - } - - taucs_ccs_matrix taucsMatA = ei_asTaucsMatrix(const_cast<MatrixType&>(a)); - - if (m_flags & IncompleteFactorization) - { - taucs_ccs_matrix* taucsRes = taucs_ccs_factor_llt(&taucsMatA, Base::m_precision, 0); - if(!taucsRes) - { - m_succeeded = false; - return; - } - // the matrix returned by Taucs is not necessarily sorted, - // so let's copy it in two steps - DynamicSparseMatrix<Scalar,RowMajor> tmp = ei_map_taucs<Scalar,ColMajor,Index>(*taucsRes); - m_matrix = tmp; - free(taucsRes); - m_status = (m_status & ~(CompleteFactorization|MatrixLIsDirty)) - | IncompleteFactorization - | SupernodalFactorIsDirty; - } - else - { - if ( (m_flags & SupernodalLeftLooking) - || ((!(m_flags & SupernodalMultifrontal)) && (m_flags & MemoryEfficient)) ) - { - m_taucsSupernodalFactor = taucs_ccs_factor_llt_ll(&taucsMatA); - } - else - { - // use the faster Multifrontal routine - m_taucsSupernodalFactor = taucs_ccs_factor_llt_mf(&taucsMatA); - } - m_status = (m_status & ~IncompleteFactorization) | CompleteFactorization | MatrixLIsDirty; - } - m_succeeded = true; -} - -template<typename MatrixType> -inline const typename SparseLLT<MatrixType,Taucs>::CholMatrixType& -SparseLLT<MatrixType,Taucs>::matrixL() const -{ - if (m_status & MatrixLIsDirty) - { - ei_assert(!(m_status & SupernodalFactorIsDirty)); - - taucs_ccs_matrix* taucsL = taucs_supernodal_factor_to_ccs(m_taucsSupernodalFactor); - - // the matrix returned by Taucs is not necessarily sorted, - // so let's copy it in two steps - DynamicSparseMatrix<Scalar,RowMajor> tmp = ei_map_taucs<Scalar,ColMajor,Index>(*taucsL); - const_cast<typename Base::CholMatrixType&>(m_matrix) = tmp; - free(taucsL); - m_status = (m_status & ~MatrixLIsDirty); - } - return m_matrix; -} - -template<typename MatrixType> -template<typename Derived> -void SparseLLT<MatrixType,Taucs>::solveInPlace(MatrixBase<Derived> &b) const -{ - bool inputIsCompatibleWithTaucs = (Derived::Flags&RowMajorBit)==0; - - if (!inputIsCompatibleWithTaucs) - { - matrixL(); - Base::solveInPlace(b); - } - else if (m_flags & IncompleteFactorization) - { - taucs_ccs_matrix taucsLLT = ei_asTaucsMatrix(const_cast<typename Base::CholMatrixType&>(m_matrix)); - typename ei_plain_matrix_type<Derived>::type x(b.rows()); - for (int j=0; j<b.cols(); ++j) - { - taucs_ccs_solve_llt(&taucsLLT,x.data(),&b.col(j).coeffRef(0)); - b.col(j) = x; - } - } - else - { - typename ei_plain_matrix_type<Derived>::type x(b.rows()); - for (int j=0; j<b.cols(); ++j) - { - taucs_supernodal_solve_llt(m_taucsSupernodalFactor,x.data(),&b.col(j).coeffRef(0)); - b.col(j) = x; - } - } -} - -#endif // EIGEN_TAUCSSUPPORT_H diff --git a/unsupported/test/CMakeLists.txt b/unsupported/test/CMakeLists.txt index 4e81692c6..f6e561914 100644 --- a/unsupported/test/CMakeLists.txt +++ b/unsupported/test/CMakeLists.txt @@ -2,16 +2,6 @@ find_package(Adolc) set(SPARSE_LIBS "") -find_package(Taucs) -if(TAUCS_FOUND) - add_definitions("-DEIGEN_TAUCS_SUPPORT") - include_directories(${TAUCS_INCLUDES}) - set(SPARSE_LIBS ${SPARSE_LIBS} ${TAUCS_LIBRARIES}) - ei_add_property(EIGEN_TESTED_BACKENDS "Taucs, ") -else(TAUCS_FOUND) - ei_add_property(EIGEN_MISSING_BACKENDS "Taucs, ") -endif(TAUCS_FOUND) - find_package(Cholmod) if(CHOLMOD_FOUND) add_definitions("-DEIGEN_CHOLMOD_SUPPORT") diff --git a/unsupported/test/sparse_ldlt.cpp b/unsupported/test/sparse_ldlt.cpp index 79488d6af..5af4b77b4 100644 --- a/unsupported/test/sparse_ldlt.cpp +++ b/unsupported/test/sparse_ldlt.cpp @@ -29,10 +29,6 @@ #include <Eigen/CholmodSupport> #endif -#ifdef EIGEN_TAUCS_SUPPORT -#include <Eigen/TaucsSupport> -#endif - template<typename Scalar> void sparse_ldlt(int rows, int cols) { double density = std::max(8./(rows*cols), 0.01); diff --git a/unsupported/test/sparse_llt.cpp b/unsupported/test/sparse_llt.cpp index 93d9f4217..72a8382a1 100644 --- a/unsupported/test/sparse_llt.cpp +++ b/unsupported/test/sparse_llt.cpp @@ -29,10 +29,6 @@ #include <Eigen/CholmodSupport> #endif -#ifdef EIGEN_TAUCS_SUPPORT -#include <Eigen/TaucsSupport> -#endif - template<typename Scalar> void sparse_llt(int rows, int cols) { double density = std::max(8./(rows*cols), 0.01); @@ -76,23 +72,6 @@ template<typename Scalar> void sparse_llt(int rows, int cols) } #endif - - #ifdef EIGEN_TAUCS_SUPPORT - // TODO fix TAUCS with complexes - if (!NumTraits<Scalar>::IsComplex) - { - x = b; -// SparseLLT<SparseMatrix<Scalar> ,Taucs>(m2,IncompleteFactorization).solveInPlace(x); -// VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LLT: taucs (IncompleteFactorization)"); - - x = b; - SparseLLT<SparseMatrix<Scalar>, Taucs>(m2,SupernodalMultifrontal).solveInPlace(x); - VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LLT: taucs (SupernodalMultifrontal)"); - x = b; - SparseLLT<SparseMatrix<Scalar>, Taucs>(m2,SupernodalLeftLooking).solveInPlace(x); - VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LLT: taucs (SupernodalLeftLooking)"); - } - #endif } void test_sparse_llt() |