Does the PA=LR decomposition on the matrix A, pivoting by the minimal value of pivotfunction. L can be extracted by the function extractLeftLower, R by extractRightUpper. This has been implemented with fields of rational functions in mind.
i1 : A=random(QQ^3,QQ^3)
o1 = | 3/5 1 9/4 |
| 3/4 3/10 1/7 |
| 9/5 9/8 1 |
3 3
o1 : Matrix QQ <--- QQ
|
i2 : (perm,LR)=LRdecomposition(A,j->-j);
|
i3 : perm
o3 = {2, 0, 1}
o3 : List
|
i4 : P=transpose (id_(QQ^3))_perm
o4 = | 0 0 1 |
| 1 0 0 |
| 0 1 0 |
3 3
o4 : Matrix QQ <--- QQ
|
i5 : R=extractRightUpper(LR)
o5 = | 9/5 9/8 1 |
| 0 5/8 23/12 |
| 0 0 2047/8400 |
3 3
o5 : Matrix QQ <--- QQ
|
i6 : L=extractLeftLower(LR)
o6 = | 1 0 0 |
| 1/3 1 0 |
| 5/12 -27/100 1 |
3 3
o6 : Matrix QQ <--- QQ
|
i7 : L*R==P*A
o7 = true
|