Commit cdec5820 authored by Davis King's avatar Davis King

Adjusted the epsilon to avoid false positives.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402867
parent 465d0763
...@@ -26,7 +26,7 @@ namespace ...@@ -26,7 +26,7 @@ namespace
logger dlog("test.matrix3"); logger dlog("test.matrix3");
const double eps_mul = 500000; const double eps_mul = 200;
template <typename T, typename U> template <typename T, typename U>
void check_equal ( void check_equal (
...@@ -42,8 +42,8 @@ namespace ...@@ -42,8 +42,8 @@ namespace
for (long c = 0; c < a.nc(); ++c) for (long c = 0; c < a.nc(); ++c)
{ {
type error = std::abs(a(r,c) - b(r,c)); type error = std::abs(a(r,c) - b(r,c));
DLIB_CASSERT(error < std::numeric_limits<type>::epsilon()*eps_mul, "error: " << error << DLIB_CASSERT(error < std::sqrt(std::numeric_limits<type>::epsilon())*eps_mul, "error: " << error <<
" eps: " << std::numeric_limits<type>::epsilon()*eps_mul); " eps: " << std::sqrt(std::numeric_limits<type>::epsilon())*eps_mul);
} }
} }
} }
...@@ -62,8 +62,8 @@ namespace ...@@ -62,8 +62,8 @@ namespace
for (long c = 0; c < a.nc(); ++c) for (long c = 0; c < a.nc(); ++c)
{ {
typename type::value_type error = std::abs(a(r,c) - b(r,c)); typename type::value_type error = std::abs(a(r,c) - b(r,c));
DLIB_CASSERT(error < std::numeric_limits<typename type::value_type>::epsilon()*eps_mul, "error: " << error << DLIB_CASSERT(error < std::sqrt(std::numeric_limits<typename type::value_type>::epsilon())*eps_mul, "error: " << error <<
" eps: " << std::numeric_limits<typename type::value_type>::epsilon()*eps_mul); " eps: " << std::sqrt(std::numeric_limits<typename type::value_type>::epsilon())*eps_mul);
} }
} }
} }
...@@ -470,8 +470,8 @@ namespace ...@@ -470,8 +470,8 @@ namespace
c_check_equal( tmp(c_temp + conj(c_rv4)*c_cv4), c_temp + conj(c_rv4)*c_cv4); c_check_equal( tmp(c_temp + conj(c_rv4)*c_cv4), c_temp + conj(c_rv4)*c_cv4);
c_check_equal( tmp(c_temp + trans(conj(c_cv4))*trans(c_rv4)), c_temp + trans(conj(c_cv4))*trans(c_rv4)); c_check_equal( tmp(c_temp + trans(conj(c_cv4))*trans(c_rv4)), c_temp + trans(conj(c_cv4))*trans(c_rv4));
DLIB_CASSERT(abs((static_cast<complex<type> >(c_rv4*c_cv4) + i) - ((c_rv4*c_cv4)(0) + i)) < std::numeric_limits<type>::epsilon()*eps_mul ,""); DLIB_CASSERT(abs((static_cast<complex<type> >(c_rv4*c_cv4) + i) - ((c_rv4*c_cv4)(0) + i)) < std::sqrt(std::numeric_limits<type>::epsilon())*eps_mul ,"");
DLIB_CASSERT(abs((rv4*cv4 + 1.0) - ((rv4*cv4)(0) + 1.0)) < std::numeric_limits<type>::epsilon()*eps_mul,""); DLIB_CASSERT(abs((rv4*cv4 + 1.0) - ((rv4*cv4)(0) + 1.0)) < std::sqrt(std::numeric_limits<type>::epsilon())*eps_mul,"");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment