Skip to content
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

Problems with discrete_log and discrete_log_generic #32334

Closed
parablack opened this issue Aug 4, 2021 · 2 comments
Closed

Problems with discrete_log and discrete_log_generic #32334

parablack opened this issue Aug 4, 2021 · 2 comments

Comments

@parablack
Copy link

The documentation of discrete_log (in groups/generic.py) describes the possibility to use the optional identity=None, inverse=None, op=None arguments when op='other'. However, those arguments are completely ignored (i.e. not passed on to the bsgs implementation).
This results in incorrect results where discrete_log fails silently and returns 0.
Probably this issue can be fixed by passing on those optional parameters to bsgs.

Furthermore, the function discrete_log_generic claims to be an alias of discrete_log, but the way it wraps the function is incorrect. Instead of passing on the arguments it receives, it sets them to the default value, see the following snippet from the sage codebase:

def discrete_log_generic(a, base, ord=None, bounds=None, operation='*', identity=None, inverse=None, op=None):
    """
    Alias for ``discrete_log``.
    """
    return discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, inverse=None, op=None)

Correctly, this snippet should call

    return discrete_log(a, base, ord=ord, bounds=bounds, operation=operation, identity=identity, inverse=inverse, op=op

CC: @yyyyx4

Component: group theory

Keywords: discrete_log, discrete_log_generic

Issue created by migration from https://trac.sagemath.org/ticket/32334

@parablack parablack added this to the sage-9.4 milestone Aug 4, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@k3w1k0d3r
Copy link

comment:5

I didn't realize this ticket existed when I created mine, sorry. I pushed a fix.
#33900

@yyyyx4
Copy link
Member

yyyyx4 commented May 27, 2022

comment:6

Now covered by #33900.

@yyyyx4 yyyyx4 removed this from the sage-9.7 milestone May 27, 2022
@mkoeppe mkoeppe closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants