<div class="gmail_quote">On Wed, Aug 8, 2012 at 1:32 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 lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks, Jed.<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" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So would you prefer to using MatCreateAIJ(…) or MatXAIJSetPreallocation(…)? I am having trouble to fill out the parameters. My
local dense matrix is A(LDA, LDB). The global size of square matrix is N. What would be the parameters to use them?</span></p></div></div></blockquote><div><br></div><div>You said you want to expand this into a larger sparse matrix, therefore you need to figure out how that larger matrix will be organized.</div>
<div><br></div><div>I like MatXAIJSetPreallocation() because it works with "blocked" formats, but keep in mind that "blocked" in PETSc does not mean the same as "blocked" for dense matrices.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I used
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:.5in;text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">MatCreateAIJ(PETSC_COMM_WORLD, LDA,LDB, N,N, d_nz, d_nnz,o_nz,o_nnz, &A);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:.5in;text-autospace:none">MatXAIJSetPreallocation<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">(PETSC_COMM_WORLD, 1, d_nz, d_nnz,o_nz,o_nnz, &A);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">However, I have trouble to figure out the values for
<b>d_nz, d_nnz,o_nz, o_nnz</b> since the local A is a block consisting of several sub-blocks from ScaLAPACK. I think MatCreateAIJ and MatXAIJSetPreallocation both take several rows together. </span></p></div></div></blockquote>
<div><br></div><div>If I understand you correctly, ScaLAPACK blocks don't have anything to do with the sparse matrix structure.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Do you think it is still doable to preallocate A using either function?</span></p>
</div></div></blockquote><div><br></div><div>Yes, definitely. Look at examples and/or the users manual for further explanation of preallocation.</div></div>