How to perform LU factorization of a full rank matrix in FORTRAN
\(LU\) factorization is a method for decomposing a matrix into the product of two matrices, a lower
triangular matrix \(L\) and an upper triangular matrix \(U\). The \(LU\) factorization of a matrix \(A\) can be
written as follows:
\(A=LU\)
where \(L\) is a lower triangular matrix with all diagonal elements equal to \(1\), and \(U\) is an upper triangular matrix.
The \(LU\) factorization of a full rank matrix can be used to solve systems of linear equations, to compute the
determinant of a matrix, and to invert a matrix.
To perform \(LU\) factorization, we can use the following steps:
- Initialize \(L\) to the identity matrix.
- For each row \(i\), from top to bottom, do the following:
- Subtract the product of row \(i\) and the first column of \(U\) from all rows below row \(i\).
- Divide row \(i\) by the diagonal element of \(U\).
- The resulting matrices \(L\) and \(U\) are the \(LU\) factorization of \(A\).