mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-15 13:15:57 +08:00
make LU::solve() not to crash when rank=0
(transplanted from fe813911f2fc3b5679c769a3624349a3e053ac63 )
This commit is contained in:
parent
47973c4963
commit
c9f7a19053
@ -508,7 +508,7 @@ bool LU<MatrixType>::solve(
|
|||||||
if(!isSurjective())
|
if(!isSurjective())
|
||||||
{
|
{
|
||||||
// is c is in the image of U ?
|
// is c is in the image of U ?
|
||||||
RealScalar biggest_in_c = c.corner(TopLeft, m_rank, c.cols()).cwise().abs().maxCoeff();
|
RealScalar biggest_in_c = m_rank>0 ? c.corner(TopLeft, m_rank, c.cols()).cwise().abs().maxCoeff() : 0;
|
||||||
for(int col = 0; col < c.cols(); ++col)
|
for(int col = 0; col < c.cols(); ++col)
|
||||||
for(int row = m_rank; row < c.rows(); ++row)
|
for(int row = m_rank; row < c.rows(); ++row)
|
||||||
if(!ei_isMuchSmallerThan(c.coeff(row,col), biggest_in_c, m_precision))
|
if(!ei_isMuchSmallerThan(c.coeff(row,col), biggest_in_c, m_precision))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user