mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-08 17:59:00 +08:00
DiagonalPrecond: fix potential segfault in case the diagonal contains explciit zeros
This commit is contained in:
parent
1beb8a6564
commit
e97879857b
@ -70,7 +70,7 @@ class DiagonalPreconditioner
|
|||||||
{
|
{
|
||||||
typename MatrixType::InnerIterator it(mat,j);
|
typename MatrixType::InnerIterator it(mat,j);
|
||||||
while(it && it.index()!=j) ++it;
|
while(it && it.index()!=j) ++it;
|
||||||
if(it.index()==j)
|
if(it && it.index()==j)
|
||||||
m_invdiag(j) = Scalar(1)/it.value();
|
m_invdiag(j) = Scalar(1)/it.value();
|
||||||
else
|
else
|
||||||
m_invdiag(j) = 0;
|
m_invdiag(j) = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user