3 ms·
this inspired me to write similar code for julia. https://gist.github.com/ityonemo/2eca5fe5854ca6ef1154c896d79f5a36 https://gist.github.com/ityonemo/2eca5fe585
by dnautics 9y ago
this inspired me to write similar code for julia.
https://gist.github.com/ityonemo/2eca5fe5854ca6ef1154c896d79f5a36 https://gist.github.com/ityonemo/2eca5fe5854ca6ef1154c896d79...
One of the really nice things about the julia is (I think) that it should allow you to seamlessly use the same code to transition to finite fields by overloading the / operation.
Also, each time you build a new EC, the typesystem will JIT the A & B constants, so instead of a lookup, it's an immediate constant in the machine code.
The tradeoff with julia is that all concrete types must be leaf types, so you can't overload the standard EC point with the ideal (zero point). On the one hand, that does make your code a bit convoluted - you're effectively unrolling the type checking that python is doing behind the scenes. On the other hand, the performance implications for not having to muck around with complicated type graph traversals should be fairly obvious.
edit: indeed it's fairly easy with a trivial prime field implementation.
https://gist.github.com/ityonemo/c74ebd8a968e5fc7826762bf6a442e6a https://gist.github.com/ityonemo/c74ebd8a968e5fc7826762bf6a4...