[petsc-users] Get LU decomposition of a rectangular matrix
Smith, Barry F.
bsmith at mcs.anl.gov
Wed Mar 14 08:31:48 CDT 2018
Please email the code that fails to petsc-maint at mcs.anl.gov
> On Mar 14, 2018, at 3:56 AM, Natacha BEREUX <natacha.bereux at gmail.com> wrote:
>
> Thanks for your answer
> 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).
>
> 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.
> Parallel format conversion is quite tricky and error prone. Using Petsc "Mat" is much easier and safe than maintaining my own SuperLU interface.
>
> Here are some details on what I plan to do :
> get a LU decomposition of a rectangular constraints matrix :
> P C Q = ( L1 )
> ( L2 )
> then obtain L1^{-1} L2
> 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)
> then the basis Z is used to project a rigidity matrix K ( ie compute or define as a MatShell Z^T K Z )
>
> Do you confirm that it is not a good option to use PETSc for this ?
> Thanks a lot again for your advice and help
> Natacha
>
> On Tue, Mar 13, 2018 at 10:14 PM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
> For your purposes you should just use superlu or superlu_dist directly in your code not through PETSc.
>
> Barry
>
> There is nothing to be gained by doing it through PETSc.
>
> This is not relevant for your use case but I have noted that the unneeded use of MatGetOrdering() should be eliminated https://bitbucket.org/petsc/petsc/issues/211/matgetordering-should-not-be-called-for
>
> > On Mar 13, 2018, at 7:04 AM, Natacha BEREUX <natacha.bereux at gmail.com> wrote:
> >
> > Hi Barry
> > Thanks for your answer,
> > I followed your suggestion (matrix type = MPIAIJ and superlu_dist on a single processor) but I still get the same problem.
> >
> >
> > Rectangular matrices seem to be forbidden in MatGetOrdering(), whatever package is used for the LU decomposition
> >
> > Here is the output :
> > ./ex12f -f data/constraints.bin -pc_factor_mat_solver_package superlu_dist -pc_type lu
> >
> > 9 33 9 33 1. 0.3E+02 0.3E+02 0. 0.7E+04 1. 0.
> > [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> > [0]PETSC ERROR: Invalid argument
> > [0]PETSC ERROR: Must be square matrix, rows 33 columns 9
> >
> >
> > Should I call directly a factorization routine ? Instead of trying to build a preconditionner ?
> >
> >
> > Best regards,
> > Natacha
> >
> >
> > On Mon, Mar 12, 2018 at 3:46 PM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
> >
> > 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
> >
> > Please let us know how it goes,
> >
> > Barry
> >
> >
> > > On Mar 12, 2018, at 4:35 AM, Natacha BEREUX <natacha.bereux at gmail.com> wrote:
> > >
> > > Dear Petsc user's
> > >
> > > I am trying to use SuperLU_dist to compute LU decomposition of a non-square matrix.
> > >
> > > 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
> > > I need to get the L U factors of C^T which is a tall skinny matrix.
> > > It is possible when using directly SuperLu or SuperLU_dist
> > > But when I use Petsc interface to SuperLU I get the following error :
> > >
> > > [0]PETSC ERROR: Invalid argument
> > > [0]PETSC ERROR: Must be square matrix, rows 9 columns 33
> > > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> > > [0]PETSC ERROR: Petsc Release Version 3.8.3, Dec, 09, 2017
> > > [0]PETSC ERROR: #1 MatGetOrdering() line 243 in /home/H03755/Librairies/petsc-3.8.3/src/mat/order/sorder.c
> > > [0]PETSC ERROR: #2 PCSetUp_LU() line 84 in /home/H03755/Librairies/petsc-3.8.3/src/ksp/pc/impls/factor/lu/lu.c
> > > [0]PETSC ERROR: #3 PCSetUp() line 924 in /home/H03755/Librairies/petsc-3.8.3/src/ksp/pc/interface/precon.c
> > > [0]PETSC ERROR: #4 KSPSetUp() line 381 in /home/H03755/Librairies/petsc-3.8.3/src/ksp/ksp/interface/itfunc.c
> > > [0]PETSC ERROR: #5 KSPSolve() line 612 in /home/H03755/Librairies/petsc-3.8.3/src/ksp/ksp/interface/itfunc.c
> > > [0]PETSC ERROR: #6 User provided function() line 0 in User file
> > >
> > > The use of non-square matrices is forbidden.
> > >
> > > 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 ?
> > >
> > > Thanks a lot for your help
> > > Best regards,
> > >
> > > Natacha
> >
> >
>
>
More information about the petsc-users
mailing list