Decompose a matrix into lower- and upper-triangular matrices

lumatrix(m)

Arguments

m

a matrix

Value

list with matrices L and U representing the LU decomposition

Details

lumatrix decomposes the matrix m into the LU decomposition, such that m == L

See also

Examples

A <- matrix(c(1, 2, -7, -1, -1, 1, 2, 1, 5), 3)
lumatrix(A)
#> $P
#>      [,1] [,2] [,3]
#> [1,]    1    0    0
#> [2,]    0    1    0
#> [3,]    0    0    1
#> 
#> $L
#>      [,1] [,2] [,3]
#> [1,]    1    0    0
#> [2,]    2    1    0
#> [3,]   -7   -6    1
#> 
#> $U
#>      [,1] [,2] [,3]
#> [1,]    1   -1    2
#> [2,]    0    1   -3
#> [3,]    0    0    1
#>