Improve FFT twiddle factor precisions using Python SymPy.

Python math, numpy, scipy produce values with significant rounding errors.
This commit is contained in:
Jared Boone 2016-01-03 21:02:44 -08:00
parent 963b6e257a
commit 5547782f5a

View File

@ -114,14 +114,14 @@ void fft_c_preswapped(std::array<T, N>& data) {
constexpr size_t K_max = 8;
static_assert(K <= K_max, "No FFT twiddle factors for K > 8");
static constexpr std::array<std::complex<float>, K_max> wp_table { {
{ -2.00000000000000000000000000000000f, 0.00000000000000000000000000000000f },
{ -1.00000000000000000000000000000000f, -1.00000000000000000000000000000000f },
{ -0.29289321881345242726268907063059f, -0.70710678118654746171500846685376f },
{ -0.07612046748871323376128827931097f, -0.38268343236508978177923268049199f },
{ -0.01921471959676954860407604996908f, -0.19509032201612824808378832130984f },
{ -0.00481527332780311376897453001789f, -0.09801714032956060362877792613290f },
{ -0.00120454379482760713659939000308f, -0.04906767432741801493456534899451f },
{ -0.00030118130379577984830768988544f, -0.02454122852291228812360301958506f },
{ -2.0f, 0.0f },
{ -1.0f, -1.0f },
{ -0.2928932188134524756f, -0.7071067811865475244f },
{ -0.076120467488713243872f, -0.38268343236508977173f },
{ -0.019214719596769550874f, -0.19509032201612826785f },
{ -0.0048152733278031137552f, -0.098017140329560601994f },
{ -0.0012045437948276072852f, -0.049067674327418014255f },
{ -0.00030118130379577988423f, -0.024541228522912288032f },
} };
/* Provide data to this function, pre-swapped. */