<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default"><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small">Hello everyone!</div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small">I am writing a code that uses PETSc/KSP to solve linear systems. I just realized that after running "KSPSolve(...)", the number of iterations given by </div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small">KSPGetIterationNumber(ksp, &numIts)</div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small">is *different* from the size of the residual history given by</div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:small">KSPGetResidualHistory(ksp, NULL, &nEntries);<br></div><div style="color:rgb(34,34,34);font-family:Arial,Helvetica,sans-serif;font-size:small"><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)">That is, "numIts" is not equal to "nEntries". Is this expected, or a bug in my code? (I thought they should be the same...)</div><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)">I have tried several pairs of solvers and preconditioners (e.g., fgmres & bjacobi, ibcgs & bjacobi). This issue happens to all of them.</div><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)">Thanks!</div><font color="#888888"><div class="gmail_default" style="font-family:arial,sans-serif;color:rgb(0,0,0)">Kevin</div></font></div></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Kevin G. Wang, Ph.D.</div><div dir="ltr">Associate Professor</div><div dir="ltr">Kevin T. Crofton Department of Aerospace and Ocean Engineering</div><div dir="ltr">Virginia Tech</div><div dir="ltr">1600 Innovation Dr., VTSS Rm 224H, Blacksburg, VA 24061<br></div><div dir="ltr">Office: (540) 231-7547  |  Mobile: (650) 862-2663 </div><div dir="ltr">URL: <a href="https://www.aoe.vt.edu/people/faculty/wang.html" target="_blank">https://www.aoe.vt.edu/people/faculty/wang.html</a> </div><div>Codes: <a href="https://github.com/kevinwgy" target="_blank">https://github.com/kevinwgy</a></div></div></div></div></div></div></div></div></div></div>