I have a list of points that sit on a cubic lattice, where each coordinate is always composed of positive integers.
I need to find the set of vectors that that can be taken from any point to any other point, which means I need both the forward and backwards vectors.
Currently I do this exhaustively by looping through the list of coordinates and performing
$(x_n-x_m, y_n-y_m, z_n-z_m)$
for $n,m \in \{\text{coordinate list}\}$, which obviously scales as $\mathcal{O}(n^2)$, but is also massively wasteful. For example, a sphere composed of 17,256 points on this cubic lattice generates 297,769,536 vectors, but only 135,355 are unique.
Is there a faster method of finding these vectors? My PI suggested it might be possible using FFT's due to the lattice nature of the problem, but didn't have any papers/books to point in the right direction for an algorithm.
I did look at this question, however this seems to focus on finding the bounds, not the vectors themselves