I'm currently working on some discrete vortex algorithm, and the main time consuming part can be sumed up by these few lines :
This involves the computation of a distance matrix, which is symmetric, so theoretically it should be possible to reduce the computation time of the z-z.' part.
I tried to use :
- matlab dist and pdist builtin functions
- custom (for i=1:n, for j=i+1:n) loops to avoid computing symmetric terms.
- some mathworks file exchange functions, such as this one
Unfortunately, no one is faster than the brute force original one. Probably because it is using the full potential of vectorization. I precise that I don't need to compute it for thousands and thousands of points (5000 maximum), so I'm not limited or slowed down by huge memory transfer.
However I need to loop that process millions of time, and speeding it up a little would save me hours.
Any suggestion would be more than welcomed.