<div dir="ltr"><div dir="ltr">On Mon, Jun 22, 2020 at 11:39 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">Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>, 22 Haz 2020 Pzt, 14:43 tarihinde<br>
şunu yazdı:<br>
><br>
> On Mon, Jun 22, 2020 at 7:14 AM Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr" target="_blank">eda.oktay@metu.edu.tr</a>> wrote:<br>
>><br>
>> 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>
>> The 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>
><br>
><br>
> I assume you want a parallel matrix with the element in the diagonal block removed. I can think<br>
> of at least two ways to do this which sound easier to me:<br>
><br>
>   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" rel="noreferrer" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/axpy.c.html#MatChop</a><br>
<br>
I read MatChop before, however I couldn't understand how to decide<br>
tolerance. What I understood from this function is to eliminate<br>
entries less than a number which is set to be the tolerance. But the<br>
entries in the diagonal blocks can be less than ones in offdiagonal<br>
blocks. What am I missing?<br></blockquote><div><br></div><div>You _change_ the code. MatChop decides to make an element zero by looking at how big it is. You would decide</div><div>to make an element zero by looking at what column it is in.</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">
><br>
>   2) Use MatGetSubMatrix() and exclude any columns from the diagonal block on each process.<br>
><br>
>   Thanks,<br>
><br>
>      Matt<br>
><br>
>><br>
>> Thanks!<br>
><br>
><br>
><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>
><br>
> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><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>