# how to inverse a sparse matrix in Petsc?

Barry Smith bsmith at mcs.anl.gov
Mon Feb 4 12:26:12 CST 2008

```On Feb 4, 2008, at 12:20 PM, Yujie wrote:

> what is the difference between sequantial and parallel AIJ matrix?
> Assuming there is a matrix A, if I partitaion this matrix into A1,
> A2, Ai... An.
> A is a parallel AIJ matrix at the whole view, Ai is a sequential AIJ
> matrix?

It is not that simple. Ai is split into two parts 1) the "block
diagonal" part and 2) the "off diagonal part" ; this is explained
in the manual page for MatCreateMPIAIJ(). If you want to do operations
on the pieces you will need to understand the
code in src/mat/impls/aij/mpi.

What do you want to do with Ai?

> I want to operate Ai at each node.
> In addition, whether is it possible to get general inverse using
> MatMatSolve() if the matrix is not square?

No, that requires much more complicated linear algebra technology
then is in PETSc.

Barry

> Thanks a lot.
>
> Regards,
> Yujie
>
>
> On 2/4/08, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>     For sequential AIJ matrices you can fill the B matrix with the
> identity and then use
> MatMatSolve().
>
>     Note since the inverse of a sparse matrix is dense the B matrix is
> a SeqDense matrix.
>
>     Barry
>
> On Feb 4, 2008, at 12:37 AM, Yujie wrote:
>
> > Hi,
> > Now, I want to inverse a sparse matrix. I have browsed the manual,
> > however, I can't find some information. could you give me some
> >
> > thanks a lot.
> >
> > Regards,
> > Yujie
> >
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20080204/e4a70a64/attachment.htm>
```