Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def reverse(a):
- l, u = decomposition_lu(a)
- n = a.shape[0]
- reversed_matrix = np.matrix(np.zeros([n, n]))
- for i in range(n):
- ans = np.matrix(np.zeros([n, 1]))
- ans[i] = 1
- x = solve_lu(l, u, ans)
- for j in range(n):
- reversed_matrix[j, i] = x[j]
- return reversed_matrix
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement