Complex FFT is not as bad as you think ... Probably.
Hi everyone!
As some of you _might_ already know, I don't like NTT. Primary reasons for this are:
- I don't like modular arithmetic optimizations (Montgomery, etc).
- I don't like NTT mods, and prefer good, old $10^9+7$.
- I do like algebra of complex numbers.
But, to my regret, the overwhelming mainstream in modern competitive programming is NTT. Primary reasons are:
- It's allegedly faster.
- It needs less memory.
- It has no precision issues.
- People don't like algebra of complex numbers.
There is nothing I can do about the last, but today I'll address the first 3. Optimizing complex FFT was on my mind for quite some time, but I didn't really work on it _that much_ until the [blog](https://codeforces.me/blog/entry/142063) by [user:Qwerty1232,2025-04-24] on optimizing NTT has dropped, which motivated me to actually put some serious effort into this.
In this blog, we will primarily focus on optimizations that are specific to complex arithmetic...
The first practical limitation we encounter is, if we use `double` type for
our computations, it, manner for large $k$, we assume that the practical effect of doing this would
be quite similar to, But there is still another practical observation, that would also allow us to
explain the factor of, From practical perspective, I tried a bunch of various testing strategies, but
in all cases the, In my practical experiments, generally speaking, FFT itself seems to be very
efficient, so it only, The first practical limitation we encounter is, if we use `double` type for our
computations, it
Full text and comments »