[petsc-users] Why MatMult(A, x, Ax) != A*x?

Rongliang Chen rongliang.chan at gmail.com
Tue Nov 30 14:42:33 CST 2010


I know that I should call PetscViewerDestroy() when I have done with each
viewer. But if I called this I just can view the last Matrix and vector.
What I want
to do is that I let it do three steps of SNES, view the jacobian of each
I found that A*x is correct at the first step and it's wrong for the second
third step.
I also tried using the binary output and input, and it has the same results.

But If I destroy the matrix A after the first SNES, recreate it and then do
second and third SNES, it will be alright.  Thanks.



> ------------------------------
> Message: 3
> Date: Tue, 30 Nov 2010 09:29:17 +0100
> From: Jed Brown <jed at 59A2.org>
> Subject: Re: [petsc-users] petsc-users Digest, Vol 23, Issue 32
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Message-ID:
>        <AANLkTinOWxSWHvgxAefqv1Sp5es9ao24qnrH53zAepvq at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> On Tue, Nov 30, 2010 at 03:26, Rongliang Chen <rongliang.chan at gmail.com
> >wrote:
> > [A,x,y] = PetscBinaryRead('binaryoutput'), can this command load
> > the binary files into matlab matrix and vector?
> >
> Yes, this reads the binary files.  You will need to add
> $PETSC_DIR/bin/matlab to your path (see "help addpath").
> You should also call PetscViewerDestroy() when you are done with each
> viewer.  In the source you quoted, this is never called.
> Jed
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101130/c1eb3531/attachment-0001.htm
> >
> ------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101130/09796f96/attachment.htm>

More information about the petsc-users mailing list