I'm trying to figure out how to most efficiently (with NumPy) calculate the following expression for a 1D ndarray (in this case, f):
I imagine I could do something like:
f = [ 1, 3, 2, 3, 7, 5, 2]
for i in range(0, len(f-1)):
for j in range(0, len(f-2)):
...
But that would mean that I'll have to have a conditional loop for every element in the list, if I understand this correctly. Is there a better way to do this?
Thanks in advance for any tips!
