# Problem creating a non-square MPIAIJ Matrix

Shi Jin jinzishuai at yahoo.com
Fri Feb 16 14:18:22 CST 2007

```Hi there,

I am found a very mysterious problem of creating a MxN
matrix when M>N.
Please take a look at the attached short test code I
wrote to demonstrate the problem.

Basically, I want to create a 8x6 matrix.
A={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

If I do it with 2 processes, I suppose the local
submatrices should look like
p0:
1 2 3 4 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0;
p1:
0 0 0 0 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0
The problem is that on the first process, the diagonal
portion of the local submatrix is
1 2 3 4 | 0 0;
0 0 0 0 | 0 0;
0 0 0 0 | 0 0;
0 0 0 0 | 0 0;
So I need to set d_nnz[0]=4 on p0 since the first row
has 4 diagonal nonzero entries. However, when I run
the code by
mpiexec -n 2 ./mpiaij
I got error saying that
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Argument out of range!
[0]PETSC ERROR: nnz cannot be greater than row length:
local row 0 value 4 rowlength 3!

It seems that it is checking against the n parameter
which is set by petsc to be n=N/2=3.
But why should we do that? According the manual, the
local submatrix is of dimension m by N.

Thank you very much.
Shi

____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpiaij.c
Type: text/x-csrc
Size: 977 bytes
Desc: 3194231359-mpiaij.c
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20070216/5214f593/attachment.c>
```