[petsc-users] Changing a few entries in a matrix

Matthew Knepley knepley at gmail.com
Fri May 8 16:15:56 CDT 2015


On Fri, May 8, 2015 at 4:14 PM, Ganesh Vijayakumar <ganesh.iitm at gmail.com>
wrote:

> Hello,
>
>   Thanks. Looks like I could set all the possible entries I'll use to zero
> and selectively overwrite them.
>
>   Can I overwrite any entries without incurring additional cost in memory?
> I currently use MatSetValue with the option INSERT_VALUES? Does Petsc have
> an option to OVERWRITE the existing value?
>

Here INSERT means the same as overwrite. You only incur costs if you have
not previously set the element.

  Thanks,

    Natt


> ganesh
>
> On Fri, May 8, 2015 at 5:10 PM, Jed Brown <jed at jedbrown.org> wrote:
>
>> Ganesh Vijayakumar <ganesh.iitm at gmail.com> writes:
>>
>> > Hello,
>> >
>> >   I have a CFD application where some entries of the matrix change every
>> > time step.
>>
>> The entries change value or the set of nonzero entries changes?  If the
>> former, just MatSetValues and carry on.  If the latter, either allocate
>> for the union of all possible nonzeros (storing some explicit zeros) or
>> reallocate the matrix each time.
>>
>> > However, the total number of non-zero elements never changes. Is there
>> > anyway I can efficiently do this. My current attempts at doing this
>> > results in running over the total initial memory allocation very soon.
>> >
>> > ganesh
>>
>
>
>
> --
> ganesh
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150508/6bef4f23/attachment-0001.html>


More information about the petsc-users mailing list