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

Smith, Barry F. bsmith at mcs.anl.gov
Mon Mar 12 09:46:40 CDT 2018

   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,


> 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