Python:numpy command
Import numpy as np
Create a matrix:
A = np.array([[elements of row1], [element of row2], ... ])
A = np.array([[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6]])
A=⎣⎡ 123 234 345 456 ⎦⎤
Sub-matrix
B = A[[select row], select column]
B = A[[0, 2], 1:]
B=[24 35 46 ]
Create a matrix:
A = np.array([[elements of row1], [element of row2], ... ])
A = np.array([[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6]])
A=⎣⎡ 123 234 345 456 ⎦⎤
Sub-matrix
B = A[[select row], select column]
B = A[[0, 2], 1:]
B=[24 35 46 ]
Comments
Post a Comment