[petsc-dev] preallocation checks
Matthew Knepley
knepley at gmail.com
Sat Jan 28 11:09:02 CST 2012
On Sat, Jan 28, 2012 at 10:11 AM, Stefano Zampini <stefano.zampini at gmail.com
> wrote:
> Hi Jed,
>
> you can use any code which calls the following sequence
>
> ierr = MatCreate(PETSC_COMM_SELF,&mat);CHKERRQ(ierr);
> ierr = MatSetSize(mat,n,m,n,m);CHKERRQ(ierr);
> ierr = MatSetType(mat,MATSEQDENSE);CHKERRQ(ierr);
> -> Then a loop to set values
> ierr = MatAssemblyBegin(mat);CHKERRQ(ierr);
> ierr = MatAssemblyEnd(mat);CHKERRQ(ierr);
>
> If you don't insert a "dummy" call to
> MatSeqDenseSetPreallocation(mat,PETSC_NULL) before doing the insertion
> loop, it will give an error.
>
I think MatSetUpPreallocation() would work. If we are requiring this, what
about having it called in
MatSetFromOptions().
Matt
> Stefano
>
>
> 2012/1/28 Jed Brown <jedbrown at mcs.anl.gov>
>
>> On Sat, Jan 28, 2012 at 05:40, Stefano Zampini <stefano.zampini at gmail.com
>> > wrote:
>>
>>> I'm getting errors when not preallocating for MATSEQDENSE matrices. Is
>>> it what you want with dense matrices too?
>>
>>
>> What can I run to see the error?
>>
>
>
>
> --
> Stefano
>
--
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-dev/attachments/20120128/09e9cdfa/attachment.html>
More information about the petsc-dev
mailing list