Re: Prime numbers
- From: Phil Carmody <thefatphil_demunged@xxxxxxxxxxx>
- Date: 11 Jul 2006 11:09:14 +0300
"Pubkeybreaker" <Robert_silverman@xxxxxxxxxxxx> writes:
Phil Carmody wrote:
"Pubkeybreaker" <Robert_silverman@xxxxxxxxxxxx> writes:
50% of my cyclotomic sieve is spent in a Cantor Zassenhaus
routine. I remember you saying that CZ was the bee's knees
for similar situations in the past, but my implementation
must truly suck. I wrote it many years ago, and it would
take a while to even work out what I was doing again, so
perhaps an entirely new approach, purloined from a hotshot
coder like yourself, might be better :-)
If you send your snail maill address, I could send some CZ code
for 32-bit numbers. It would not be a lot of work to modify it for
64-bits on a platform that can handle 64-bit ints.
Snail mail as in Ristiaallokonkatu 4 F 131, Espoo 02320, Finland?
And if you are working mod k*2^n + 1, the modular reductions
can be made very fast.
The technique I use has fixed-time modular reductions, no matter
what the form. I'm using the fairly common 'x as an integer,
1/p as a float' technique.
xy%p ~= lowbits(x*y) - lowbits(int(x'*y'*1/p')*p)
where the "'" operands are FP.
Slows down when FP<->Int conversions are slow (e.g. PPC), but
otherwise makes good use of both int and FP cores.
You get different behaviour depending on how int() works (which
is not always a C cast, so it depends on the FPU rounding mode) -
But often {-p/2, +p/2} is prefered over {0, p-1} .
I'll have a look at my code today, tidy it up a bit perhaps,
make a minor optimisation which I've spotted is possible,
and put it on the table; perhaps I've missed something.
I don't think the maths primitives can be made much faster
without hitting asm, so perhaps it's my loop termination/repetition
conditions that are screwed, and I'm doing too much unnecessary
work.
Here's hoping I have no 'real' work to do today...
Thanks,
Phil
--
The man who is always worrying about whether or not his soul would be
damned generally has a soul that isn't worth a damn.
-- Oliver Wendell Holmes, Sr. (1809-1894), American physician and writer
.
- References:
- Prime numbers
- From: prime-numb
- Re: Prime numbers
- From: Pubkeybreaker
- Re: Prime numbers
- From: Phil Carmody
- Re: Prime numbers
- From: Pubkeybreaker
- Re: Prime numbers
- From: Phil Carmody
- Re: Prime numbers
- From: Pubkeybreaker
- Prime numbers
- Prev by Date: Re: An uncountable countable set
- Next by Date: Relations and Species of Structures
- Previous by thread: Re: Prime numbers
- Next by thread: Re: Prime numbers
- Index(es):
Relevant Pages
|