aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/adjoint.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-01-28 22:11:56 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-01-28 22:11:56 +0000
commit36c8a649238221cc370268b6d877e89caed8805f (patch)
tree5af31a0301460e954ff867737899ac4d60c27196 /test/adjoint.cpp
parent42b237b83a16739c586f139db2e6da928b717b84 (diff)
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 !
Diffstat (limited to 'test/adjoint.cpp')
-rw-r--r--test/adjoint.cpp9
1 files changed, 6 insertions, 3 deletions
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<typename MatrixType> void adjoint(const MatrixType& m)
// check basic properties of dot, norm, norm2
typedef typename NumTraits<Scalar>::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<Scalar>::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<RealScalar>(1));
if(NumTraits<Scalar>::HasFloatingPoint)
+ {
VERIFY_IS_MUCH_SMALLER_THAN(vzero.norm(), static_cast<RealScalar>(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));