Performance improvement of Taylor-version TLE/SGP4 propagation by changing `FastMath.pow` to a naive power for-loop.
After some profilings, I found we can increase greatly the speed of Taylor propagation of TLE sets using SGP4 model. This is helpful in a Monte-Carlo simulation like a particle filter. I didn't test on other numerical Taylor propagators, but I GUESS the improvement will be similar. There may also be other operations that can be optimized for integers but I didn't dig into that much.
Modifications are made to org.hipparchus.analysis.differentiation.DSCompiler#taylor(double[], int, double...)
, I'm not sure if it's proper to submit an issue here since it's mainly related to TLE propagation...
* By replacing the `FastMath.pow` calling by a naive power for-loop, we can increase the speed of DSCompiler greatly.
* In my case: 6.14s --> 1.46s
*
* Specific modifications are:
* Modify `org.hipparchus.analysis.differentiation.DSCompiler#taylor(double[], int, double...)`:
* Change this (line 3316 in commit-ea873ba0df8c7a3705f251a27711ac4696aae84b):
* term *= FastMath.pow(delta[k], orders[k]) /
* CombinatoricsUtils.factorial(orders[k]);
* To:
* for (int jj = orders[k]; jj > 0; jj--) term *= delta[k];
* term /= CombinatoricsUtils.factorial(orders[k]);
Attached is an example I used to test the performance. Work_05_speedup_taylor.java