From 36c8a649238221cc370268b6d877e89caed8805f Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 28 Jan 2009 22:11:56 +0000 Subject: add MatrixBase::stableNorm() avoiding over/under-flow using it in QR reduced the error of Keir test from 1e-12 to 1e-24 but that's much more expensive ! --- test/adjoint.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/adjoint.cpp') diff --git a/test/adjoint.cpp b/test/adjoint.cpp index f553bad02..f0c321057 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -65,15 +65,18 @@ template void adjoint(const MatrixType& m) // check basic properties of dot, norm, norm2 typedef typename NumTraits::Real RealScalar; - VERIFY(ei_isApprox((s1 * v1 + s2 * v2).dot(v3), s1 * v1.dot(v3) + s2 * v2.dot(v3), largerEps)); - VERIFY(ei_isApprox(v3.dot(s1 * v1 + s2 * v2), ei_conj(s1)*v3.dot(v1)+ei_conj(s2)*v3.dot(v2), largerEps)); + VERIFY(ei_isApprox((s1 * v1 + s2 * v2).dot(v3), s1 * v1.dot(v3) + s2 * v2.dot(v3), largerEps)); + VERIFY(ei_isApprox(v3.dot(s1 * v1 + s2 * v2), ei_conj(s1)*v3.dot(v1)+ei_conj(s2)*v3.dot(v2), largerEps)); VERIFY_IS_APPROX(ei_conj(v1.dot(v2)), v2.dot(v1)); VERIFY_IS_APPROX(ei_abs(v1.dot(v1)), v1.squaredNorm()); if(NumTraits::HasFloatingPoint) - VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm()); + VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm()); VERIFY_IS_MUCH_SMALLER_THAN(ei_abs(vzero.dot(v1)), static_cast(1)); if(NumTraits::HasFloatingPoint) + { VERIFY_IS_MUCH_SMALLER_THAN(vzero.norm(), static_cast(1)); + VERIFY_IS_APPROX(v1.norm(), v1.stableNorm()); + } // check compatibility of dot and adjoint VERIFY(ei_isApprox(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), largerEps)); -- cgit v1.2.3