Skip to content

Commit 93fd6cf

Browse files
authored
Add files via upload
1 parent a13d26f commit 93fd6cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

matrix_decomposition.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"@Author: @learn.machinelearning"
2+
3+
import numpy as np
4+
from numpy.linalg import qr
5+
from scipy.linalg import lu
6+
7+
# Python code for LU decomposition
8+
# Theory https://www.instagram.com/p/BtAy08dn-tZ/
9+
matrix_A = np.array([[4, -1, 9, 3], [13, 5, 12, 8], [4, 3, 8, 12]])
10+
result = lu(matrix_A)
11+
print("Result of {} = {}, {}".format(matrix_A, result[0], result[1]))
12+
13+
# Python code for QR decomposition
14+
# Theory https://www.instagram.com/p/BtAy08dn-tZ/
15+
matrix_A = np.array([[4, -1, 9, 3], [13, 5, 12, 8], [4, 3, 8, 12]])
16+
result = qr(matrix_A)
17+
print("Result of {} = {}, {}".format(matrix_A, result[0], result[1]))
18+

0 commit comments

Comments
 (0)