![]() |
|
|
#23 | |
|
Sep 2016
22×5×19 Posts |
Quote:
In the normal (real number) modular space, you will not find any 32-bit primes that have both roots-of-unity and roots-of-two of sufficient depth. (I've tested every single prime below 2^32 and found none with both roots-of-unity and roots-of-two of useful depth.) From that experiment, I hypothesize that the greatest depth you can get seems to be about O(sqrt(N)) where N is the size of the ring. This is actually somewhat expected if you assume that there is no correlation between primes with deep roots-of-unit and primes with deep roots-of-two. In the real number modular space, N = p - 1. This limits your transform length to about 2^16 for 32-bit primes which is useless. I don't remember what the result of my test was, but I think 2^14 was the best you could do. Alternative 1: 64-bit Primes Going to 64-bit primes will let you do transform lengths of around 2^32. But I don't know of a systematic way to search for them. The only search I've done to date is to brute-force all primes of the form p = m * 2^32 + 1 and found only 5 that also had roots-of-two of depth 2^28 or more. (This took around 24 hours on a 4-core Skylake using Mathematica.) Unfortunately, those 5 are not that useful. They're all greater than 2^63 so you can't efficiently use Shoup's mulmod algorithm. If someone were to pursue this step, they'd have to broaden the search to p = m * 2^28 + 1 (or even smaller than 2^28) to hopefully find several of them with similar depth in quadratic residuals. In any case, using 63-bit primes is going to be slow for reasons mentioned in earlier posts. Alternative 2: Gaussian Primes If we go into the Gaussian space (complex mod arithmetic), the ring size increases to N = p^2 - 1. This means that for a Gaussian prime of size about 2^32, we can expect to find some with both roots-of-unity and roots-of-two on the order of 2^32. 2^32 is enough to cover the current range of LL sizes. It's easy to find a primitive root to get a generator for a deep root-of-unity. But I'm not sure how to find quadratic residuals. Ernst says they exist in sufficient depth for Mersenne primes, but I don't know how to actually find them. (At least I haven't tried very hard and Mathematica doesn't seem to have a quadratic residual function for Gaussian integers.) |
|
|
|
|
|
|
#24 |
|
Tribal Bullet
Oct 2004
5·23·31 Posts |
I'm not completely sure, but the use of Gaussian integers for arithmetic mod p^2 for p=M61 should just be a shorthand for dealing with integers modulo p^2. So maybe you can find square roots modulo p^2 by means of computing the square root mod p and then one step of Hensel lifting, and then make the top 61 bits the real and the bottom 61 bits the imaginary part of a Gaussian integer.
|
|
|
|
|
|
#25 | |
|
Einyen
Dec 2003
Denmark
22·863 Posts |
Quote:
Ordp2 = 12862306576 . So 2^12862306576 = 1 (mod p). But what do you mean with deep roots-of-unity ? I assume you mean: Root of unity modulo n So x^k = 1 (mod p) again but this time x!=2. So does "deep" mean k is large again? or is x large? Last fiddled with by ATH on 2017-10-10 at 05:58 |
|
|
|
|
|
|
#26 | |
|
Sep 2016
5748 Posts |
Quote:
The roots-of-unity that are needed for the twiddle factors. Whereas the roots-of-two are needed for the weights for the IBDWT. So yes, by "depth", I mean a very large k. Code:
p = 2411682483*2^32 + 1 = 10358097392821075969 // Root-of-Unity of depth k = 32 6176428888740961571^(2^31) ≡ -1 mod p 6176428888740961571^(2^32) ≡ 1 mod p // Root-of-Two of depth k = 28 36411718325718249^(2^28) ≡ 2 mod p Last fiddled with by Mysticial on 2017-10-10 at 06:32 |
|
|
|
|
|
|
#27 | ||
|
∂2ω=0
Sep 2002
República de California
267548 Posts |
Just some brief comments, very busy with my own code, but did spend some quality time over the weekend revisiting some basic issues related to finding primitive roots of maximal order (i.e. order q^2-1, where q = 2^p-1) for FGTs modulo various M-primes. For p=31, it appears the primitive root of form (by analogy to the convenient one for p=61) n+I having the smallest n is 12+I. Power-of-2 DFTs can take advantage that roots of power-of-2 orders have convenient special form: square roots = +1,-1, 4th roots = +1,+I,-1,-I, and 8th roots = w^j (j=0,...,7) with w = (1+I)*2^(p-1).
Quote:
For FGT over M31 we gain 15.5 BPW, so again using a !M FFT @19 BPW as the floating-point baseline: FFT+FGT(M61): (19+30.5) BPW, 2.6x more than FFT alone; FFT+FGT(M31): (19+15.5) BPW, 1.8x more than FFT alone, I.e. using M61 gains ~1.5x the BPW of M31, while roughly doubling the modular-arithmetic workload. Quote:
|
||
|
|
|
|
|
#28 | ||
|
Sep 2016
22×5×19 Posts |
Quote:
I'm not sure exactly how much safety is needed since I don't have an implementation to test empirically. Quote:
------- I noticed another error in my M31 NTT pseudo-code. I left off the reductions needed for the multiply-mods. Fixing that increases the cost to:
But it's still cheaper than DD FFT at this point. |
||
|
|
|
|
|
#29 | |
|
Einyen
Dec 2003
Denmark
65748 Posts |
Quote:
For each square root there are 2 solutions r1 and r2=p-r1, so after 28 square roots there are possibly 2^28 different deep roots. Will all these different roots always exist to the same "depth" or do you have to search them all? I assume the depth is the same because I just tested your root-of-two with a recursive function, and that was the case. Last fiddled with by ATH on 2017-10-11 at 03:07 |
|
|
|
|
|
|
#30 | |
|
Sep 2016
22·5·19 Posts |
Quote:
Which brings up a new point that I hadn't realized before. If there exists a root-of-two of depth k, then there must also exist a root-of-unity of depth k. This means that for a given prime number p, the depth of the quadratic residuals can never exceed the depth of roots-of-unity. This should also apply to all bases instead of just base 2. ------ EDIT: I'm not so sure actually. I don't see a requirement that a prime with a root-of-two of depth k has 2^k distinct roots-of-two. And if such a prime exists, then its root-of-unity depth will be less than the root-of-two depth. Last fiddled with by Mysticial on 2017-10-11 at 04:36 |
|
|
|
|
|
|
#31 |
|
Einyen
Dec 2003
Denmark
22×863 Posts |
But the important thing is that the maximum "depth" is the same for all of them? You do not have to search the entire "tree" to find one with highest depth?
|
|
|
|
|
|
#32 | |
|
Sep 2016
22×5×19 Posts |
Quote:
![]() The reason why I think the answer is yes is because once you find any root-of-two (R) of depth (say 2^28), you will automatically be able to generate the remaining (2^28-1) others of the same depth by multiplying them by roots-of-unity. (assuming those exist at the same depth) These 2^28 roots-of-two must also be unique. Since p is prime and a multiplicative inverse always exists, you will be able to divide them by R to re-obtain the roots-of-unity. So those 2^28 roots-of-two of depth k=28 will need to be the leaf nodes of the binary "tree" that you're talking about. Therefore, the tree must be completely balanced down to that point. So walking the tree down any path will guarantee that you reach a leaf node holding a root-of-two of depth k=28. |
|
|
|
|
|
|
#33 | |
|
"Robert Gerbicz"
Oct 2005
Hungary
66916 Posts |
Quote:
Code:
depth=28;x=188393705187326142;p=569381225639182337; depth=29;x=1393396111665502800;p=4588742434128658433; |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Double stars | fivemack | Astronomy | 5 | 2017-05-14 08:50 |
| x.265 half the size, double the computation; so if you double again? 1/4th? | jasong | jasong | 7 | 2015-08-17 10:56 |
| Double Check | Unregistered | Information & Answers | 3 | 2011-10-01 04:38 |
| Double the area, Double the volume. | Uncwilly | Puzzles | 8 | 2006-07-03 16:02 |
| Double Check P-1 | PhilF | PrimeNet | 6 | 2005-07-03 14:36 |