mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-24 13:54:28 +08:00
fix LU and QR solve when rank==0, fix LLT when the matrix is purely 0
This commit is contained in:
parent
468863f3a0
commit
c44bbabdcc
@ -136,7 +136,7 @@ void LLT<MatrixType>::compute(const MatrixType& a)
|
||||
for (int j = 1; j < size; ++j)
|
||||
{
|
||||
x = ei_real(a.coeff(j,j)) - m_matrix.row(j).start(j).squaredNorm();
|
||||
if (x < cutoff)
|
||||
if (x <= cutoff)
|
||||
{
|
||||
m_isPositiveDefinite = false;
|
||||
continue;
|
||||
|
@ -515,9 +515,10 @@ bool LU<MatrixType>::solve(
|
||||
if(!ei_isMuchSmallerThan(c.coeff(row,col), biggest_in_c, m_precision))
|
||||
return false;
|
||||
}
|
||||
m_lu.corner(TopLeft, m_rank, m_rank)
|
||||
.template marked<UpperTriangular>()
|
||||
.solveTriangularInPlace(c.corner(TopLeft, m_rank, c.cols()));
|
||||
if(m_rank>0)
|
||||
m_lu.corner(TopLeft, m_rank, m_rank)
|
||||
.template marked<UpperTriangular>()
|
||||
.solveTriangularInPlace(c.corner(TopLeft, m_rank, c.cols()));
|
||||
|
||||
// Step 4
|
||||
result->resize(m_lu.cols(), b.cols());
|
||||
|
@ -276,6 +276,9 @@ bool QR<MatrixType>::solve(
|
||||
// Q^T without explicitly forming matrixQ(). Investigate.
|
||||
*result = matrixQ().transpose()*b;
|
||||
|
||||
if(m_rank==0)
|
||||
return result.isZero();
|
||||
|
||||
if(!isSurjective())
|
||||
{
|
||||
// is result is in the image of R ?
|
||||
|
Loading…
x
Reference in New Issue
Block a user