gwroblew / Quantum-Computing-Playground

Source code of quantumplayground.net.
Apache License 2.0
109 stars 59 forks source link

suboptimal QMath functions #4

Open ludopulles opened 7 years ago

ludopulles commented 7 years ago

Hey Greg,

Great simulator, but I noticed that the QMath.inverseMod function is not as fast as it could be. The current function is O(N) while there is a much faster method using the egcd. Also you could speed up the QMah.ipow method, by using the right-to-left binary method as used in the QMath.expModN function bringing down the running time from O(b) to O(log(b)).