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.
As mentioned in issue #12, the calculations suddenly get very bad for ell>29. I also noticed that the errors are growing exponentially from low ell, for certain rotations. I've replaced the key (alternating) sum with what should be a much stabler algorithm. The basic idea is that you can rewrite any rotation as the product of two rotations for which that alternating sum has a special form. In this case, the magnitudes of the R.a and R.b components are equal for each of the two rotations. We can evaluate the sums exactly offline, and store them for retrieval when needed (as the new
Delta
function).I can still use Horner form for fast and accurate evaluations. In fact, I even managed to fold that loop onto itself, saving ~1/2 the iterations, by using a symmetry of the Delta.
These changes make the evaluation substantially slower (~20% slower for ell=8), but far more accurate. In particular, I've been able to tighten the tolerances on the tests, so that errors of roughly 2*ell times machine precision are expected.