# LRdecomposition -- LR decomposition

## Synopsis

• Usage:
LRdecomposition(A,pivotfunction)
• Inputs:
• A, , square and invertible.
• pivotfunction, , used for pivoting.
• Outputs:
• , of a list with a permutation of the rows of A corresponding to P, and a matrix containing L and R.

## Description

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 = | 9/2 1/2 3/2 | | 1/2 1 3/4 | | 9/4 3/4 7/4 | 3 3 o1 : Matrix QQ <--- QQ i2 : (perm,LR)=LRdecomposition(A,j->-j); i3 : perm o3 = {0, 1, 2} o3 : List i4 : P=transpose (id_(QQ^3))_perm o4 = | 1 0 0 | | 0 1 0 | | 0 0 1 | 3 3 o4 : Matrix QQ <--- QQ i5 : R=extractRightUpper(LR) o5 = | 9/2 1/2 3/2 | | 0 17/18 7/12 | | 0 0 47/68 | 3 3 o5 : Matrix QQ <--- QQ i6 : L=extractLeftLower(LR) o6 = | 1 0 0 | | 1/9 1 0 | | 1/2 9/17 1 | 3 3 o6 : Matrix QQ <--- QQ i7 : L*R==P*A o7 = true