#5732: [with patch, positive review] digits,exact_log,ndigits speed overhaul
------------------------------+---------------------------------------------
Reporter: jbmohler | Owner: somebody
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.0.1
Component: basic arithmetic | Keywords:
------------------------------+---------------------------------------------
Comment(by wbhart):
I've tested the code using:
{{{
def random(n):
a = ZZ.random_element(n)
return a
def z_exact_log_test(m, n, k):
for i in range(0, m) :
a = random(n) + 2
b = random(k)
c = a^b
d = c.exact_log(a)
if b != d:
print "Error", b, "!=", d
}}}
for all sorts of values m, n, k, small large, etc. Everything passes.
The documentation is sufficient, the code reads well and appears correct.
There are doctests.
It is also fast as advertised:
{{{
def zlog(m, n, k):
for i in range(0, m/1000):
a = ZZ.random_element(n)+2
b = ZZ.random_element(k)
c = a^b
for i in range (0, 1000):
c.exact_log(a)
}}}
Old sage 4.0:
{{{
sage: time zlog(100000, 2^100, 100)
CPU times: user 23.19 s, sys: 0.19 s, total: 23.38 s
Wall time: 23.40 s
sage: time zlog(100000, 100, 100)
CPU times: user 3.46 s, sys: 0.02 s, total: 3.48 s
Wall time: 3.48 s
}}}
new times with patch:
{{{
sage: time zlog(100000, 2^100, 100)
CPU times: user 1.90 s, sys: 0.03 s, total: 1.93 s
Wall time: 1.93 s
sage: time zlog(1000000, 100, 100)
CPU times: user 0.49 s, sys: 0.06 s, total: 0.55 s
Wall time: 0.55 s
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5732#comment:4>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---