On Fri, Nov 2, 2012 at 10:15 AM, NAN ZHAO <span dir="ltr"><<a href="mailto:zhaonanavril@gmail.com" target="_blank">zhaonanavril@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<div><br></div><div>I am using PETSC to solve a nonlinear system with newton's method. I actually calculate the jacobian matrix in each newton iteration and solve the linear system by KSPsolve. However, I found one thing really brothers me is the ultra small numbers in the matrix (MPIBAIJ matrix). In the sparse matrix I create some location should be zero but I got some small values like 1e-23 instead. I use matzeroentries each time I give new value to the matrix and this problem still exist. What makes me more confuse is that if I do not use matzeroentries each time I give new values to the matrix, the locations which should be zero get exactly 0.0000e0 (although other values is wrong, cause I add new value to the location when I assemble the matrix, I can not use insert as the procedure is like finite element assembling). Does anyone have insight of why this happens? P.S. I tried destroy the matrix each time I give the new value but same thing happens.</div>
</blockquote><div><br></div><div>You are not doing what you think you are doing. This has nothing to do with MatZeroEntries(). You are inserting</div><div>weird values in the matrix, probably by misspecifying a length, so that MatSetValues() reads off the end of an</div>
<div>array. Run your code through valgrind.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Regards,</div><div>Nan</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>