[petsc-users] Get LU decomposition of a rectangular matrix

Smith, Barry F. bsmith at mcs.anl.gov
Tue Mar 13 16:14:04 CDT 2018


   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