Skip to content
Snippets Groups Projects
Commit cf57d245 authored by Elias Pipping's avatar Elias Pipping
Browse files

Handle corner case

This would in particular lead to NaN corrections if all nodes are
ignored.
parent 80ac5839
Branches
No related tags found
No related merge requests found
Pipeline #
......@@ -35,6 +35,10 @@ void CGStep<MatrixType, VectorType>::preprocess()
template <class MatrixType, class VectorType>
void CGStep<MatrixType, VectorType>::iterate()
{
// Avoid divide-by-zero. If r_squared was zero, we're done anyway.
if (r_squared_old_ <= 0)
return;
VectorType q(*x_);
matrix_->mv(p_, q); // q_0 = Ap_0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment