This is an attempt to facelift Math.NumberTheory.Moduli.Jacobi.
There were two functions jacobi and jacobi', where the first one checked preconditions on arguments and the second one did not. I assume jacobi' 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 removed jacobi'.
As a part of #100 I've added specialised versions of jacobi on Natural.
As a part of #79 I tried to refactor jac2 using Vector. But, taking closer look, it appeared that the code can be clarified, eliminating any need in either Array or Vector, using only simple bit tests.
Elaborate comments with links to wiki and examples.
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 #100 I've added specialised versions of
jacobi
onNatural
.As a part of #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.