I have three arrays of shapes:
A = a = np.random.exponential(1, [10, 1000000]) # of shape (10, 1000000)
B = a = np.random.exponential(1, [10, 1000000]) # of shape (10, 1000000)
I computed another array IND[ ] as below. Each element of IND[ ] is index of the maximum element of A (maximum of each 10 values in a column) ,
IND = np.argmax(snr_sr, axis=0) # of shape (1000000,)
I want to calculate another array C, which contains the element-wise minimum values of A and B at row# specified by values of IND[ ]. Thus the C array should be of the shape (1, 1000000). I want to avoid for loops. I tried the below, but the values of C are not correct.
for j in range(0, A.shape[1]):
m = ind[j]
C = minimum(A[m,:], B[m,:]) # return 1x1000000 array
Sorry, as the arrays are large, could not post it. You can take any arrays of the same shapes.
First Edit: Somebody provided me with the right answer, but he deleted it (don't know why?) Anyhow, I copied the answer before he deleted it. Please post it again so that I can mark it correct. (To him: Who took arrays of 1,100 for simplicity).