# Problem creating a non-square MPIAIJ Matrix

Shi Jin jinzishuai at yahoo.com
Fri Feb 16 16:07:34 CST 2007

```Thanks. Now I know I followed the documentation that
is mistaken.
I will change the code according to your description.
Thank you very much.

Shi
--- Satish Balay <balay at mcs.anl.gov> wrote:

> On Fri, 16 Feb 2007, Shi Jin wrote:
>
> > > We are stoing the diagonal block and offdiagonal
> block
> > > separately. However both blocks are on the same
> processor. i.e
> > > each processor stores m*N values - in 2
> submatrices m*n,
> > > m*(N-n). To understand this better - check
> manpage for
> > > MatCreateMPIAIJ().
>
> > Thanks. But this is completely different from what
> I
> > read from the PETSC mannual.
> >
>
http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatCreateMPIAIJ.html
> > Here is says:
> > "The DIAGONAL portion of the local submatrix of a
> > processor can be defined as the submatrix which is
> > obtained by extraction the part corresponding to
> the
> > rows r1-r2 and columns r1-r2 of the global matrix,
> > where r1 is the first row that belongs to the
> > processor, and r2 is the last row belonging to the
> > this processor. This is a square mxm matrix. The
> > remaining portion of the local submatrix (mxN)
> > constitute the OFF-DIAGONAL portion."
>
> This text was proably writen assuming that the
> initial matrix was a
> square MxM matrix [in which case the diagonal blocks
> are also
> square]. This text should be corrected to reflect
> the 'rectangular'
> matrix case as well.
>
> >  So the two matrices are mxm and mx(N-m) instead
> of what you said:
> > mxn and mx(N-n) However, the code seems to act
> like what you
> > described.
>
> This interpreatation of the partitionling is not
> possible. You are
> assuming the following partitioning - which PETSc
> doesn't support.
>
>
>   1 2 3 4 | 0 0
>   0 0 0 0 | 0 0
>   0 0 0 0 | 0 0
>   0 0 0 0 | 0 0
>   -------------
>   0 0 | 0 0 0 0
>   0 0 | 0 0 0 0
>   0 0 | 0 0 0 0
>   0 0 | 0 0 0 0
>
> Note: the primary purpose of storing diagonal &
> offdiagonal blocks is
> to separate comutation that requires messages from
> compuattion that
> does not - in a MatVec.
>
> i.e We the current petsc partitioning - the diagonal
> block can be
> processed without any communication. [with a
> matching vec partitioning
> - as mentioned in an earlier e-mail]
>
> The above scheme - with different column
> partitioning on each node -
> doesn't help with this [and removes the primary
> purpose for storing
> the matrix blocks separately]
>
> Satish
>
> > They are equivalent for square matrices but not
> the same for
> > non-square matrices like the one I showed.  Could
> > whether the manual is accurate or not?
>
>

____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html

```