[petsc-dev] preallocation checks

Stefano Zampini stefano.zampini at gmail.com
Sat Jan 28 10:11:44 CST 2012


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.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120128/4740f6b7/attachment.html>


More information about the petsc-dev mailing list