diff --git a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h index 6d63d45e4..b7f8debb3 100644 --- a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +++ b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h @@ -93,21 +93,23 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut) * alternatively, on GMANE: * http://comments.gmane.org/gmane.comp.lib.eigen/3302 */ -template -class IncompleteLUT : public SparseSolverBase > +template +class IncompleteLUT : public SparseSolverBase > { protected: - typedef SparseSolverBase > Base; + typedef SparseSolverBase Base; using Base::m_isInitialized; public: typedef _Scalar Scalar; + typedef _StorageIndex StorageIndex; typedef typename NumTraits::Real RealScalar; typedef Matrix Vector; - typedef SparseMatrix FactorType; - typedef SparseMatrix PermutType; - typedef typename FactorType::StorageIndex StorageIndex; + typedef Matrix VectorI; + typedef SparseMatrix FactorType; public: + + // this typedef is only to export the scalar type and compile-time dimensions to solve_retval typedef Matrix MatrixType; IncompleteLUT() @@ -151,7 +153,7 @@ class IncompleteLUT : public SparseSolverBase > * **/ template - IncompleteLUT& compute(const MatrixType& amat) + IncompleteLUT& compute(const MatrixType& amat) { analyzePattern(amat); factorize(amat); @@ -197,8 +199,8 @@ protected: * Set control parameter droptol * \param droptol Drop any element whose magnitude is less than this tolerance **/ -template -void IncompleteLUT::setDroptol(const RealScalar& droptol) +template +void IncompleteLUT::setDroptol(const RealScalar& droptol) { this->m_droptol = droptol; } @@ -207,15 +209,15 @@ void IncompleteLUT::setDroptol(const RealScalar& droptol) * Set control parameter fillfactor * \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row. **/ -template -void IncompleteLUT::setFillfactor(int fillfactor) +template +void IncompleteLUT::setFillfactor(int fillfactor) { this->m_fillfactor = fillfactor; } -template +template template -void IncompleteLUT::analyzePattern(const _MatrixType& amat) +void IncompleteLUT::analyzePattern(const _MatrixType& amat) { // Compute the Fill-reducing permutation SparseMatrix mat1 = amat; @@ -232,9 +234,9 @@ void IncompleteLUT::analyzePattern(const _MatrixType& amat) m_analysisIsOk = true; } -template +template template -void IncompleteLUT::factorize(const _MatrixType& amat) +void IncompleteLUT::factorize(const _MatrixType& amat) { using std::sqrt; using std::swap; @@ -246,8 +248,8 @@ void IncompleteLUT::factorize(const _MatrixType& amat) m_lu.resize(n,n); // Declare Working vectors and variables Vector u(n) ; // real values of the row -- maximum size is n -- - VectorXi ju(n); // column position of the values in u -- maximum size is n - VectorXi jr(n); // Indicate the position of the nonzero elements in the vector u -- A zero location is indicated by -1 + VectorI ju(n); // column position of the values in u -- maximum size is n + VectorI jr(n); // Indicate the position of the nonzero elements in the vector u -- A zero location is indicated by -1 // Apply the fill-reducing permutation eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); @@ -398,7 +400,7 @@ void IncompleteLUT::factorize(const _MatrixType& amat) sizel = len; len = (std::min)(sizel, nnzL); typename Vector::SegmentReturnType ul(u.segment(0, sizel)); - typename VectorXi::SegmentReturnType jul(ju.segment(0, sizel)); + typename VectorI::SegmentReturnType jul(ju.segment(0, sizel)); internal::QuickSplit(ul, jul, len); // store the largest m_fill elements of the L part @@ -427,14 +429,13 @@ void IncompleteLUT::factorize(const _MatrixType& amat) sizeu = len + 1; // +1 to take into account the diagonal element len = (std::min)(sizeu, nnzU); typename Vector::SegmentReturnType uu(u.segment(ii+1, sizeu-1)); - typename VectorXi::SegmentReturnType juu(ju.segment(ii+1, sizeu-1)); + typename VectorI::SegmentReturnType juu(ju.segment(ii+1, sizeu-1)); internal::QuickSplit(uu, juu, len); // store the largest elements of the U part for(Index k = ii + 1; k < ii + len; k++) m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k); } - m_lu.finalize(); m_lu.makeCompressed(); diff --git a/test/bicgstab.cpp b/test/bicgstab.cpp index f327e2fac..6d76389ce 100644 --- a/test/bicgstab.cpp +++ b/test/bicgstab.cpp @@ -10,11 +10,11 @@ #include "sparse_solver.h" #include -template void test_bicgstab_T() +template void test_bicgstab_T() { - BiCGSTAB, DiagonalPreconditioner > bicgstab_colmajor_diag; - BiCGSTAB, IdentityPreconditioner > bicgstab_colmajor_I; - BiCGSTAB, IncompleteLUT > bicgstab_colmajor_ilut; + BiCGSTAB, DiagonalPreconditioner > bicgstab_colmajor_diag; + BiCGSTAB, IdentityPreconditioner > bicgstab_colmajor_I; + BiCGSTAB, IncompleteLUT > bicgstab_colmajor_ilut; //BiCGSTAB, SSORPreconditioner > bicgstab_colmajor_ssor; CALL_SUBTEST( check_sparse_square_solving(bicgstab_colmajor_diag) ); @@ -25,6 +25,7 @@ template void test_bicgstab_T() void test_bicgstab() { - CALL_SUBTEST_1(test_bicgstab_T()); - CALL_SUBTEST_2(test_bicgstab_T >()); + CALL_SUBTEST_1((test_bicgstab_T()) ); + CALL_SUBTEST_1((test_bicgstab_T())); + CALL_SUBTEST_2((test_bicgstab_T, int>())); }