#5112: [with patch, needs work] generic Pollard lambda algorithm
-------------------------+--------------------------------------------------
Reporter: ylchapuy | Owner: tbd
Type: enhancement | Status: new
Priority: minor | Milestone: sage-3.3
Component: algebra | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Changes (by was):
* summary: [with patch, with positive review] generic Pollard lambda
algorithm => [with patch, needs work] generic
Pollard lambda algorithm
Comment:
SECOND REVIEW:
* Line 1 of docstring: "Pollard Lambda algorithm for computing discrete
logarithm."
It should be "Pollard Lambda algorithm for computing discrete logarithms."
or "Pollard Lambda algorithm for computing the discrete logarithm."
* The docstring has a typo in line 2: "usefull"
* The sections in the docstring should have space between them (e.g., a
blank line before EXAMPLES:). This can be ignored because of the
ReST/Sphinx transition, which will probably change that.
* I noticed this line
{{{
N = width.isqrt()+1
}}}
If width is a Python int then that will fail. This is easy to trigger and
will accidentally happen in library code easily:
{{{
sage: F.<a> = GF(2^63)
sage: g = F.gen()
sage: pollard_lambda(g, g^1234567, (1200000,1250000))
1234567
sage: pollard_lambda(g, g^1234567, (int(1200000), int(1250000)))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
/space/wstein/sage-3.3.rc0/<ipython console> in <module>()
/space/wstein/sage-3.3.rc0/local/lib/python2.5/site-
packages/sage/groups/generic.pyc in pollard_lambda(base, a, bounds, ord,
operation, hash_function, memory)
649
650 width = ub-lb
--> 651 N = width.isqrt()+1
652
653 M = dict()
AttributeError: 'int' object has no attribute 'isqrt'
}}}
* the doctests are insufficient. The function signature is
{{{
def pollard_lambda(base, a, bounds, ord=None, operation='*',
hash_function=hash, memory=None):
}}}
At a bare minimum, there must be doctests that test use of all the inputs
to the function.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5112#comment:9>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---