[petsc-users] Doubt related to MatSetValues()

Matthew Knepley knepley at gmail.com
Sat Feb 13 09:44:02 CST 2016


On Sat, Feb 13, 2016 at 2:19 AM, Kaushik Kulkarni <kaushikggg at gmail.com>
wrote:

> After preallocating a matrix do I have to change the way in which I have
> to use the function MatSetValues(). The reason I am asking this is that
> when I am executing the code with the line "
> *MatMPIAIJSetPreallocation(A,dnz,PETSC_NULL,0,PETSC_NULL);*" in which dnz
> is computed for each row and all the off diagonal terms are zero I am
> getting an error:
> "
> *[0]PETSC ERROR:Argument out of range[0]PETSC ERROR: New nonzero at (0,4)
> caused a malloc*"
>

It sounds like (0,4) is an off-diagonal.

   Matt


> But when I am commenting the line corresponding to the Preallocation, the
> code is running fine.
>
> Thank you,
>
> *Kaushik*
>



-- 
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/20160213/9b31c8a8/attachment.html>


More information about the petsc-users mailing list