<div dir="ltr"><div dir="ltr">On Tue, Apr 25, 2023 at 6:03 AM 권승리 / 학생 / 항공우주공학과 <<a href="mailto:ksl7912@snu.ac.kr">ksl7912@snu.ac.kr</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"><div dir="ltr">Thank you for your reply.<div><br></div><div>I think I gave an example of an unrealistic problem.</div><div><br></div><div>I just wanted to know how to compute the inverse matrix, so I was wondering if there is an example of computing the inverse matrix in PETSc.</div></div></blockquote><div><br></div><div>You just use</div><div><br></div><div> KSPCreate(PETSC_COMM_WORLD, &ksp);</div><div> KSPSetOperator(ksp, A, A);</div><div> KSPSetFromOptions(ksp);</div><div> KSPSolve(ksp, b, x);</div><div><br></div><div>This solves the system. If you want an exact solution use</div><div><br></div><div> -pc_type lu</div><div><br></div><div>There is a manual chapter on linear solves such as there.</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"><div dir="ltr"><div>Alternatively, I want to know how to link the LAPACK library.</div><div><br></div><div><div style="color:rgb(80,0,80)">best,</div><div style="color:rgb(80,0,80)"><br></div><div style="color:rgb(80,0,80)">Seung Lee Kwon</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2023년 4월 25일 (화) 오후 6:44, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Mon, Apr 24, 2023 at 11:47 PM 권승리 / 학생 / 항공우주공학과 <<a href="mailto:ksl7912@snu.ac.kr" target="_blank">ksl7912@snu.ac.kr</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"><div dir="ltr"><div>Dear all</div><div><br></div>It depends on the problem. It can have hundreds of thousands of degrees of freedom.</div></blockquote><div><br></div><div>Suppose your matrix was dense and had 1e6 dofs. The work to invert a matrix is O(N^3) with a small</div><div>constant, so it would take 1e18 = 1 exaflop to invert this matrix and about 10 Terabytes of RAM to store</div><div>it. Is this available to you? PETSc's supports Elemental and SCALAPACK for this kind of calculation.</div><div><br></div><div>If the system is sparse, you could invert it using MUMPS, SuperLU_dist, or Pardiso. Then the work and</div><div>storage depend on the density. There are good estimates for connectivity based on regular grids of given</div><div>dimension. The limiting resource here is usually memory, which motivates people to try iterative methods.</div><div>The convergence of iterative methods depend on detailed properties of your system, like the operator spectrum.</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"><div dir="ltr"><div>best,</div><div><br></div><div>Seung Lee Kwon</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2023년 4월 25일 (화) 오후 12:32, Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div> How large are the dense matrices you would like to invert?<br><div><br><blockquote type="cite"><div>On Apr 24, 2023, at 11:27 PM, 권승리 / 학생 / 항공우주공학과 <<a href="mailto:ksl7912@snu.ac.kr" target="_blank">ksl7912@snu.ac.kr</a>> wrote:</div><br><div><div dir="ltr">Dear all<div><br></div><div>Hello.</div><div>I want to make an inverse matrix like inv(A) in MATLAB.</div><div><br></div><div>Are there some methods to inverse matrix in petsc?</div><div><br></div><div>If not, I want to use the inverse function in the LAPACK library.</div><div><br></div><div>Then, how to use the LAPACK library in petsc? I use the C language.</div><div><br></div><div>Best,</div><div><br></div><div>Seung Lee Kwon</div><div><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr"><div>Seung Lee Kwon, Ph.D.Candidate</div><div>Aerospace Structures and Materials Laboratory</div><div>Department of Mechanical and Aerospace Engineering</div><div>Seoul National University</div><div>Building 300 Rm 503, Gwanak-ro 1, Gwanak-gu, Seoul, South Korea, 08826</div><div>E-mail : <a href="mailto:ksl7912@snu.ac.kr" target="_blank">ksl7912@snu.ac.kr</a></div><div>Office : +82-2-880-7389</div><div>C. P : +82-10-4695-1062</div></div></div></div></div>
</div></blockquote></div><br></div></blockquote></div><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr"><div>Seung Lee Kwon, Ph.D.Candidate</div><div>Aerospace Structures and Materials Laboratory</div><div>Department of Mechanical and Aerospace Engineering</div><div>Seoul National University</div><div>Building 300 Rm 503, Gwanak-ro 1, Gwanak-gu, Seoul, South Korea, 08826</div><div>E-mail : <a href="mailto:ksl7912@snu.ac.kr" target="_blank">ksl7912@snu.ac.kr</a></div><div>Office : +82-2-880-7389</div><div>C. P : +82-10-4695-1062</div></div></div>
</blockquote></div><br clear="all"><div><br></div><span>-- </span><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><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr"><div>Seung Lee Kwon, Ph.D.Candidate</div><div>Aerospace Structures and Materials Laboratory</div><div>Department of Mechanical and Aerospace Engineering</div><div>Seoul National University</div><div>Building 300 Rm 503, Gwanak-ro 1, Gwanak-gu, Seoul, South Korea, 08826</div><div>E-mail : <a href="mailto:ksl7912@snu.ac.kr" target="_blank">ksl7912@snu.ac.kr</a></div><div>Office : +82-2-880-7389</div><div>C. P : +82-10-4695-1062</div></div></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><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>