On 19 June 2015 at 16:20, Scott Jones <[email protected]> wrote:
> Not being an astronomer, I don't know how this is supposed to be, but you > have calculations based on the bod array inside the loop, but you are never > updating bod... Are you just depending on the compiler to move those out > of the loop? > Oh, the program is not complete. In a real program the "bod" array would be updated elsewhere. Updating the bod requires O(n) additions, multiplications and memory look-ups. Computing the forces on each particle requires O(n^2) additions, multiplications, divisions and memory look-ups. So all attempts at optimization focus on the O(n^2) part, so that's the only part that I posted. Cheers, Daniel
