Hi Jed,<br><br>you can use any code which calls the following sequence<br><br>ierr = MatCreate(PETSC_COMM_SELF,&mat);CHKERRQ(ierr);<br>ierr = MatSetSize(mat,n,m,n,m);CHKERRQ(ierr);<br>ierr = MatSetType(mat,MATSEQDENSE);CHKERRQ(ierr);<br>
-> Then a loop to set values<br>ierr = MatAssemblyBegin(mat);CHKERRQ(ierr);<br>ierr = MatAssemblyEnd(mat);CHKERRQ(ierr);<br>
<br>If you don't insert a "dummy" call to MatSeqDenseSetPreallocation(mat,PETSC_NULL) before doing the insertion loop, it will give an error.<br><br>Stefano<br><br><div class="gmail_quote">2012/1/28 Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div class="gmail_quote">On Sat, Jan 28, 2012 at 05:40, Stefano Zampini <span dir="ltr"><<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm getting errors when not preallocating for MATSEQDENSE matrices. Is it what you want with dense matrices too?</blockquote></div><br></div><div>What can I run to see the error?</div>
</blockquote></div><br><br clear="all"><br>-- <br>Stefano<br>