diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-08-24 00:02:22 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-08-24 00:02:22 -0400 |
commit | 09265496595c0b4abf2260332b26f086caf8efa1 (patch) | |
tree | 1865b4df10f09e1c6ae59cb85221c1cd8a938c65 /Eigen/src/Householder | |
parent | d38624b1ad3d34b25e35077fb2a19791fa9a1e03 (diff) |
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
Diffstat (limited to 'Eigen/src/Householder')
-rw-r--r-- | Eigen/src/Householder/Householder.h | 4 |
1 files 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<Derived>::makeHouseholder( EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) VectorBlock<Derived, EssentialPart::SizeAtCompileTime> 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); |