*/
@Test
public void testAdHocData() {
FastFourierTransformer transformer;
transformer = new FastFourierTransformer(DftNormalization.STANDARD);
Complex result[]; double tolerance = 1E-12;
double x[] = {1.3, 2.4, 1.7, 4.1, 2.9, 1.7, 5.1, 2.7};
Complex y[] = {
new Complex(21.9, 0.0),
new Complex(-2.09497474683058, 1.91507575950825),
new Complex(-2.6, 2.7),
new Complex(-1.10502525316942, -4.88492424049175),
new Complex(0.1, 0.0),
new Complex(-1.10502525316942, 4.88492424049175),
new Complex(-2.6, -2.7),
new Complex(-2.09497474683058, -1.91507575950825)};
result = transformer.transform(x, TransformType.FORWARD);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(y[i].getReal(), result[i].getReal(), tolerance);
Assert.assertEquals(y[i].getImaginary(), result[i].getImaginary(), tolerance);
}
result = transformer.transform(y, TransformType.INVERSE);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(x[i], result[i].getReal(), tolerance);
Assert.assertEquals(0.0, result[i].getImaginary(), tolerance);
}
double x2[] = {10.4, 21.6, 40.8, 13.6, 23.2, 32.8, 13.6, 19.2};
TransformUtils.scaleArray(x2, 1.0 / FastMath.sqrt(x2.length));
Complex y2[] = y;
transformer = new FastFourierTransformer(DftNormalization.UNITARY);
result = transformer.transform(y2, TransformType.FORWARD);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(x2[i], result[i].getReal(), tolerance);