Javadoc issue ? (realForward output)
Closed this issue · 4 comments
aringot commented
Hello,
I found a somewhat confusing function description in DoubleFFT_1D.java
Is the realForward function really returning a[1] = Re[n/2]
? A real unrelated to the (also real) 0th element instead of the imaginary part of the 0th element ? (that's the even case, but same question for the odd case, I'd expect the last element to be lonely, but the 0th and 1st values to be related to each other)
Relevant description:
/**
* Computes 1D forward DFT of real data leaving the result in <code>a</code>
* . The physical layout of the output data is as follows:<br>
*
* if n is even then
*
* <pre>
* a[2*k] = Re[k], 0<=k<n/2
* a[2*k+1] = Im[k], 0<k<n/2
* a[1] = Re[n/2]
* </pre>
*
* if n is odd then
*
* <pre>
* a[2*k] = Re[k], 0<=k<(n+1)/2
* a[2*k+1] = Im[k], 0<k<(n-1)/2
* a[1] = Im[(n-1)/2]
* </pre>
*
* This method computes only half of the elements of the real transform. The
* other half satisfies the symmetry condition. If you want the full real
* forward transform, use <code>realForwardFull</code>. To get back the
* original data, use <code>realInverse</code> on the output of this method.
*
* @param a
* data to transform
*/
public void realForward(double[] a) {
Thank you !
wendykierp commented
The documentation is correct.
aringot commented
Thank you for the quick answer. Any reason not to return the imaginary part of the 0th element ?
wendykierp commented
The imaginary part of the 0th element is always 0.
aringot commented
Thanks :)