<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hello,<br><br>I have a slight problem with performance of matsetvalues when inserting values row-by-row on single processor instead of column-by-column.<br><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; ierr = MatCreate(PETSC_COMM_WORLD,&amp;L);</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; ierr = MatSetSizes(L,PETSC_DECIDE,PETSC_DECIDE,n,n);</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; ierr = MatSetFromOptions(L);</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; MatSeqAIJSetPreallocation(L,PETSC_NULL,nnz);</span><br style="font-style: italic;"><span style="font-style: italic;"><br>&nbsp; &nbsp; (...) &nbsp;&nbsp;&nbsp; </span><br><br style="font-style: italic;"><span
 style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; MatSetValues(L,rows,indices_y,1,&amp;col,values,INSERT_VALUES);</span><br style="font-style: italic;">vs &nbsp;&nbsp;&nbsp; <br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp; MatSetValues(L,1,&amp;row,cols,indices_x,values,INSERT_VALUES);</span><br style="font-style: italic;"><br>First way goes quick and gives me mallocs in matsetvalues = 0 in -info<br>While the second one takes much longer and does mallocs.<br><br>Why is it so that inserting rows is slower than inserting columns when proper nnz was provided? Or maybe there is my mistake here somewhere? <br><br>Regards<br></td></tr></table>