1
다음 알고리즘은 무엇입니까?1D 고속 푸리에 변환
어떤 I는 다음의 소스 코드에서 이해하기이다 :
dir
은 FFT의 방향 : 순방향 = 1, 역 = -1.x
는y
여기m
무엇 허수
입니다 실수 부?
x
= {1,1,1,0,0,0,0} 및 y
= {000000000} 인 경우, m
의 값은 무엇입니까?
//Inplace 1D FFT
public static void FFT1D(int dir, int m, ref double[] x, ref double[] y)
{
long nn, i, i1, j, k, i2, l, l1, l2;
double c1, c2, tx, ty, t1, t2, u1, u2, z;
/* Calculate the number of points */
nn = 1;
for (i = 0; i < m; i++)
nn *= 2;
/* Do the bit reversal */
i2 = nn >> 1;
j = 0;
for (i = 0; i < nn - 1; i++)
{
if (i < j)
{
tx = x[i];
ty = y[i];
x[i] = x[j];
y[i] = y[j];
x[j] = tx;
y[j] = ty;
}
k = i2;
while (k <= j)
{
j -= k;
k >>= 1;
}
j += k;
}
/* Compute the FFT */
c1 = -1.0;
c2 = 0.0;
l2 = 1;
for (l = 0; l < m; l++)
{
l1 = l2;
l2 <<= 1;
u1 = 1.0;
u2 = 0.0;
for (j = 0; j < l1; j++)
{
for (i = j; i < nn; i += l2)
{
i1 = i + l1;
t1 = u1 * x[i1] - u2 * y[i1];
t2 = u1 * y[i1] + u2 * x[i1];
x[i1] = x[i] - t1;
y[i1] = y[i] - t2;
x[i] += t1;
y[i] += t2;
}
z = u1 * c1 - u2 * c2;
u2 = u1 * c2 + u2 * c1;
u1 = z;
}
c2 = Math.Sqrt((1.0 - c1)/2.0);
if (dir == 1)
c2 = -c2;
c1 = Math.Sqrt((1.0 + c1)/2.0);
}
/* Scaling for forward transform */
if (dir == 1)
{
for (i = 0; i < nn; i++)
{
x[i] /= (double)nn;
y[i] /= (double)nn;
}
}
}
어떤 알고리즘입니까? – anonymous
매우 빠른 외모로 보면 [Cooley-Tukey 알고리즘] (https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm) (기수 2 데시 메이션) – SleuthEye
명성 너의 이름대로 살아라! –