how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Zi-Hao Wei
On Mon, Aug 4, 2008 at 10:53 PM, Ahmed El Zein wrote: > my code looks like: >ierr = MatCreate(PETSC_COMM_WORLD,&A); CHKERRQ(ierr); >ierr = MatSetSizes(A,M,N,M,N); CHKERRQ(ierr); >ierr = MatSetType(A, MATSEQAIJ); CHKERRQ(ierr); >ierr = MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY); CHKER

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Ahmed El Zein
I am working on a project where I would like to copy a sparse matrix in CSR format. I have tried MatGetRow() which works OK but I would really like to get pointers to the 3 arrays directly. I also tried MatGetRowIJ() which allows me to get the i and j arrays but I can't see how to access the non

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Barry Smith
Looks fine to me. I removed the gratuitous C++ and changed #include to #include Do the PETSc examples work? Barry anlext2wls165:ksp/examples/tutorials] bsmith% ./ex1 -mat_view |& more row 0: (1, 0.1) (5, 0.5) (7, 0.7) row 1: (3, 1.1) (4, 1.2) row 2: (1, 1.7) (3, 1.9) (6, 2.2)

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Alex Peyser
st one MatAssembly() call versus a > Begin and End call? > > btw fixing this did not affect the problem I had. > > Ahmed -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20080804/b4305472/attachment.pgp>

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Barry Smith
Send us the code. This is suppose to be easy stuff. Barry On Aug 4, 2008, at 11:09 AM, Ahmed El Zein wrote: > On Mon, 2008-08-04 at 23:13 +0800, Zi-Hao Wei wrote: >> On Mon, Aug 4, 2008 at 10:53 PM, Ahmed El Zein >> wrote: >>> my code looks like: >>> ierr = MatCreate(PETSC_COMM_WOR

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Barry Smith
On Aug 4, 2008, at 11:01 AM, Ahmed El Zein wrote: >> > Shouldn't that be the opposite? Isn't the whole idea of an > interface, to > have a set of functions that will work on all matrix types, regardless > of implementation. Yes. However GetIJ and GetArray are NOT in any way natural for all

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Matthew Knepley
On Mon, Aug 4, 2008 at 9:58 AM, Ahmed El Zein wrote: > On Mon, 2008-08-04 at 04:17 -0500, Matthew Knepley wrote: >> On Mon, Aug 4, 2008 at 3:14 AM, Ahmed El Zein wrote: >> > I am working on a project where I would like to copy a sparse matrix in >> > CSR format. >> > >> > I have tried MatGetRow()

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Barry Smith
>>> >>> >>> >> Make sure this is a MPI_SeqAIJ matrix. > I thought that this would work with any seqaij matrix. does it have to > be MPISEQAIJ or can it just be MATSEQAIJ? >> Sorry, my mistake. Yes a MATSEQAIJ matrix. Barry >>It is only valid to access this data after you have put t

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Barry Smith
On Aug 4, 2008, at 3:14 AM, Ahmed El Zein wrote: > I am working on a project where I would like to copy a sparse matrix > in > CSR format. > > I have tried MatGetRow() which works OK but I would really like to get > pointers to the 3 arrays directly. > > I also tried MatGetRowIJ() which allows

how do you access the nonzero elements in SeqAIJ matrices

2008-08-04 Thread Matthew Knepley
On Mon, Aug 4, 2008 at 3:14 AM, Ahmed El Zein wrote: > I am working on a project where I would like to copy a sparse matrix in > CSR format. > > I have tried MatGetRow() which works OK but I would really like to get > pointers to the 3 arrays directly. > > I also tried MatGetRowIJ() which allows m