<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>  This uses a PETSc "trick". When a norm is computed on a vector it is "stashed" in the object and retrieved quickly if requested again.<div class=""><br class=""></div><div class=""><a href="https://petsc.org/main/src/vec/vec/interface/rvector.c.html#VecNorm" class="">https://petsc.org/main/src/vec/vec/interface/rvector.c.html#VecNorm</a></div><div class=""><br class=""></div><div class="">Because PETSc controls write access to the vector it always knows if the current stashed value is valid or invalid so can avoid unneeded recompilations.</div><div class=""><br class=""></div><div class="">When GMRES normalizes the vector, its known norm which is stashed is suitably scaled in the VecScale routine</div><div class=""><br class=""></div><div class=""><a href="https://petsc.org/main/src/vec/vec/interface/rvector.c.html#VecScale" class="">https://petsc.org/main/src/vec/vec/interface/rvector.c.html#VecScale</a></div><div class=""><br class=""></div><div class="">and thus available the the MATMFFD_WP at no cost. With right conditioned GMRES or other KSP methods since the norm of a is generally not known the call to VecNorm triggers is computation; but with left preconditioned GMRES is available "for free" in the stash.</div><div class=""><br class=""></div><div class="">  Barry</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 25, 2022, at 7:07 AM, Pierre Seize <<a href="mailto:Pierre.Seize@onera.fr" class="">Pierre.Seize@onera.fr</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hello PETSc team and users,<br class=""><br class="">I have a question regarding MATMFFD_WP : the documentation states that 1) || U || does not change between linear iterations and 2) in GMRES || a || = 1 except at restart.<br class=""><br class="">In src/mat/impls/mffd/wp.c, in MatMFFDCompute_WP, I see that the computation of || U || is inside an if statement, which I guess corresponds to what is stated in the documentation, but the computation of || a || is done every time.<br class=""><br class="">Does this mean that || a || is computed at each GMRES iteration, even when we know it's 1 ?<br class=""><br class="">I was checking this to see how you handle the case of right preconditioning : then in GMRES it is no longer true than || a || == 1, i think.<br class=""><br class=""><br class="">Thank you in advance for your replies.<br class=""><br class=""><br class="">Pierre Seize<br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>