Comparing matrices between 2 different codes and viewing of matrix

Ben Tay zonexo at
Wed May 28 09:18:43 CDT 2008

Hi Lisandro,

Thank you for your help. But I believe the matrix of the serial and 
parallel, if done correctly are the same during viewing. However, the 
vectors will be split into different processors.


Lisandro Dalcin wrote:
> On 5/25/08, Ben Tay <zonexo at> wrote:
>> 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:
> But then take into account that in the parallel case, the numbering of
> the rows/cols of the matrix will perhaps not match the one of the
> sequential case. If you save the parallel matrix, you will also need
> to save an appropriate permutation to be able to actually compare the
> matrices. Or perhaps better, a combination of an application ordering,
> an index set, and MatPermute().

More information about the petsc-users mailing list