3
$\begingroup$

I am looking for a way to achieve the PLUR decomposition of a maitrx, as given in this paper here.

The equivalent syntax in Maple is:

 LUDecomposition(A, output=['P','L','U1','R'])

as detailed in here.

I 'hope' that works for both numerical and symbolic matrices, just like the one in Maple.

Here is my attempted:

ClearAll[myPLUR];
myPLUR[matrix_] := Module[
    {PA, lu, P, L, U, R, x1, x2},

    {lu, x1, x2} = LUDecomposition[matrix] // Quiet;
    P = Inverse[Part[IdentityMatrix[Length[x1]], x1]];

    PA = P.matrix;
    R = RowReduce[matrix];

    U = UpperTriangularize[lu];
    U = U.Transpose[R].Inverse[R.Transpose[R]];
    L = matrix.Transpose[R].Transpose[U].Inverse[U.R.Transpose[R].Transpose[U]] // FullSimplify;

    FullSimplify[{P, L, U, R}]

];

Original example in the paper:

A = {
    {3, 4, -2, 1, -2},
    {1, -1, 2, 2, 7},
    {4, -3, 4, -3, 2},
    {-1, 1, 6, -1, 1}
}


ans = myPLUR[A];
ans[[2]].ans[[3]].ans[[4]] - A // FullSimplify

{{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}

ans = myPLUR[A];
ans[[1]].ans[[2]].ans[[3]].ans[[4]] - A // FullSimplify

{{-4, -3, 8, -2, 3}, {2, 5, -4, -1, -9}, {-3, 2, -2, 5, 5}, {5, -4, -2, -2, 1}}

The code with my problem are:

'L' is not lower triangular and 'P' is still not quite right (LUR gives the original matrix, but PLUR cannot).

$\endgroup$
2
  • $\begingroup$ AuGment on right with an IdentityMatrix, use RowReduce. I think a decomposition of the part remaining in the augmented columns, or of its inverse, will be usable for reconstructing the PLU part. $\endgroup$ – Daniel Lichtblau Feb 20 '15 at 0:45
  • $\begingroup$ @DanielLichtblau Yes, I did try to AuGment on right with an IdentityMatrix. But I think it depends on specific matrices, sometimes, it need to be AuGmented with rows/columns of zeros. I find it a bit difficult to write a generalised code. (to reproduce the 'true' PLUR) $\endgroup$ – Chen Stats Yu Feb 20 '15 at 0:54