LU Matrix Factorization
Learn how to do LU matrix factorization of matrices using R, Rcpp, Armadillo, and Eigen.
What is LU factorization?
An LU factorization refers to the factorization of a square matrix , with proper row and/or column orderings or permutations, into two factors:
- A lower triangular matrix
- An upper triangular matrix
Press + to interact
A <- matrix(c(1, -1, 2, 2),nrow = 2,byrow = TRUE)fA <- LU(A = A) # compute the LU factorization of AA_ <- fA$P%*%fA$L%*%fA$U # retrieve the original matrix A by multiplying all factorsfAA_
Explanation
The resulting LU factors are:
fA <- LU(A = A)
...