Improve flint performance with multivariate polyratfun#838
Open
jodavies wants to merge 2 commits into
Open
Conversation
These changes are worth ~2% in scripts which make heavy use of polynomial arithmetic.
This means we can rely on the sorted result from FLINT to be in the required order, so we can avoid the unnecessary additional sort into FORM order after computation. The result is also more consistent, in that the denominator always has a positive leading coefficient in the final result, which was not the case previously. Introduce "On OldPRFSign;" switch to force the old ordering, in case the user requires this for any reason.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The first commit improves a few hotspots in the flint interface.
The second uses FORM's symbol ordering for polyratfun operations, instead of sorting the variables by degree, which the poly class does. This means we can avoid sorting flint's result, since it is already sorted correctly. This leads to large improvements in multivariate polyratfun benchmarks. Speedup w.r.t master:
(These are updated ibp benchmarks in the style of "mbox1l", which are not yet merged into form-bench. They have coefficients which are rational polys in 3, 5, 6, 2 variables respectively.).
The caveat is that the signs of the numerator and denominator may change in some cases w.r.t the old behaviour. I would argue that the new behaviour is more consistent, but nonetheless the second commit also adds
On OldPRFSign;in case the user really needs output which agrees exactly with the old behaviour.