|
|
@ -23,8 +23,9 @@ def fft_next_good_size(n): |
|
|
|
smallest composite of 2, 3, 5, 7, 11 that is >= n |
|
|
|
smallest composite of 2, 3, 5, 7, 11 that is >= n |
|
|
|
inspired by pocketfft |
|
|
|
inspired by pocketfft |
|
|
|
""" |
|
|
|
""" |
|
|
|
if n <= 6: return n |
|
|
|
if n <= 6: |
|
|
|
best = 2 * n; f2 = 1 |
|
|
|
return n |
|
|
|
|
|
|
|
best, f2 = 2 * n, 1 |
|
|
|
while f2 < best: |
|
|
|
while f2 < best: |
|
|
|
f23 = f2 |
|
|
|
f23 = f2 |
|
|
|
while f23 < best: |
|
|
|
while f23 < best: |
|
|
@ -34,7 +35,8 @@ def fft_next_good_size(n): |
|
|
|
while f2357 < best: |
|
|
|
while f2357 < best: |
|
|
|
f235711 = f2357 |
|
|
|
f235711 = f2357 |
|
|
|
while f235711 < best: |
|
|
|
while f235711 < best: |
|
|
|
best = f235711 if f235711 >= n else best; f235711 *= 11 |
|
|
|
best = f235711 if f235711 >= n else best |
|
|
|
|
|
|
|
f235711 *= 11 |
|
|
|
f2357 *= 7 |
|
|
|
f2357 *= 7 |
|
|
|
f235 *= 5 |
|
|
|
f235 *= 5 |
|
|
|
f23 *= 3 |
|
|
|
f23 *= 3 |
|
|
|