fix: Eisenstein Half-GCD convergence#680
Conversation
…ounding and hex-lattice optimization
There was a problem hiding this comment.
Looks good to me - maybe we could get rid of the conditional "best-norm remainder" loop and do it always?
Otherwise - if there is good reason not to do it, then I'm good to merge it. I also added unit test for quorem. I wasn't able to come up with a regression test quickly though for inputs where the remainder norm would be bigger than the divisor - do you have a test-case by any chance? Its fine if not.
Hey one example of (slow/infinite) convergence input for half gcd was (from halfgcd hint with (order - 2) as scalar for secpk1) : Regarding the while loop, I think I agree, it does seem one pass through all neighbours is enough the make the norm smaller and we could replace it with a Regarding passing through all neighbors each time, i think the initial guess will be correct most of the time and therefore it's a small optimization to not do it - but i didn't benchmarked it. |
|
I benchmarked locally quickly - when we always find the smallest neighbour in the QuoRem. I guess lets stay with only finding smallest neighbour in case the norm is big (i.e. what you have right now). I only changed from |
ivokub
left a comment
There was a problem hiding this comment.
Thanks for the fix. Looks good!
Co-authored-by: Ivo Kubjas <ivo.kubjas@consensys.net>
Co-authored-by: Ivo Kubjas <ivo.kubjas@consensys.net>
No description provided.