<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">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 "<u><i>MatMPIAIJSetPreallocation(A,dnz,PETSC_NULL,0,PETSC_NULL);</i></u>" in which dnz is computed for each row and all the off diagonal terms are zero I am getting an error: <br>"<b>[<i>0]PETSC ERROR:Argument out of range<br>[0]PETSC ERROR: New nonzero at (0,4) caused a malloc</i></b>"<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">But when I am commenting the line corresponding to the Preallocation, the code is running fine. <br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Thank you,<br clear="all"></div><div><div class="gmail_signature"><div dir="ltr"><font color="#888888"><div dir="ltr"><font color="#000000" face="georgia, serif"><i>Kaushik<br></i></font></div></font></div></div></div>
</div>