It's great that you posted it. It's a pretty significant speedup.
When I wrote up my shoddy version, I estimated using log_2 then
corrected. But you are right that there's a narrow range where even
that works.
Bill.
On 10 Apr, 11:03, "Joel B. Mohler" wrote:
> On Wednesday 08 April 2009 06:08:5
On Wednesday 08 April 2009 06:08:50 am Joel B. Mohler wrote:
> > * n.exact_log can be done faster for small bases by making careful use
> > of the identity log_m(n) = log_2(n)/log_2(m) (I wrote a crappy broken
> > python implementation and timed this - I don't know how to write it
> > properly as
>
> Missing methods:
>
> * n.euler_phi
This exists but not as n.euler_phi, in rings/arith.py, so you could
probably just put in a call to that - or move some of that code to ZZ
if it belongs there, while leaving the direct call euler_phi(7) and
plotting available? A lot of the things in rings/a
On Wed, Apr 8, 2009 at 6:29 AM, William Stein wrote:
>> * n.db (doesn't give an example)
>
> I propose removing the db method. It stands for "database", and was
> something I put in I think way before sage-1.0. I have never used it,
> and I don't know of anybody else who has, and can't imagine
> * n.db (doesn't give an example)
I propose removing the db method. It stands for "database", and was
something I put in I think way before sage-1.0. I have never used it,
and I don't know of anybody else who has, and can't imagine it even
works.
If nobody responds that they have used it, I t
On Wednesday 08 April 2009 02:17:48 am Bill Hart wrote:
> * n.bits takes much longer than n.binary(), but the latter needs to
> compute the former first!!!
This is sage types and lack of C-level optimization killing your performance.
The binary method does it's work using gmp (mpir, I guess now
2009/4/8 Bill Hart :
>
> Two more issues for ZZ:
>
> Duplicate methods:
>
> n.prime_factors and n.prime_divisors do precisely the same thing and
> have the same docstring, even down to one of the docstrings having
> examples for the wrong function.
>
Somewhere in rings/integer/pyx you see the lin
Two more issues for ZZ:
Duplicate methods:
n.prime_factors and n.prime_divisors do precisely the same thing and
have the same docstring, even down to one of the docstrings having
examples for the wrong function.
Missing methods:
n.number_of_divisors (note one does not need to compute the divis
This is David Harvey trying to write stupid code, so in ordinary
person terms that translates as pretty smart.
Bill.
On 8 Apr, 10:03, John Cremona wrote:
> Surely it would be worth testing self.gcd(m)==m early on in the
> exact_log function, i.e. that m divides self? I may be naive but I
> wou
Surely it would be worth testing self.gcd(m)==m early on in the
exact_log function, i.e. that m divides self? I may be naive but I
would implement this by testing m|a, if so dividing a by m, and
continuing. The current method describes itself as "extremely stupid
code" but it still trying to be
Here's some timings for exact_log:
In Sage:
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",
11 matches
Mail list logo