[petsc-users] Create csr matrix

Barry Smith bsmith at mcs.anl.gov
Sun Dec 12 14:30:04 CST 2010


  MatCreateSeqAIJWithArrays()

On Dec 12, 2010, at 2:14 PM, Jakub Pola wrote:

> Hi, 
> 
> Could you please help me with creating CSR matrix. I have only one
> processor so It have to be done locally
> 
> Here is the matrix from those information I would like to have matrix
> petsc matrix.
> 
> double  vals  [] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0} ;
> int     c_idx [] = {1,   3,   2,   0,   1,   2,   2,   3} ;
> int     r_idx [] = {0, 2, 3, 6, 8} ;
> int     n_rows   = 4 ; //square matrix
> 
> Thank you in advance for help.
> Kuba
> 
> 
> 
> 



More information about the petsc-users mailing list