-4

I have a 2D array of size [3000,3] and I have to find Euclidean Distances between the 3000 values in first dimension 3 times (second dimension). What I am doing now is makin a nested for loop, I looked for ways of making it faster, but the only think I found was setting up a structure as here.

Perhaps doing 3 for loops is faster than doing a nested loop. Does anyone know how the processing time goes in this case?

Community
  • 1
  • 1

1 Answers1

3

It won't matter at all whether you run a loop three times via nested-loop or via separate loops, as long as the amount of iterations are the same.

If you can improve your algorithm, so that you need fewer iterations (fewer than 3000 x 3), that might get you somewhere.

rory.ap
  • 34,009
  • 10
  • 83
  • 174
Andreas Vogl
  • 1,776
  • 1
  • 14
  • 18