Problem with using ADD_VALUES

Ben Tay zonexo at gmail.com
Mon Aug 6 03:17:59 CDT 2007


Hi,

I am trying to insert values into a matrix. I used to use INSERT_VALUES 
with MatSetValues or MatSetValue. However, since I need to add values to 
the same II,JJ location more than 1 time, I have to use ADD_VALUES with 
MatSetValues.

However I got this error message:

Object is in wrong state!
Cannot mix add values and insert values!

My code is something like this:

call MatSetValues(A_mat,1,II,1,JJ,0.,INSERT_VALUES,ierr)         ->      
   to reset values at II,JJ to zero 1st

...

do JJ=1,5

    call 
MatSetValues(A_mat,1,II,1,int_A(m,JJ)-1,big_A(m,JJ),ADD_VALUES,ierr)   
         ->         to put values into the matrix, with the possibility 
of adding values to the same II,JJ locations more than once.

end do

How can I solve this problem?

Thanks.




More information about the petsc-users mailing list