<div dir="ltr"><div dir="ltr">On Mon, Jun 22, 2020 at 7:14 AM Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr">eda.oktay@metu.edu.tr</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello everyone,<br>
<br>
I am trying to find elements in off diagonal blocks of a parallel<br>
sparse matrix. That is why, I want to use MatGetDiagonalBlock and from<br>
the matrix I obtain, I want to obtain off diagonal elements by<br>
subtracting it from my original matrix by using MatAXPY.<br>
<br>
However, since MatGetDiagonalBlock gives a sequential matrix and my<br>
original one is parallel, I can't use MatAXPY. That's why I want to<br>
change the type of one of the matrices.<br>
<br>
How can I change a MATSEQAIJ to MATMPIAIJ or vice versa?<br></blockquote><div><br></div><div>I assume you want a parallel matrix with the element in the diagonal block removed. I can think</div><div>of at least two ways to do this which sound easier to me:</div><div><br></div><div> 1) Make a copy and then zero out the diagonal block is a way similar to MatChop: <a href="https://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/axpy.c.html#MatChop">https://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/axpy.c.html#MatChop</a></div><div><br></div><div> 2) Use MatGetSubMatrix() and exclude any columns from the diagonal block on each process.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks!<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>