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.
This is an attempt to facelift
Math.NumberTheory.Moduli.Jacobi
.There were two functions
jacobi
andjacobi'
, where the first one checked preconditions on arguments and the second one did not. I assumejacobi'
was supposed to be "faster", but it is unsafe to use and clutters API. I have written benchmarks and it appeared that performance of both functions is actually pretty much the same. So I've removedjacobi'
.As a part of Support Natural on the same level with Int, Word and Integer #100 I've added specialised versions of
jacobi
onNatural
.As a part of Migrate from array to vector #79 I tried to refactor
jac2
usingVector
. But, taking closer look, it appeared that the code can be clarified, eliminating any need in eitherArray
orVector
, using only simple bit tests.Elaborate comments with links to wiki and examples.