On Dec 29, 2011, at 1:28 PM, Junchao Zhang wrote:

> Hello,
>   I create a MPIAIJ matrix.  How can I know the # of nonzeros stored locally? 

   MatGetInfo()

>   Furthermore, in case it is needed, how can I get access to the Compress 
> Sparse Row(CSR) data structure of the local matrix, i.e., the row pointer 
> array, column index array, value array?

   PETSc MPIAIJ matrices are not actually stored as a single CSR matrix on each 
process. They are actually stored as two CSR matrices: the "block diagonal 
local portion" and the "off-processor portion" (which is complicated by 
remapping the column indices). Thus it is basically impossible for normal PETSc 
users to muck directly with the matrix entries. If you are interested in 
developing new matrix entry specific solvers that work directly with MPIAIJ 
matrices then you need to include the private include files that define the 
data structures (you can find them in src/mat/impls/aij in subdirectories) I 
warn you that you need to be pretty good at C programming the muck with this 
stuff. 

   Barry



>   
>   Thank you!
> -- Junchao Zhang

Reply via email to