aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-09-18 11:41:38 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-09-18 11:41:38 +0200
commit3b5a9acba8ee5e08b801371122a7a544c8f26031 (patch)
treefafb82d9617e540d4070296ab3558e30b53962ee
parent0b426ea00d39d54e2a7e9e2aef93e7f17aa12a54 (diff)
fix stable_norm unit test
-rw-r--r--Eigen/src/Householder/Householder.h8
-rw-r--r--test/stable_norm.cpp2
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<Derived>::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<Derived>::makeHouseholder(
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
VectorBlock<Derived, EssentialPart::SizeAtCompileTime> 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<typename MatrixType> void stable_norm(const MatrixType& m)
int rows = m.rows();
int cols = m.cols();
- Scalar big = ei_random<Scalar>() * std::numeric_limits<RealScalar>::max() * RealScalar(1e-4);
+ Scalar big = ei_abs(ei_random<Scalar>()) * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4));
Scalar small = static_cast<RealScalar>(1)/big;
MatrixType vzero = MatrixType::Zero(rows, cols),