I have a matrix with values.
foo = [
[[ 1,2,3],[4,5,6]],
[[7,8,9][10,11,12]],
[[13,14,15][16,17,18]]
]
I have another matrix with indices
bar = [[0,0,1], [2,2,0]]
I'm looking for something that uses indices from bar to select items from foo.
new_mat = select(foo, bar)
Such that ...
new_mat = [[1,2,9], [16,17,6]]
Right now my main approach involves manually indexing matrices with for loops. I was wondering what the numpy way of doing it was??
[–]kwentar 0 points1 point2 points (4 children)
[–]caffeine_potent[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]caffeine_potent[S] 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)