[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with using ADD_VALUES
- To: petsc-users@xxxxxxxxxxx
- Subject: Re: Problem with using ADD_VALUES
- From: "Matthew Knepley" <knepley@xxxxxxxxx>
- Date: Mon, 6 Aug 2007 06:26:15 -0500
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LD4F00W3X9Be1rzRwdzsIU8AuFAmdgzmI0WTnFaScH8v4FajUWSXeVKKhFRBPMhv4rlUBidyjfFaH54lm1IBHUBmpFAfv7IzNc/e6uPlwFlPxgA8Pc0fEFAGGoqZZIx3lqWPSXGyEBD/k6s4zxvkUnswMJm3NkpZpa+9wYlV44s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cyv+W9jOSftZ9+NxF43lhO1SAv0Kw/+Vx0pt41F4AFnbjFAv//5ZId32Yh5ygKS+BsvWxOfdQAwUumaQX8gFwmOu3AD+muqveHTL/lsnXtJ+qi+JMGCOqOrwtlfYxlYp6aIRgAJ1tr0pcFM7fvg3hRaMED/gdUch0DKp7vtBca0=
- In-reply-to: <46B6D937.2030900@gmail.com>
- References: <46B6D937.2030900@gmail.com>
- Reply-to: petsc-users@xxxxxxxxxxx
- Sender: owner-petsc-users@xxxxxxxxxxx
1) You could use MatZeroEntries() to zero out the matrix
2) You could call MatAssembly*(m, MAT_ASSEMBLY_FLUSH) in
between INSERT and ADD.
MAtt
On 8/6/07, Ben Tay <zonexo@xxxxxxxxx> wrote:
> 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.
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener