Fixes incorrect index computation in .dist.2dto1d

Computation here was wrong, leading to rather odd imputation across datasets.

Assuming i > j, the index is computed by summing the number of distances in each of the first (j-1) columns, thus (n-1)+(n-2)+...(n-(j-1)) and then down a further (i-j) from there.

i.e. for i=4, j=3, n=5, we'd have 4+3+1=8.

This fixes the issue identified by M.Hazelton.