Repository navigation
operator: final residual on NoConvergence, BiCGSTAB breakdown stops at the last finite iterate (#133, #134) - #137
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two Krylov-solver defects that were reported upstream on Codeberg and that reproduce on this fork's
main.Closes #133. Closes #134.
What changes
bicgstaborconjugate_gradientstops atmax_iters,NoConvergencenow reports the residual of thexit returns, not|b|.bicgstabkept each new norm in a local variable.conjugate_gradientshadowedabs_residualinside the loop.r̃ᵀ vnow takes its tolerance from the bound on one entry,eps * k * max_j |r̃_j| * max_j |v_j|, instead of from its own largest pivot. A zero first pivot is therefore caught, and a wide block of right-hand sides is not scaled by its width. The comparison is strict, sov = 0also counts.sor the new residual is not finite, the iteration stops. It keeps the last iterate whose residual is finite, and returnsNoConvergencewith that true residual.InitialGuessStatus::Zerois now written out as zeros on entry in both solvers. Every exit, includingmax_iters = 0, therefore returns zeros or an iterate, never the caller's buffer.Known limit, recorded in PATCHSET: a finite residual does not bound
xitself, so an operator scaled near the floating-point range limit can still overflowx.Provenance
I wrote the fix from the upstream issue reports. No code comes from the open upstream PRs #330 and #331, and nothing was posted to Codeberg.
Verification
codeberg_328for both solverscodeberg_327A r̃ = 0max_iters = 0, in both solversf32identity with 64 right-hand sidescodeberg_327, bothcodeberg_328tests and the first-step breakdown fail. After it, all 23matrix_freetests pass.cargo +1.89.0 checkpasses infaer/. Clippy reports nothing in the changed files.codeberg_326line onmain.xguarantee.🤖 Generated with Claude Code