Skip to content

Commit 82034bd

Browse files
committed
fix #999
1 parent 0e871fb commit 82034bd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Common/src/linear_algebra/CSysSolve.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,11 @@ unsigned long CSysSolve<ScalarType>::BCGSTAB_LinSolver(const CSysVector<ScalarTy
602602
precond(r, z);
603603
mat_vec(z, A_x);
604604

605-
/*--- Calculate step-length omega ---*/
605+
/*--- Calculate step-length omega, avoid division by 0. ---*/
606606

607-
omega = A_x.dot(r) / A_x.squaredNorm();
607+
omega = A_x.squaredNorm();
608+
if (omega == ScalarType(0)) break;
609+
omega = A_x.dot(r) / omega;
608610

609611
/*--- Update solution and residual: ---*/
610612

0 commit comments

Comments
 (0)