Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array([[ a, b, c],
- [ 0, d, e],
- [ 0, 0, f]])
- def create_upper_matrix(values, size):
- upper = np.zeros((size, size))
- upper[np.triu_indices(3, 0)] = values
- return(upper)
- c = create_upper_matrix([1, 2, 3, 4, 5, 6], 3)
- print(c)
Add Comment
Please, Sign In to add comment