CSR Sparse Matrix Query

Satish Balay balay at mcs.anl.gov
Mon Apr 23 10:31:51 CDT 2007


On Mon, 23 Apr 2007, Satish Balay wrote:

> On Mon, 23 Apr 2007, Dr. Timothy Stitt wrote:
> 
> > I am using Fortran. Do I have to perform some operation to switch
> > from column-major to row-major representation before calling the
> > MatCreateSeqAIJWithArrays routine? 
> 
> MatCreateSeqAIJWithArrays expects a 1d array for the values [and
> rows,column indicies as well] - so this issue of row-major vs
> column-major does not exist.

However the CSR format which is used for the input, is equivalent to a
row-major ordering.. i.e for the following matrix:

1 0 0
2 0 3
0 4 5

The call expects the following

i =  {0,1,3,5}  [size = nrow+1  = 3+1]
j =  {0,0,2,1,2}  [size = nz = 5]
v =  {1,2,3,4,5}  [size = nz = 5]

Satish




More information about the petsc-users mailing list