Comparing matrices between 2 different codes and viewing of matrix

Ben Tay zonexo at gmail.com
Tue May 27 05:57:08 CDT 2008


Hi Barry,

Thanks for pointing out. However, I only got a 0 byte file after adding 
the include statement.

I am programming in parallel and my matrix is created using 
MatCreateMPIAIJ. Did I missed out some commands?

PetscViewer viewer


...

call  PetscViewerCreate(MPI_COMM_WORLD,viewer,ierr)

call MatView(A_mat_uv,viewer,ierr)

call PetscViewerASCIIOpen(MPI_COMM_WORLD, "matrix.txt",viewer,ierr)

call PetscViewerDestroy(viewer,ierr)

Thank you very much.

Regards.


Barry Smith wrote:
>
>    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