[SciPy-User] Permutation convention for LU decomposition

Jason Grout jason-sage@creativetrax....
Mon Nov 1 12:56:59 CDT 2010


On 10/31/2010 06:46 AM, Pauli Virtanen wrote:
> Sat, 30 Oct 2010 20:42:49 -0500, Jason Grout wrote:
>
>> I notice that in Lapack, Matlab, and Mathematica, the LU decomposition
>> routine for a matrix A returns a P, L, and U matrices so that:
>>
>> PA=LU
> LAPACK returns the P L U decomposition. Quote from the relevant manual
> page:
>
> """
> DGETRF computes an LU factorization of a general M-by-N matrix A using
> partial pivoting with row interchanges.  The factorization has the form
>
>            A = P * L * U
>
> where  P  is  a  permutation matrix, L is lower triangular with unit
> diagonal elements (lower trapezoidal if m>  n), and U is upper triangular
> (upper trapezoidal if m<  n). This is the right-looking Level 3 BLAS
> version of the algorithm.
> """
>

I can't find the documentation I was looking at to come to the erroneous 
conclusion that LAPACK gave back (the equivalent of) PA=LU; clearly the 
official LAPACK docs (quoted above) contradicts what I originally said.  
So now it makes perfect sense why scipy gives back A=PLU.

(and yes, I realize that LAPACK doesn't really return P as a matrix, and 
that P is trivial to invert; I was trying to simplify the question to 
one about convention of where the P was.)

Thanks, and sorry for the noise,

Jason



More information about the SciPy-User mailing list