From 09265496595c0b4abf2260332b26f086caf8efa1 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 24 Aug 2009 00:02:22 -0400 Subject: [PATCH] fix bug: with complex matrices, the condition (ei_imag(c0)==RealScalar(0)) being wrong could bypass the other condition in the &&. at least that's my explanation why the test_lu was often failing on complex matrices (it uses that via createRandomMatrixOfRank) and why that's fixed by this diff. also gcc 4.4 gave a warning about tailSqNorm potentially uninitialized --- Eigen/src/Householder/Householder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index 8a274d240..ea39e4c30 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -74,10 +74,10 @@ void MatrixBase::makeHouseholder( EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) VectorBlock tail(derived(), 1, size()-1); - RealScalar tailSqNorm; + RealScalar tailSqNorm = size()==1 ? 0 : tail.squaredNorm(); Scalar c0 = coeff(0); - if( (size()==1 || (tailSqNorm=tail.squaredNorm()) == RealScalar(0)) && ei_imag(c0)==RealScalar(0)) + if( tailSqNorm == RealScalar(0) && ei_imag(c0)==RealScalar(0)) { *tau = 0; *beta = ei_real(c0);