#5098: [with patch, with positive review, doctest fix needs work] Pollard rho
algorithm for generic discrete logarithm
-------------------------+--------------------------------------------------
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, doctest fix needs review]
Pollard rho algorithm for generic discrete
logarithm => [with patch, with positive review,
doctest fix needs work] Pollard rho algorithm
for generic discrete logarithm
Comment:
I have some issues with trac-5098-doctest.patch:
1. There should be a doctest that illustrates every single exception that
can be raised. For example this patch adds
{{{
raise NotImplementedError, "The current implementation of Pollard Rho
algorithm needs to have (a multiple of) the order of the base"
}}}
on line 543, but there is no doctest that illustrates this.
2. Line 758, The %s"%base business is bad.
{{{
raise NotImplementedError, "we currently need to know the order of the
base %s"%(base) }}}
I used to write a lot of exceptions like this, since for Magma we did
that. But in Magma, they aren't exceptions that can be caught -- any
single exception stops the program. In Sage, exceptions can be caught and
occur as part of the normal flow of execution of a program. Once in 2006
there was a simple calculation David Harvey was doing, and he was very
confused because it was taking several minutes to do something trivial.
It turned out this was because in the course of the computation an
exception was raised and caught (e.g., because of some coercion model
stuff), and the exception was written like the one before -- it was a
string that printed the element involved in the coercion, and the str(...)
conversion of the element took *minutes*. That was what dominated the
calculation. As a result I realized that I had completely messed up in
using that pattern for implementing exceptions in Sage, and had to go
through the whole codebase and rewrite all such exceptions.
Just to hammer this home, consider
{{{
sage: a = Mod(16, 100); b = Mod(-4,10^10^7)
sage: try: w = sage.groups.generic.discrete_log(a,b)
except: pass
[hang forever!]
}}}
and if it ever did come back, imagine what that exception would look like!
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5098#comment:24>
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
-~----------~----~----~----~------~----~------~--~---