So you have a single column of data (which is a 1D array) and you want to sum xi-xj for all j does not equal i, where i is a constant for purposes of this summation. What you need to do is bring the array into a for loop and also the value of xi. Inside the loop you add the value of xi-xj (where j is derived from the iteration value of the loop) as another element in the array if i=j is false. Otherwise you do nothing and go to the next iteration. I have included an example where I build an array inside the loop and then sum outside of the loop. You could just as easily initialize the shift register with a zero value and add the value each time, which is probably more efficient now that I think about it.
I would like to note that the
iteration starts at zero, which will correspond to the first element in an array, and the value of n is the number of times the array will execute, so that you are really going from j=0 to n-1. This shouldn't be a problem.
I hope this is of more help.
John