-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
small enhancements to generic discrete logs #33900
Comments
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:8
Thanks for the contribution! One first comment: The |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:11
Thanks. Some more comments:
mult = op if op is not None else [add, mul][operation in multiplication_names]
power = [mul, pow][operation in multiplication_names]
if(op is not None):
power = lambda x, y: multiple(x, y, operation=operation, identity=identity, inverse=inverse, op=op)
if ord is None:
if operation in multiplication_names:
mult = mul
power = pow
try:
ord = base.multiplicative_order()
except Exception:
ord = base.order()
elif operation in addition_names:
mult = add
power = mul is weird. First, it should probably throw an error if
+ - ``op()`` - function of 2 arguments ``x``, ``y`` returning ``x*y`` in group |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:13
Replying to @yyyyx4:
thanks |
comment:15
I didn't think sagemath/sagetrac-mirror@f2cc977 through very well and the tests didn't detect my mistake, I've now undone that change. |
comment:16
is it looking better now? |
comment:17
is there any update on this? |
comment:18
Sorry for the long silence. What's still missing are tests for the new Once that's done, I think this can be merged — while there are still plenty of things I would change in that file, it's certainly better than before. |
Reviewer: Lorenz Panny |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:50
finally got the last bug I've noticed out. |
comment:51
Looks good, thank you for all the work. Now we just need to avoid the doctest failures when --- a/src/sage/groups/generic.py
+++ b/src/sage/groups/generic.py
@@ -851,9 +851,14 @@ def discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, i
....: hi = randrange(sol+1, 2*order)
....: assert lo <= sol <= hi
....: kwargs['bounds'] = (lo, hi)
- sage: res = discrete_log(*args, **kwargs)
- sage: res == sol
- True
+ sage: try:
+ ....: res = discrete_log(*args, **kwargs)
+ ....: except ValueError:
+ ....: # lambda can fail randomly
+ ....: if kwargs['algorithm'] != 'lambda':
+ ....: raise
+ ....: else:
+ ....: assert res == sol
AUTHORS:
You may also want to consider adding yourself to the list of authors for the |
comment:52
thanks. is there any reason to leave lambda in the random tests if we don't actually check if it worked? |
comment:53
We still check |
comment:55
thank you! |
Changed branch from u/gh-k3w1k0d3r/better_discrete_log to |
Previously, the generic discrete log function wouldn't ever use Pollard's rho. From what I can tell, no generic Pohlig-Hellman implementation existed which used Pollard's rho.
Additionally, discrete log functions did not seem to properly use the custom operation arguments.
CC: @yyyyx4
Component: group theory
Keywords: discrete, logarithm, group theory, generic
Author: Julien Grijalva
Branch/Commit:
63684ec
Reviewer: Lorenz Panny
Issue created by migration from https://trac.sagemath.org/ticket/33900
The text was updated successfully, but these errors were encountered: