June 2018
Intermediate to advanced
248 pages
5h 27m
English
Similar to Cholesky decomposition, LU decomposition decomposes a matrix (M) into lower (L) and upper (U) triangular matrices. This also helps us to simplify computationally intensive algebra. It can be summed up in the following formula:
M=LU
The following is an illustration of LU decomposition:

Let's see how it's implemented using numpy:
from numpy import arrayfrom scipy.linalg import luM = np.random.randint(low=0, high=20, size=25).reshape(5,5)print(M)# Output[[18 12 14 15 2] [ 4 2 12 18 3] [ 9 19 5 16 8] [15 19 6 16 11] [ 1 19 2 18 17]]P, L, U = lu(M)print("P:n {}n".format(P))print("L:n {}n".format(L))print("U:n ...