<div class="gmail_quote">On Wed, Aug 8, 2012 at 2:25 PM, Jinquan Zhong <span dir="ltr"><<a href="mailto:jzhong@scsolutions.com" target="_blank">jzhong@scsolutions.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><p class="MsoNormal">If I understand you correctly, ScaLAPACK blocks don't have anything to do with the sparse matrix structure.<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">******************************************************************************************************************************************<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">You are correct.  What I meant was how to define the diagonal and off-diagonal parts of each submatrix matrix  A (LDA, LDB).  For example, in the following
 matrix,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">                                 
</span><b><span style="font-size:10.0pt;font-family:"Courier New"">Proc0</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<b>Proc1</b>       <b>Proc2</b></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            1  2  0  |  0  3  0  |  0  4<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">   
<b>Proc0</b>   0  5  6  |  7  0  0  |  8  0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            9  0 10  | 11  0  0  | 12  0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    -------------------------------------<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">           13  0 14  | 15 16 17  |  0  0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">   
<b>Proc3</b>   0 18  0  | 19 20 21  |  0  0      <=== owned by </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Proc 5</span><span style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            0  0  0  | 22 23  0  | 24  0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    -------------------------------------<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">   
<b>Proc6</b>  25 26 27  |  0  0 28  | 29  0<u></u><u></u></span></p>
<p class="MsoNormal">                     <span style="font-size:10.0pt;font-family:"Courier New"">30  0  0  | 31 32 33  |  0  34<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I am not sure how to fill out the values for d_nz, d_nnz,o_nz, o_nnz peoperly for the subblock (0 0 ;0 0; 24 0) owned by Proc 5 since it was based on diagonal
 and off-diagonal parts.</span></p></blockquote></div><br><div>Throw your 2D block cyclic nonsense out the window. These are sparse matrices and that layout would be terrible. Logically permute your matrices all you want, then define a global ordering and chunk it into contiguous blocks of rows (no partition of columns). Work this out with a pencil and paper. You should have a function that translates row/column pairs from your ordering to our ordering. Now compute the sparsity pattern in the new ordering. (Usually you can figure this out on paper as well.) Then preallocate and call MatSetValues() with the new (row,column) locations.</div>