![]() |
![]() |
#1 |
Oct 2012
1228 Posts |
![]()
I finally got my MPQS code working, it's much faster than my QS implementation, but it's still pretty slow once the numbers get up to around 70 digits.
I have experimented with smaller blocks which can fit into the CPU cache, as well as one large block, and many large blocks, I've found for my implementation using one large sieve array of around 500k values gives the best performance. I've profiled my code and the bottleneck is calculating the modular inverse of A mod each prime in the factor base. I'm using the GMP library's mpz_invert function, would I have any chance of writing a faster function myself? Are there any optimisations to limit the number of times mpz_invert() is called? (I know SIQS would be one of them, but the MPQS is about as far as I want to go.) Or is there a way of quickly calculating the inverse? Thank You ![]() |
![]() |
![]() |
![]() |
#2 |
P90 years forever!
Aug 2002
Yeehaw, FL
41·193 Posts |
![]()
You can try doing fewer modular inverses.
It is easy to calculate 1/a and 1/b with one modular inversion of a*b. |
![]() |
![]() |
![]() |
#3 |
(loop (#_fork))
Feb 2006
Cambridge, England
33·239 Posts |
![]()
I expect you will be able to write a faster function yourself because the primes in the factor base are small so you can do everything in 64-bit integers whilst mpz_invert is using bignums.
|
![]() |
![]() |
![]() |
#4 |
Tribal Bullet
Oct 2004
1101110110012 Posts |
![]()
The slowness of modular inversion is the reason the fastest QS variant is the self-initializing quadratic sieve; in that case the cost of computing modular inverses is amortized over many changes of polynomial.
|
![]() |
![]() |
![]() |
#5 |
Oct 2012
2·41 Posts |
![]()
Would the extended Euclidean algorithm suffice? Or would I have to use something more advanced?
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
The bandwidth bottleneck is apparently much older than I thought | Dubslow | Hardware | 5 | 2017-11-16 19:50 |
How to do big integer inversion/division with middle product, power series? | R. Gerbicz | Math | 1 | 2015-02-10 10:56 |
Matrix Inversion Paper | flouran | Math | 2 | 2009-05-24 03:15 |
Modular Arithmetic | Numbers | Math | 27 | 2005-11-30 15:41 |
Opteron Bottleneck?? | Prime95 | Hardware | 31 | 2003-09-17 06:54 |