From 47fc3858b97c5c5f614c219a3dbd4955b3fea4f9 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 7 May 2009 18:40:06 +0000 Subject: oops, didn't want to commit that --- Eigen/src/Core/MathFunctions.h | 4 ++-- Eigen/src/LU/LU.h | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'Eigen/src') diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 3f2adf866..e201f98b2 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -103,7 +103,7 @@ inline bool ei_isApproxOrLessThan(int a, int b, int = precision()) *** float *** **************/ -template<> inline float precision() { return 1e-4f; } +template<> inline float precision() { return 1e-5f; } template<> inline float machine_epsilon() { return 1.192e-07f; } inline float ei_real(float x) { return x; } inline float ei_imag(float) { return 0.f; } @@ -149,7 +149,7 @@ inline bool ei_isApproxOrLessThan(float a, float b, float prec = precision inline double precision() { return 1e-13; } +template<> inline double precision() { return 1e-11; } template<> inline double machine_epsilon() { return 2.220e-16; } inline double ei_real(double x) { return x; } diff --git a/Eigen/src/LU/LU.h b/Eigen/src/LU/LU.h index d08224f34..a9d046c24 100644 --- a/Eigen/src/LU/LU.h +++ b/Eigen/src/LU/LU.h @@ -96,7 +96,7 @@ template class LU * * \param matrix the matrix of which to compute the LU decomposition. */ - LU(const MatrixType& matrix, const RealScalar& precision = precision()); + LU(const MatrixType& matrix); /** \returns the LU decomposition matrix: the upper-triangular part is U, the * unit-lower-triangular part is L (at least for square matrices; in the non-square @@ -323,16 +323,14 @@ template class LU IntRowVectorType m_q; int m_det_pq; int m_rank; - RealScalar m_precision; }; template -LU::LU(const MatrixType& matrix, const RealScalar& precision) +LU::LU(const MatrixType& matrix) : m_originalMatrix(matrix), m_lu(matrix), m_p(matrix.rows()), - m_q(matrix.cols()), - m_precision(precision) + m_q(matrix.cols()) { const int size = matrix.diagonal().size(); const int rows = matrix.rows(); @@ -357,7 +355,7 @@ LU::LU(const MatrixType& matrix, const RealScalar& precision) if(k==0) biggest = biggest_in_corner; // if the corner is negligible, then we have less than full rank, and we can finish early - if(ei_isMuchSmallerThan(biggest_in_corner, biggest, m_precision)) + if(ei_isMuchSmallerThan(biggest_in_corner, biggest)) { m_rank = k; for(int i = k; i < size; i++) @@ -508,7 +506,7 @@ bool LU::solve( RealScalar biggest_in_c = c.corner(TopLeft, m_rank, c.cols()).cwise().abs().maxCoeff(); for(int col = 0; col < c.cols(); ++col) for(int row = m_rank; row < c.rows(); ++row) - if(!ei_isMuchSmallerThan(c.coeff(row,col), biggest_in_c, m_precision)) + if(!ei_isMuchSmallerThan(c.coeff(row,col), biggest_in_c)) return false; } m_lu.corner(TopLeft, m_rank, m_rank) -- cgit v1.2.3