Solves AX = B system for X using LU decomposition.
Converts Matrix A into L (with ones on the diagonal) and U matrix.
- findLU:
Input: square matrix with no column, in the lower left of the matrix, completely zero.
Result: L the lower left matrix; U the upper right matrix; P the permutation matrix. - msolve:
Calls the findLU function and solves a system AX = B
The functions are tested by using Matlab's magic(n) function to generate a random n x n square matrix.
- findLU function:
- lu function by Matlab (Note the scale of the vertical axis Time):
- YES, Matlab's lu function is around 422 times faster than my findLU, compared at matrix dimension 1600 x 1600.