mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
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
This commit is contained in:
parent
d38624b1ad
commit
0926549659
@ -74,10 +74,10 @@ void MatrixBase<Derived>::makeHouseholder(
|
|||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
|
||||||
VectorBlock<Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size()-1);
|
VectorBlock<Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size()-1);
|
||||||
|
|
||||||
RealScalar tailSqNorm;
|
RealScalar tailSqNorm = size()==1 ? 0 : tail.squaredNorm();
|
||||||
Scalar c0 = coeff(0);
|
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;
|
*tau = 0;
|
||||||
*beta = ei_real(c0);
|
*beta = ei_real(c0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user