for example,I have a matrix like this
mat = np.diag((1,1,1,1,1,1))
print(mat)
out:[[1 0 0 0 0 0]
[0 1 0 0 0 0]
[0 0 1 0 0 0]
[0 0 0 1 0 0]
[0 0 0 0 1 0]
[0 0 0 0 0 1]]
I may need some slices that can be combination of any lines and columns. if it is lines=[0,1,2] columns=[0,1,2],I could use:
mat[0:3,0:3]
If I need lines=[0,1,2,5] columns=[0,1,2,5],I write:
mat[[0,1,2,5],[0,1,2,5]]
I can only get:
out:[1 1 1 1]
But I wanna get a matrix of 4×4.By the way,the columns always equal lines.