<div class="gmail_quote">On Tue, Nov 30, 2010 at 21:42, Rongliang Chen <span dir="ltr"><<a href="mailto:rongliang.chan@gmail.com">rongliang.chan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":yt">I know that I should call PetscViewerDestroy() when I have done with each<br>
viewer. But if I called this I just can view the last Matrix and vector. What I want<br>to do is that I let it do three steps of SNES, view the jacobian of each step.<br></div></blockquote><div><br></div><div>Maybe view it to different files. The code you posted for viewing is certainly not correct, especially if called in a loop.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":yt">I found that A*x is correct at the first step and it's wrong for the second and <br>
third step. <br>I also tried using the binary output and input, and it has the same results.<br></div></blockquote><div><br></div><div>The problem is most likely that you are picking these pieces out of the files differently than they are put in. MatMult being incorrect is by far the least likely scenario. I don't know why you want to do this, but you need to find a way to manage the files so that you can be certain that you are reading (from Matlab) exactly what you think you are reading. One way to do this is to use a binary file that gets all three items together.</div>
<div><br></div><div>Jed</div></div>