Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Opening a PR so that I have a log of where this branch is currently at. I attempted to optimise the main Aegis run loop by removing the need to perform a spline differentiation at each particle position along its track. This takes place in a particularly hot part of the code (called for every step in the particle track of every particle) and is used to update a particle's direction vector. So some concerted effort to make this function as fast as possible would not go amiss.
However, this actually resulted in the code actually being slower than before I had made the changes. Alex suggested that perhaps this is due to the way alglib evaluates the spline at a given (R,Z) coordinate. It is entirely possible that alglib calculates the derivatives already as part of the spline evaluation in which case those derivatives are essentially free and by explicitly calling two more spline evaluations I am actually slowing down the computation of this particularly hot function.
This PR will remain parked for now in case I decide to do any more with attempting to optimise the way that the alglib functions are called.