SourcePro : Essential Math Module User’s Guide : FFT Servers : Transforms of Even and Odd Sequences
Transforms of Even and Odd Sequences
If the original sequence is an even or odd sequence, there is an additional symmetry that can be exploited. Consider a cosine wave:
 
V(j) = cos(2pj/N), j=0, 1, ..., N–1
This is an example of an even sequence, V(j) = V(–j) = V(N–j). It is possible to transform an N-point even or odd real sequence as an N/4-point complex sequence. This is the approach DoubleCosineServer takes. Instead of feeding the server the full N-point real sequence, you give the DoubleCosineServer only the lower half of it, V(j), j=0, ..., N/2, a total of only N/2+1 points.
Here’s an example:
 
// Single cycle of a cosine wave: a real, even sequence:
RWMathVec<double> Vcos = cos(RWMathVec<double>(npts, 0,2.0*M_PI/npts));
 
cout << "Original cosine wave:\n" << Vcos;
 
DoubleCosineServer dcs;
 
// Hand the server the lower half of the real sequence:
RWMathVec<double> VcosTrans = dcs.cosine(Vcos.slice(0, npts/2+1, 1));
 
cout << "Cosine transform:\n" << VcosTrans << "\n";
Program output (exact results depend on machine precision):
Original cosine wave:
[
1 0.866025 0.5 0 -0.5
-0.866025 -1 -0.866025 -0.5 0
0.5 0.866025
]
Cosine transform:
[
0 6 0 0 0
0 0
]
Note that the results are real: the transform of a real even (or odd) sequence is a real even (or odd) sequence. Also note that the DoubleCosineServer returns only the lower half of that sequence. The global function expandEven() could be used to expand it into the full real sequence. See the RWMathVec description in the SourcePro API Reference Guide.