I have pushed a fix for the documentation that explains the need for MatSetBlockSize(). It will appear<br>in the next patch release, and the next nightly build of the online documentation.<br><br> Thanks,<br><br> Matt<br>
<br><div class="gmail_quote">On Thu, Aug 6, 2009 at 5:05 AM, Umut Tabak <span dir="ltr"><<a href="mailto:u.tabak@tudelft.nl">u.tabak@tudelft.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear all,<br>
<br>
There is sth which took some time for me to figure out from the documentation<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatSetValuesBlocked.html#MatSetValuesBlocked" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatSetValuesBlocked.html#MatSetValuesBlocked</a><br>
<br>
Or my English is getting worser, In the explanations that are a part of this function,<br>
<br>
The m and n count the NUMBER of blocks in the row direction and column direction, NOT the total number of rows/columns; for example, if the block size <<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Sys/size.html#size" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Sys/size.html#size</a>> is 2 and you are passing in values for rows 2,3,4,5 then m would be 2 (not 4). The values in idxm would be 1 2; that is the first index for each block divided by the block size <<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Sys/size.html#size" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Sys/size.html#size</a>>. <br>
<br>
But the puzzling point is that there are no pointers for the setting of the block size and hyperlinks on size also do not direct to the right locations in my humble opinion.<br>
<br>
However, proper block size setting should be done before using this routine with MatSetBlockSize. Am I right?<br>
<br>
And this page has no pointers to that function. After reading the documetation, I had the idea in the mind that, you decide on the block size, and do the computations on paper for m,idxm,n and idxn to be supplied to the routine but ,apparently, without a call to the function the programs can not know the block size, which is logical.<br>
<br>
I felt myself a bit dump, and wanted to notify you about this if someone else also experiences the same problem in the future, maybe adding a link there for the above mentioned function is a good idea.<br>
<br>
//MatSetBlockSize(A, 3);<br>
const int idxmNew1[] = {0};<br>
const int idxnNew1[] = {0};<br>
PetscScalar vals1[] = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 };<br>
MatSetValuesBlocked(A, 1, idxmNew1, 1, idxnNew1, vals1, INSERT_VALUES);<br>
ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);<br>
ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);<br>
<br>
Running the above piece of code of course sets only M[0][0] with out proper setting of the blocks. Or do I still have some misunderstanding on the use of this function?<br>
<br>
Best regards,<br><font color="#888888">
Umut<br>
<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>