Ask Your Question

Revision history [back]

The LU method does that:

sage: A = random_matrix(ZZ,4)
sage: A
[ 0  1 -1  1]
[ 0 -1  2  0]
[ 1 -9 -8 -1]
[ 2  0  0 -2]
sage: A.LU()
(
[0 0 0 1]  [     1      0      0      0]  [   2    0    0   -2]
[0 0 1 0]  [   1/2      1      0      0]  [   0   -9   -8    0]
[0 1 0 0]  [     0    1/9      1      0]  [   0    0 26/9    0]
[1 0 0 0], [     0   -1/9 -17/26      1], [   0    0    0    1]
)
sage: A.LU?

The LU method does that:

sage: A = random_matrix(ZZ,4)
sage: A
[ 0  1 -1  1]
[ 0 -1  2  0]
[ 1 -9 -8 -1]
[ 2  0  0 -2]
sage: A.LU()
(
[0 0 0 1]  [     1      0      0      0]  [   2    0    0   -2]
[0 0 1 0]  [   1/2      1      0      0]  [   0   -9   -8    0]
[0 1 0 0]  [     0    1/9      1      0]  [   0    0 26/9    0]
[1 0 0 0], [     0   -1/9 -17/26      1], [   0    0    0    1]
)
sage: P,L,U = A.LU()
sage: P*L*U
[ 0  1 -1  1]
[ 0 -1  2  0]
[ 1 -9 -8 -1]
[ 2  0  0 -2]
sage: P*L*U == A
True

For the doc, see

sage: A.LU?