How to directly vectorize a function that takes indices as an input and returns a 2x2 np.array