question on MatSetValues

Matt Funk mafunk at nmsu.edu
Thu Sep 24 13:22:48 CDT 2009


Hi,

i had a question concerning MatSetValues with respect to which values are 
ignored.

I believe that PETSC ignores column indices of -1?
My question then is, are the corresponding entries in the values array ignored 
as well?


For example:

int sizeOfNonZeroColumnEntries = 9
int a_numRowsToInsert = 1
int a_numRowsToInsert = 1
int rowNumber 0

//col. index vector for a given row (length 9)
a_GlobalColNumber = {1 2 -1 4 5 6 -1 8 9}

//corresponsing values vector for given row (length 9)
a_Values = {x1 x2 x3 x4 x5 x6 x7 x8 x9}

Now calling MatSetValues to insert this:

m_ierr = 
  MatSetValues(m_globalMatrix,
			 a_numRowsToInsert,
			 rowNumber,
			 sizeOfNonZeroColumnEntries,
			 &a_GlobalColNumber,
			 &a_Values,
			 INSERT_VALUES);

question 1:
will petsc insert 7 column/value pairs into the matrix, or will insert 9

question 2:
assuming it only inserts 7, am assume it is ok that i only preallocated 7 
memory slots for this entry?


thanks
matt


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090924/8d880dab/attachment.htm>


More information about the petsc-users mailing list