[sage-devel] Re: Unbelievably trivial

2007-10-16 Thread Robert Bradshaw
On Oct 16, 2007, at 10:25 AM, John Voight wrote: > > Hi Robert, > > I can't seem to get primessq to be defined as a cdef long*. I've > tried > cdef long primessq[46] = [...] > cdef long *primessq = [...] > etc. and they always give errors. This is because [...] creates a python list, which

[sage-devel] Re: Unbelievably trivial

2007-10-16 Thread John Voight
Hi Robert, I can't seem to get primessq to be defined as a cdef long*. I've tried cdef long primessq[46] = [...] cdef long *primessq = [...] etc. and they always give errors. Cython doesn't allow you to use macros (#define) I guess? JV --~--~-~--~~~---~--~

[sage-devel] Re: Unbelievably trivial

2007-10-10 Thread Robert Bradshaw
OK, that makes much more sense. On Oct 10, 2007, at 1:05 PM, William Stein wrote: > On 10/10/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: >> >> Only 20% compared to base-10 strings? It seems like there should be >> more gain than that. Or was it doing something different before? > > pari --> s

[sage-devel] Re: Unbelievably trivial

2007-10-10 Thread David Harvey
I filed a related ticket a few month ago: http://sagetrac.org/sage_trac/ticket/467 david On Oct 10, 2007, at 4:05 PM, William Stein wrote: > > On 10/10/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: >> >> Only 20% compared to base-10 strings? It seems like there should be >> more gain than tha

[sage-devel] Re: Unbelievably trivial

2007-10-10 Thread William Stein
On 10/10/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > Only 20% compared to base-10 strings? It seems like there should be > more gain than that. Or was it doing something different before? pari --> sage hasn't been base-10 strings for years. Gonzalo wrote optimized code for this in Feb 2006

[sage-devel] Re: Unbelievably trivial

2007-10-10 Thread Robert Bradshaw
Only 20% compared to base-10 strings? It seems like there should be more gain than that. Or was it doing something different before? - Robert On Oct 10, 2007, at 10:51 AM, Craig Citro wrote: > I have a patch to fix that just about ready to go out the door, > actually. If you want, I could s

[sage-devel] Re: Unbelievably trivial

2007-10-10 Thread Craig Citro
I have a patch to fix that just about ready to go out the door, actually. If you want, I could send it to you and see if it makes your life easier. The pari->sage speedup is only about 20% (which I'd like to improve), but the sage->pari is a 5-6X speedup, and gets better with the length of the inte

[sage-devel] Re: Unbelievably trivial

2007-10-10 Thread John Voight
Beautiful, thanks! No my unbelievably trivial problem can be solved extremely fast. There appears to be something else which is inexplicably eating up time now--maybe coercion between PARI and SAGE integers in other places... JV --~--~-~--~~~---~--~~ To post to

[sage-devel] Re: Unbelievably trivial

2007-10-09 Thread Robert Bradshaw
I don't know of any algorithms to find the radical of an integer quickly (indeed I believe there aren't any) but here are some ideas I have. First, if you're dabbling in cython, try making your primessq into a cdef long*. This should speed things up significantly. If your calling from oth

[sage-devel] Re: Unbelievably trivial

2007-10-09 Thread cwitty
On Oct 9, 10:22 pm, John Voight <[EMAIL PROTECTED]> wrote: > Hello all: > > I was hoping you could help me with this unbelievably trivial problem. > > Fix an integer B of size about 10 decimal digits, so too big to be an > unsigned long int but not much bigger. > > PROBLEM: Given an integer d of s

[sage-devel] Re: Unbelievably trivial

2007-10-09 Thread John Voight
I decided on something like this: - cimport sage.rings.integer primessq = [4, 9, 25, 49, 121, 169, 289, 361, 529, 841, 961, 1369, 1681, 1849, 2209, 2809, 3481, 3721, 4489, 5041, 5329, 6241, 6889, 7921, 9409] len_primes = 25 def int_has_small_square_divisor(sage.rings.integer.In