Does petsc exploit the symmetric property of matrix?

Hong Zhang hzhang at mcs.anl.gov
Fri Aug 15 09:28:07 CDT 2008


Shengyong,

On Fri, 15 Aug 2008, berry wrote:

> Hi,
>
> I am totally a newbie to petsc. Previously I use laspack library for my
> linear solver. Now I decide to transfer to Petsc for our simulation code.
>
> I have a huge sparse matrix with 3million*3million with 21 million no zero
> elements.  The matrix is symmetric, so the non zero element of upper
> triangular matrix
> is only 12 million.  And matrix format is Yale Space Matrix format. However,
> I have not seen any indicative parmater for matrix symmetry property in
> MatCreateSeqAIJWithArrays() function.  The manual says:
>
>
> PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJWithArrays(MPI_Comm
> comm,PetscInt m,PetscInt n,PetscInt* i,PetscInt*j,PetscScalar *a,Mat
> *mat)
>
> <http://www-unix.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-current/docs/manualpages/Sys/MPI_Comm.html#MPI_Comm>
>
> Input Parameters
> *comm<http://www-unix.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-current/docs/manualpages/Sys/comm.html#comm>
> *- must be an MPI communicator of
> size<http://www-unix.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-current/docs/manualpages/Sys/size.html#size>1
> *m *- number of rows
> *n *- number of columns
> *i *- row indices
> *j *
>
> *a *
>
>
> Can petsc exploit any symmetric proptery of a given matrix?  How could I Set
> it to be symmetry one ?

You can use MATSBAIJ matrix format
(see 
http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MATSBAIJ.html)

Using MATSBAIJ saves half of storage space for original sparse matrix.
However,
it is not as efficient as MATAIJ for some matrix operations, e.g.,
MatMult(), due to non-contiguous data access and additional communication 
overhead.

Hong
>
> Best Regards,
>
>
>
>
> -- 
> Pang Shengyong
> Solidification Simulation Lab,
> State Key Lab of Mould & Die Technology,
> Huazhong Univ. of Sci. & Tech. China
>




More information about the petsc-users mailing list