I need to vectorize this for loop for a loss function in pytorch.
nlr = 461
for j in np.arange(nlr-1,-1,-1):
ed = np.exp(1j * (d[j]/v[j])*om) #I know this can be done using outer product
reverb = 1 / (1 - ru[j]*ed*rdhat*ed)
rdhat = rd[j] + tu[j]*ed*rdhat*ed*reverb*td[j]
tdhat = tdhat*ed*reverb*td[j]
d and v are arrays, and they both have shape of (461,1)
om has shape of (600,1)
ru has a shape of (461,1)
rdhat has a shape of (600,1)
tdhat has a shape of (600,1)
Some help please?