Lu Qiyue <[email protected]> writes: > ---------- Forwarded message ---------- > From: Lu Qiyue <[email protected]> > Date: Fri, Jul 19, 2013 at 3:39 PM > Subject: Re: [petsc-users] MatCreateSeqAIJ( ) Quesion > To: Barry Smith <[email protected]> > > > Thanks Barry. > I am trying to premalloc the correct value for each row. Assume the matrix > is in COO format and N is the dimension, NNZ is total non-zeros. My > workflow is as below: > 1) generating a file holding all the correct number of non-zeros for each > row and read-in as cnt > > from > http://www.mcs.anl.gov/petsc/petsc-current/src/mat/examples/tutorials/ex12.c.html > It looks cnt should have N+1 dimension and the last value is the total > non-zeros NNZ > One question here is at line 45, why the dimension of matrix are set to be > (n+1), should it be n ? > In http://www.mcs.anl.gov/petsc/petsc-dev/src/mat/examples/tests/ex72.c.html > they are just set to m, n
That example is creating a matrix with an extra row and column. > For ex72.c, I don't know which ex72 you are looking at. > the code copy the entries which not on the diagonal and make the > symmetric COO matrix to be FULL. But when we do the MatCreateSeqAIJ, > the cnt should holding number of non-zeros per row of FULL matrix, > right? > > In one word, what's the content(and dimension) of cnt array and how to set > MatCreateSeqAIJ() assuming a N dimension matrix? MatCreateSeqAIJ(PETSC_COMM_SELF,N,N,0,cnt,&A); where cnt[] is an array of length N, with cnt[i] containing the number of nonzeros in row i.
pgp8WEgx7IJkw.pgp
Description: PGP signature
