Comparing matrices between 2 different codes and viewing of matrix

Barry Smith bsmith at mcs.anl.gov
Sun May 25 08:55:12 CDT 2008


    Likely you forgot to #include "finclude/petscviewer.h" in the  
Fortran subroutine that
is doing this stuff.


On May 25, 2008, at 5:43 AM, Ben Tay wrote:

> Hi,
>
> I have an old serial code and a newer parallel code. The new  
> parallel code is converted from the old serial code. However, due to  
> numerous changes, the answers from the new code now differs from the  
> old one after the 1st step. What is the best way to compare the  
> matrices from the 2 different code?
>
> I guess the most direct mtd is to use MatView to store the matrix in  
> a ACSII file and spot the difference between the 2 files. However, I  
> can't seem to get it right. What I did is:
>
> PetscViewer viewer
>
> call  PetscViewerCreate(PETSC_COMM_SELF,viewer,ierr)
>
> call MatView(A_mat_uv,viewer,ierr)
>
> call PetscViewerDestroy(viewer,ierr)
>
> call PetscViewerASCIIOpen(PETSC_COMM_SELF, "matrix.txt",viewer,ierr)
>
> However, I get the error that "PetscViewer viewer" has syntax error.  
> Hope you can help me out.
>
> Thank you very much.
>
> Regards
>
>




More information about the petsc-users mailing list