In this example
A = [[0.7,  1.3], 
     [56.1, 7. ]]
I = [[1, 2], 
     [0, 0]]

Then if R is an array of zeros and shape (2, 4) it would end up being
R = [[0,    0.7, 1.3, 0], 
     [63.1, 0,   0,   0]] 

But this I guess is a peculiar example since I assume that each row in I corresponds to a row in A. I imagine there are different ways of storing the index in I.
I see now that A, I and R must have same length first dimension since it’s the number of samples, but can have different number of columns