[petsc-users] Tridiagonal and pentadiagonal matrices

Hong Zhang hzhang at mcs.anl.gov
Mon Feb 28 11:26:25 CST 2011


Gianluca :
>
> I was looking for the best way to solve tridiagonal and pentadiagonal
> matrix in Petsc. Is there a specific matrix format/solver for these
> kind of systems I should use?

No. For sequential matrix, you may use LAPACK routines for band or
tridiagonal matrices.
>
> The tridiagonal/pentadiagonal matrix I have to solve corresponds to
> the main 3/5 diagonals of a bigger matrix (if it can help, I'm trying
> to solve a system using block-line Gauss Seidel). I've seen there is
> an easy way to obtain the main diagonal of the matrix
> (MatGetDiagonal). Is there an equivalent way to extract the other
> data?

You may use MatGetSubMatrix(). For efficient assemble of your submatrix,
you may look into the private date structure (AIJ?) and obtain your submatrix.
For aij format, check aij.h or mpiaij.h for its datastructure.

Hong
>
> Thanks
>
> Gianluca
>
> --
> "[Je pense que] l'homme est un monde qui vaut des fois les mondes et
> que les plus ardentes ambitions sont celles qui ont eu l'orgueil de
> l'Anonymat" -- Non omnibus, sed mihi et tibi
> Amedeo Modigliani
>


More information about the petsc-users mailing list