I have a matrix in numpy
A = [[1,2,3],
[4,5,6],
[7,8,9]]
and a plain array
B = [2,1,0]
I want to compress the matrix into a single column such that for the ith row I want to pick the B[i]th column and put it in the column vector
So I want an elegant/vectorized implementation to get
Ans = [3,5,7]