We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e871fb commit 82034bdCopy full SHA for 82034bd
1 file changed
Common/src/linear_algebra/CSysSolve.cpp
@@ -602,9 +602,11 @@ unsigned long CSysSolve<ScalarType>::BCGSTAB_LinSolver(const CSysVector<ScalarTy
602
precond(r, z);
603
mat_vec(z, A_x);
604
605
- /*--- Calculate step-length omega ---*/
+ /*--- Calculate step-length omega, avoid division by 0. ---*/
606
607
- omega = A_x.dot(r) / A_x.squaredNorm();
+ omega = A_x.squaredNorm();
608
+ if (omega == ScalarType(0)) break;
609
+ omega = A_x.dot(r) / omega;
610
611
/*--- Update solution and residual: ---*/
612
0 commit comments