[petsc-users] Tridiagonal and pentadiagonal matrices

Gianluca Meneghello gianmail at gmail.com
Tue Mar 1 07:23:23 CST 2011


Hong,

thanks for your answer.

Please let me ask for some clarifications:

- in order to use LAPACK routines for band and tridiagonal matrices, I
cannot provide a Petsc Matrix directly to the routine. I must extract
the values from the matrix, store them in an array and then provide
the array to the LAPACK routine. To access data faster, I can use
MatGetArray, provided I know the matrix structure in advance. Am I
wrong?

- can I ask you some more details (or where to find an example) on the
use of the private data structure for efficient assembly?

- is there a place where I can find the description of the various
matrix types (like this, but with descriptions
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatType.html)?

Thanks again

Gianluca

On 28 February 2011 18:26, Hong Zhang <hzhang at mcs.anl.gov> wrote:
> 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
>>
>



-- 
"[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