LQ decomposition (HP compatible): LQ

### 5.57.4 LQ decomposition (HP compatible): LQ

The LQ command takes a matrix A as argument.
LQ returns three matrices L, Q and P. If A is an m × n matrix, then L will be an m× n lower triangular matrix, Q will be an n× n orthogonal matrix, and P will be an n× n permutation matrix.
Input:

L, Q, P := LQ([[4,0,0],[8,-4,3]])

Output:

[[[4.0,0.0,0.0],[8.0,5.0,0.0]],[[1.0,0.0,0.0],[0.0,-0.8,0.6],[0.0,-0.6,-0.8]],[[1,0,0],[0,1,0],[0,0,1]]]

Here, L*Q is the same as P*A.
Input:

L,Q,P:=LQ([[24,18],[30,24]])

or:

[[[-30.0,0.0],[-38.4,-1.2]],[[-0.8,-0.6],[0.6,-0.8]],[[1,0],[0,1]]]

Again, L*Q = P*A.