<p>
Thank you Sherry for the triangular matrices extraction ways, it's very useful, I'll try to do this in SuperLU_DIST.
</p>
<p>
In addition, Matthew, is it possible for PETSc to write interfaces that support printing `L` and `U` for SuperLU_DIST? Because it is very useful in some industrial application scenarios (store `L` and `U` in advance).
</p>
<p>
<br>
</p>
<p>
Best Regards,
</p>
<p>
Gang
</p>
<br>
<br>
<blockquote name="replyContent" class="ReferenceQuote" style="padding-left:5px;margin-left:5px;border-left:#b6b6b6 2px solid;margin-right:0;">
-----原始邮件-----<br>
<b>发件人:</b><span id="rc_from">"Xiaoye S. Li" <xsli@lbl.gov></span><br>
<b>发送时间:</b><span id="rc_senttime">2022-10-25 05:47:15 (星期二)</span><br>
<b>收件人:</b> "Matthew Knepley" <knepley@gmail.com><br>
<b>抄送:</b> "赵刚" <zhaog6@lsec.cc.ac.cn>, petsc-users@mcs.anl.gov<br>
<b>主题:</b> Re: [petsc-users] An issue of extraction of factorization matrices in sparse direct solver<br>
<br>
<div dir="ltr">
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000;">
There are some utility routines for printing L\U in superlu_dist: SRC/dutil_dist.c
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000;">
<ol dir="auto" style="color:#222222;font-family:Arial,Helvetica,sans-serif;">
<li style="margin-left:15px;">
You can output the L factor to a file with the triplet format by using<br>
<a href="https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L675" target="_blank">https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L675</a><br>
but use line 755 instead of line 753.
</li>
<li style="margin-left:15px;">
You can convert the L factor to CSR or triplet using <a href="https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L815" target="_blank">https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L815</a><br>
<a href="https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L1075" target="_blank">https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L1075</a><br>
but need to make sure you only use 1 MPI to call superlu_dist
</li>
<li style="margin-left:15px;">
You can modify<br>
<a href="https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L1229" target="_blank">https://github.com/xiaoyeli/superlu_dist/blob/324d65fced6ce8abf0eb900223cba0207d538db7/SRC/dutil_dist.c#L1229</a><br>
to generate CSR/triplet for the U factor as well.
</li>
</ol>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000;">
<br>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000;">
Sherry Li
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">
On Sun, Oct 23, 2022 at 3:38 AM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid #CCCCCC;padding-left:1ex;">
<div dir="ltr">
<div dir="ltr">
On Sun, Oct 23, 2022 at 2:58 AM 赵刚 <<a href="mailto:zhaog6@lsec.cc.ac.cn" target="_blank">zhaog6@lsec.cc.ac.cn</a>> wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid #CCCCCC;padding-left:1ex;">
Dear developers,<br>
<br>
I have another question. How can I get the L and U matrices and store them in a file when I call SuperLU through PETSc? Thanks.
</blockquote>
<div>
<br>
</div>
<div>
SuperLU stores these matrices in its own format. If you want to do I/O with them, you would probably have to
</div>
<div>
extract them from the Petsc Mat and call SuperLU I/O functions, if they exist.
</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 #CCCCCC;padding-left:1ex;">
Best Regards,<br>
Gang
</blockquote>
</div>
-- <br>
<div dir="ltr">
<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>
</blockquote>
</div>
</blockquote>