Hi I've very little c++ experience and was wondering could someone explain to me what this bit of code is doing? It's mainly just what the x array is doign which is confusing me. The code is meant to be doing a fourier transform on an array of image data. Also is it adding all details to position 0 and nFFT2 in the array?
for(int n = 0; n < nFFT; n++) re[0] += x[n]; is an addition operation , add each elements of xi to the first element of re. after that operation the first element of re is updated to sum of all xi
than renFFT2 is set to 0 and
1 2 3 4
for(int n = 0; n < nFFT; n++) {
float a = (n % 2)? -x[n] : x[n];
re[nFFT2] += a;
}
if n is an even number xn element is added to renFFT2
if n is an odd number xn element is subtracted from renFFT2
1 2 3 4 5
for(int k = 1; k < nFFT2; k++) {
re[k] = 0.;
for(int n = 0; n < nFFT; n++)
re[k] += x[n] * Cos[k][n];
}
than for each element between 1 and nFFT2
the elements of rek where-> 1 <= k < nFFT2 is updated to the total sum of
xn* Coskn where -> 0<= n < nFFT
and in the last loops the elements of imk where-> 1 <= k < nFFT2 is set to
the total sum of xn* Sinkn where ->0 <= n < nFFT
Dont ask me about the variable, and what they stand for , no idea