bug #1669: fix PartialPivLU/inverse with zero-sized matrices.

(grafted from 8a06c699d0
)
This commit is contained in:
Gael Guennebaud
2019-01-29 10:27:13 +01:00
parent 7b160dcc82
commit c30beb5974
2 changed files with 21 additions and 1 deletions

View File

@@ -519,7 +519,10 @@ void PartialPivLU<MatrixType>::compute()
// the row permutation is stored as int indices, so just to be sure:
eigen_assert(m_lu.rows()<NumTraits<int>::highest());
m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
if(m_lu.cols()>0)
m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
else
m_l1_norm = RealScalar(0);
eigen_assert(m_lu.rows() == m_lu.cols() && "PartialPivLU is only for square (and moreover invertible) matrices");
const Index size = m_lu.rows();