Comparing matrices between 2 different codes and viewing of matrix

Lisandro Dalcin dalcinl at
Mon May 26 10:47:11 CDT 2008

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().

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-users mailing list