<div dir="ltr"><div><div><div><div>Thanks for your answer<br>In between I tried to call directly MatLUFactorSymbolic then MatLUFactorNumeric to avoid MatGetOrdering, and the code fails later (in the call to SuperLu routine pdgssvx).<br></div><br></div>I would prefer to use PETSc for the computation of the nullbasis: the input matrix is a PETSc "Mat" (MPIAIJ) and the ouput basis will be used to project a linear system (also a PETSc "Mat" and Vec) on a reduced space. <br></div>Parallel format conversion is quite tricky and error prone. Using Petsc "Mat" is much easier and safe than maintaining my own SuperLU interface.<br><br></div><div>Here are some details on what I plan to do :<br></div><div>get a LU decomposition of a rectangular constraints matrix :<br></div><div>P C Q = ( L1 )<br></div><div> ( L2 )<br></div><div>then obtain L1^{-1} L2 <br></div><div>II hoped to get the factors after LU decomposition (possible with SuperLu and SuperLU_dist, but ot with MUMPS) and call MatMatSolve afterwards (which is only possible if L2 is a dense matrix - if my understanding of the documentation is correct) <br></div><div>then the basis Z is used to project a rigidity matrix K ( ie compute or define as a MatShell Z^T K Z ) <br></div><div><br>Do you confirm that it is not a good option to use PETSc for this ? <br></div><div><div><div><div><div><div>Thanks a lot again for your advice and help <br></div><div>Natacha <br></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 13, 2018 at 10:14 PM, 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"> For your purposes you should just use superlu or superlu_dist directly in your code not through PETSc.<br>
<br>
Barry<br>
<br>
There is nothing to be gained by doing it through PETSc.<br>
<br>
This is not relevant for your use case but I have noted that the unneeded use of MatGetOrdering() should be eliminated <a href="https://bitbucket.org/petsc/petsc/issues/211/matgetordering-should-not-be-called-for" rel="noreferrer" target="_blank">https://bitbucket.org/petsc/<wbr>petsc/issues/211/<wbr>matgetordering-should-not-be-<wbr>called-for</a><br>
<span class="im HOEnZb"><br>
> On Mar 13, 2018, at 7:04 AM, Natacha BEREUX <<a href="mailto:natacha.bereux@gmail.com">natacha.bereux@gmail.com</a>> wrote:<br>
><br>
> Hi Barry<br>
> Thanks for your answer,<br>
> I followed your suggestion (matrix type = MPIAIJ and superlu_dist on a single processor) but I still get the same problem.<br>
><br>
><br>
> Rectangular matrices seem to be forbidden in MatGetOrdering(), whatever package is used for the LU decomposition<br>
><br>
> Here is the output :<br>
> ./ex12f -f data/constraints.bin -pc_factor_mat_solver_package superlu_dist -pc_type lu<br>
><br>
> 9 33 9 33 1. 0.3E+02 0.3E+02 0. 0.7E+04 1. 0.<br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR: Invalid argument<br>
> [0]PETSC ERROR: Must be square matrix, rows 33 columns 9<br>
><br>
><br>
</span><div class="HOEnZb"><div class="h5">> Should I call directly a factorization routine ? Instead of trying to build a preconditionner ?<br>
><br>
><br>
> Best regards,<br>
> Natacha<br>
><br>
><br>
> On Mon, Mar 12, 2018 at 3:46 PM, Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> Create the matrix on one process but make it a MPIAIJ matrix (not SeqAIJ or AIJ) then you should be able to do the factorization with SuperLU_Dist<br>
><br>
> Please let us know how it goes,<br>
><br>
> Barry<br>
><br>
><br>
> > On Mar 12, 2018, at 4:35 AM, Natacha BEREUX <<a href="mailto:natacha.bereux@gmail.com">natacha.bereux@gmail.com</a>> wrote:<br>
> ><br>
> > Dear Petsc user's<br>
> ><br>
> > I am trying to use SuperLU_dist to compute LU decomposition of a non-square matrix.<br>
> ><br>
> > My purpose is to build a basis of the nullspace of a matrix C . This matrix stores constraints (i.e. linear relationships between degrees of freedom): it is thus rectangular (size 9 x 33) and not square<br>
> > I need to get the L U factors of C^T which is a tall skinny matrix.<br>
> > It is possible when using directly SuperLu or SuperLU_dist<br>
> > But when I use Petsc interface to SuperLU I get the following error :<br>
> ><br>
> > [0]PETSC ERROR: Invalid argument<br>
> > [0]PETSC ERROR: Must be square matrix, rows 9 columns 33<br>
> > [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a> for trouble shooting.<br>
> > [0]PETSC ERROR: Petsc Release Version 3.8.3, Dec, 09, 2017<br>
> > [0]PETSC ERROR: #1 MatGetOrdering() line 243 in /home/H03755/Librairies/petsc-<wbr>3.8.3/src/mat/order/sorder.c<br>
> > [0]PETSC ERROR: #2 PCSetUp_LU() line 84 in /home/H03755/Librairies/petsc-<wbr>3.8.3/src/ksp/pc/impls/factor/<wbr>lu/lu.c<br>
> > [0]PETSC ERROR: #3 PCSetUp() line 924 in /home/H03755/Librairies/petsc-<wbr>3.8.3/src/ksp/pc/interface/<wbr>precon.c<br>
> > [0]PETSC ERROR: #4 KSPSetUp() line 381 in /home/H03755/Librairies/petsc-<wbr>3.8.3/src/ksp/ksp/interface/<wbr>itfunc.c<br>
> > [0]PETSC ERROR: #5 KSPSolve() line 612 in /home/H03755/Librairies/petsc-<wbr>3.8.3/src/ksp/ksp/interface/<wbr>itfunc.c<br>
> > [0]PETSC ERROR: #6 User provided function() line 0 in User file<br>
> ><br>
> > The use of non-square matrices is forbidden.<br>
> ><br>
> > Is there a way to specify that I want to use a rectangular matrix ? How can I proceed to call SuperLU through PETSc with a rectangular matrix ?<br>
> ><br>
> > Thanks a lot for your help<br>
> > Best regards,<br>
> ><br>
> > Natacha<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>