here is my situation. Suppose you have an array A of some elements, A is np.ndarray, and B - also np.ndarray, where B[i] is how many times I'd like to take element A[i] for the output. Example: A = np.array([1, 2, 3, 4, 5]), B = np.array([0, 0, 2, 1, 3]). The result should be np.array([3, 3, 4, 5, 5, 5]).
So how to make it in numpy fast, without for-loops etc.
Thanks.
Tried to find something appropriate in numpy doc, but no success.