mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-06 14:14:46 +08:00
bug #985: RealQZ failed when either matrix had zero rows or columns (report and patch by Ben Goodrich)
Also added a regression test
(transplanted from 1efae98fee
)
This commit is contained in:
parent
bf650a3686
commit
0fb74c1f8b
@ -240,10 +240,10 @@ namespace Eigen {
|
|||||||
m_S.coeffRef(i,j) = Scalar(0.0);
|
m_S.coeffRef(i,j) = Scalar(0.0);
|
||||||
m_S.rightCols(dim-j-1).applyOnTheLeft(i-1,i,G.adjoint());
|
m_S.rightCols(dim-j-1).applyOnTheLeft(i-1,i,G.adjoint());
|
||||||
m_T.rightCols(dim-i+1).applyOnTheLeft(i-1,i,G.adjoint());
|
m_T.rightCols(dim-i+1).applyOnTheLeft(i-1,i,G.adjoint());
|
||||||
|
// update Q
|
||||||
|
if (m_computeQZ)
|
||||||
|
m_Q.applyOnTheRight(i-1,i,G);
|
||||||
}
|
}
|
||||||
// update Q
|
|
||||||
if (m_computeQZ)
|
|
||||||
m_Q.applyOnTheRight(i-1,i,G);
|
|
||||||
// kill T(i,i-1)
|
// kill T(i,i-1)
|
||||||
if(m_T.coeff(i,i-1)!=Scalar(0))
|
if(m_T.coeff(i,i-1)!=Scalar(0))
|
||||||
{
|
{
|
||||||
@ -251,10 +251,10 @@ namespace Eigen {
|
|||||||
m_T.coeffRef(i,i-1) = Scalar(0.0);
|
m_T.coeffRef(i,i-1) = Scalar(0.0);
|
||||||
m_S.applyOnTheRight(i,i-1,G);
|
m_S.applyOnTheRight(i,i-1,G);
|
||||||
m_T.topRows(i).applyOnTheRight(i,i-1,G);
|
m_T.topRows(i).applyOnTheRight(i,i-1,G);
|
||||||
|
// update Z
|
||||||
|
if (m_computeQZ)
|
||||||
|
m_Z.applyOnTheLeft(i,i-1,G.adjoint());
|
||||||
}
|
}
|
||||||
// update Z
|
|
||||||
if (m_computeQZ)
|
|
||||||
m_Z.applyOnTheLeft(i,i-1,G.adjoint());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,22 @@ template<typename MatrixType> void real_qz(const MatrixType& m)
|
|||||||
MatrixType A = MatrixType::Random(dim,dim),
|
MatrixType A = MatrixType::Random(dim,dim),
|
||||||
B = MatrixType::Random(dim,dim);
|
B = MatrixType::Random(dim,dim);
|
||||||
|
|
||||||
|
|
||||||
|
// Regression test for bug 985: Randomly set rows or columns to zero
|
||||||
|
Index k=internal::random<int>(0, dim-1);
|
||||||
|
switch(internal::random<int>(0,10)) {
|
||||||
|
case 0:
|
||||||
|
A.row(k).setZero(); break;
|
||||||
|
case 1:
|
||||||
|
A.col(k).setZero(); break;
|
||||||
|
case 2:
|
||||||
|
B.row(k).setZero(); break;
|
||||||
|
case 3:
|
||||||
|
B.col(k).setZero(); break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
RealQZ<MatrixType> qz(A,B);
|
RealQZ<MatrixType> qz(A,B);
|
||||||
|
|
||||||
VERIFY_IS_EQUAL(qz.info(), Success);
|
VERIFY_IS_EQUAL(qz.info(), Success);
|
||||||
|
Loading…
Reference in New Issue
Block a user