<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 26, 2018 at 11:48 AM, Smith, Barry F. <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> On Jul 26, 2018, at 10:34 AM, Xiangdong <<a href="mailto:epscodes@gmail.com">epscodes@gmail.com</a>> wrote:<br>
> <br>
> Hello everyone,<br>
> <br>
> I have a question about get the sub matrix Aodd from a MPIBAIJ matrix A. For example, if the bs=2 and the matrix size is 10x10. How can I get the 5x5 submatrix corresponding to the odd rows and odd columns only?<br>
> <br>
> I tried to use the MatCreateSubMatrix, but get the error messages "Index set does not match blocks". It seems that MatCreateSubMatrix can only provide the whole block, instead of just a specific component of that block.<br>
> <br>
> Can you give me some suggestions on extracting the submatrix corresponding to a specific component?<br>
<br>
</span>   Either create a AIJ matrix originally or use MatConvert to convert from BAIJ to AIJ and then use MatCreateSubMatrix(). Note that AIJ provides a great deal more flexibility with the utilities and solvers than BAIJ.<br>
<br></blockquote><div><br></div><div>I chose BAIJ because the BAIJ format will perform better than the AIJ in the Matrix-Vec multiplication. It seems that MatConvert needs additional memory space to store the converted matrix (i.e. two copies of A in different format).</div><div><br></div><div>I may try using MatGetRow on A and MatSetValues on Aodd to create the submatrix to see how it performs.</div><div><br></div><div>Thanks.</div><div><br></div><div>Xiangdong</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   Barry<br>
<br>
> <br>
> Thank you.<br>
> <br>
> Best,<br>
> Xiangdong<br>
<br>
</blockquote></div><br></div></div>