# [petsc-users] Customizeing MatSetValuesBlocked(...)

Jinquan Zhong jzhong at scsolutions.com
Wed Aug 8 15:25:25 CDT 2012

```
Thanks, Jed.

I used
MatCreateAIJ(PETSC_COMM_WORLD,  LDA,LDB,  N,N,  d_nz, d_nnz,o_nz,o_nnz, &A);
MatXAIJSetPreallocation(PETSC_COMM_WORLD, 1, d_nz, d_nnz,o_nz,o_nnz, &A);

However, I have trouble to figure out the values for d_nz, d_nnz,o_nz, o_nnz since the local A is a block consisting of several sub-blocks from ScaLAPACK.  I think MatCreateAIJ and MatXAIJSetPreallocation both take several rows together.

If I understand you correctly, ScaLAPACK blocks don't have anything to do with the sparse matrix structure.

******************************************************************************************************************************************

You are correct.  What I meant was how to define the diagonal and off-diagonal parts of each submatrix matrix  A (LDA, LDB).  For example, in the following matrix,

Proc0 Proc1       Proc2
1  2  0  |  0  3  0  |  0  4
Proc0   0  5  6  |  7  0  0  |  8  0
9  0 10  | 11  0  0  | 12  0
-------------------------------------
13  0 14  | 15 16 17  |  0  0
Proc3   0 18  0  | 19 20 21  |  0  0      <=== owned by  Proc 5
0  0  0  | 22 23  0  | 24  0
-------------------------------------
Proc6  25 26 27  |  0  0 28  | 29  0
30  0  0  | 31 32 33  |  0  34

I am not sure how to fill out the values for d_nz, d_nnz,o_nz, o_nnz peoperly for the subblock (0 0 ;0 0; 24 0) owned by Proc 5 since it was based on diagonal and off-diagonal parts.

******************************************************************************************************************************************
Jinquan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120808/073327f5/attachment.html>
```