From 3b5a9acba8ee5e08b801371122a7a544c8f26031 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 18 Sep 2009 11:41:38 +0200 Subject: [PATCH] fix stable_norm unit test --- Eigen/src/Householder/Householder.h | 8 ++++---- test/stable_norm.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index 36f02d7ce..775b2f872 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -55,12 +55,12 @@ void MatrixBase::makeHouseholderInPlace(Scalar *tau, RealScalar *beta) * \f$ H = I - tau v v^*\f$ * and the vector v is: * \f$ v^T = [1 essential^T] \f$ - * + * * On output: * \param essential the essential part of the vector \c v * \param tau the scaling factor of the householder transformation * \param beta the result of H * \c *this - * + * * \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(), * MatrixBase::applyHouseholderOnTheRight() */ @@ -73,10 +73,10 @@ void MatrixBase::makeHouseholder( { EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) VectorBlock tail(derived(), 1, size()-1); - + RealScalar tailSqNorm = size()==1 ? 0 : tail.squaredNorm(); Scalar c0 = coeff(0); - + if(tailSqNorm == RealScalar(0) && ei_imag(c0)==RealScalar(0)) { *tau = 0; diff --git a/test/stable_norm.cpp b/test/stable_norm.cpp index b8fbf5271..726512ec0 100644 --- a/test/stable_norm.cpp +++ b/test/stable_norm.cpp @@ -36,7 +36,7 @@ template void stable_norm(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - Scalar big = ei_random() * std::numeric_limits::max() * RealScalar(1e-4); + Scalar big = ei_abs(ei_random()) * (std::numeric_limits::max() * RealScalar(1e-4)); Scalar small = static_cast(1)/big; MatrixType vzero = MatrixType::Zero(rows, cols),