1#include "..\include\math\fft.h"
10 int it, m, is, i, j, nv;
11 double q, s, poddr, poddi;
12 for(it = 0; it < n; ++it) {
15 for (i = 0; i < k; ++i) {
17 is = is << 1 + (m - j << 1);
23 std::vector<NAFLOAT> pm(n);
24 std::memcpy(&pm[0], p, n *
sizeof(NAFLOAT));
25 std::vector<NAFLOAT> pt(n,0.0);
26 double temp =
NA_2PI /
static_cast<NAFLOAT
>(n);
29 pm[1] = std::cos(temp);
30 pt[1] = -std::sin(temp);
31 for (i = 2; i < n - 1; ++i) {
32 temp = pm[i - 1] * pm[1];
33 q = pt[i - 1] * pt[i];
34 s = (pm[i - 1] + pt[i - 1]) * (pm[1] + pt[1]);
40 for (i = k - 2; i >= 0; --i) {
43 for (it = 0; it <= (m - 1) * nv; it += nv) {
44 for (j = 0; j < (nv >> 1); ++j) {
45 temp = pm[m * j] * f[it + j + nv >> 1].re;
46 q = pt[m * j] * f[it + j + nv >> 1].im;
47 s = pm[m * j] + pt[m * j];
48 s *= (f[it + j + nv >> 1].re+ f[it + j + nv >> 1].im);
51 f[it + j + nv >> 1].re = f[it + j].re - poddr;
52 f[it + j + nv >> 1].im = f[it + j].im - poddi;
53 f[it + j].re += poddr;
54 f[it + j].im += poddi;
void NA_API fft(NAFLOAT *p, Complex< NAFLOAT > *f, int n, int k)
实现快速傅里叶变换