You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ce...@apache.org on 2012/02/09 08:37:24 UTC

svn commit: r1242230 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/transform/ test/java/org/apache/commons/math/transform/

Author: celestin
Date: Thu Feb  9 07:37:23 2012
New Revision: 1242230

URL: http://svn.apache.org/viewvc?rev=1242230&view=rev
Log:
In o.a.c.m.transform.FastFourierTransformer
  - created enum Normalization{STANDARD, UNITARY}
  - removed factory methods create() and createUnitary(), and made constructor public
  - added parameter type to static method transformInPlace(double[][], Normalization, boolean)
See MATH-732

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1242230&r1=1242229&r2=1242230&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Thu Feb  9 07:37:23 2012
@@ -25,6 +25,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.NonMonotonicSequenceException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.transform.FastFourierTransformer.Normalization;
 import org.apache.commons.math.util.ArithmeticUtils;
 import org.apache.commons.math.util.FastMath;
 
@@ -271,7 +272,8 @@ public class FastCosineTransformer imple
             x[n - i] = a + b;
             t1 += c;
         }
-        FastFourierTransformer transformer = FastFourierTransformer.create();
+        FastFourierTransformer transformer;
+        transformer = new FastFourierTransformer(Normalization.STANDARD);
         Complex[] y = transformer.transform(x);
 
         // reconstruct the FCT result for the original array

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=1242230&r1=1242229&r2=1242230&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java Thu Feb  9 07:37:23 2012
@@ -24,6 +24,7 @@ import org.apache.commons.math.analysis.
 import org.apache.commons.math.complex.Complex;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.ArithmeticUtils;
 import org.apache.commons.math.util.FastMath;
@@ -84,8 +85,17 @@ import org.apache.commons.math.util.Math
  */
 public class FastFourierTransformer implements Serializable {
 
+    /** The various types of normalizations that can be applied. */
+    public static enum Normalization {
+        /** Standard DFT. */
+        STANDARD,
+
+        /** Unitary DFT. */
+        UNITARY;
+    }
+
     /** Serializable version identifier. */
-    static final long serialVersionUID = 20120802L;
+    static final long serialVersionUID = 20120902L;
 
     /**
      * {@code W_SUB_N_R[i]} is the real part of
@@ -134,54 +144,33 @@ public class FastFourierTransformer impl
             , -0x1.921fb54442d18p-58, -0x1.921fb54442d18p-59, -0x1.921fb54442d18p-60 };
 
     /**
-     * {@code true} if the unitary version of the DFT should be used.
-     *
-     * @see #create()
-     * @see #createUnitary()
+     * The type of DFT to be performed.
      */
-    private final boolean unitary;
+    private final Normalization type;
 
     /**
      * Creates a new instance of this class, with various normalization
      * conventions.
      *
-     * @param unitary {@code false} if the DFT is <em>not</em> to be scaled,
-     * {@code true} if it is to be scaled so as to make the transform unitary.
-     * @see #create()
-     * @see #createUnitary()
-     */
-    private FastFourierTransformer(final boolean unitary) {
-        this.unitary = unitary;
-    }
-
-
-    /**
-     * <p>
-     * Returns a new instance of this class. The returned transformer uses the
-     * <a href="#standard">standard normalizing conventions</a>.
-     * </p>
-     *
-     * @return a new DFT transformer, with standard normalizing conventions
+     * @param type the type of transform to be computed
      */
-    public static FastFourierTransformer create() {
-        return new FastFourierTransformer(false);
+    public FastFourierTransformer(final Normalization type) {
+        this.type = type;
     }
 
     /**
-     * <p>
-     * Returns a new instance of this class. The returned transformer uses the
-     * <a href="#unitary">unitary normalizing conventions</a>.
-     * </p>
+     * Performs identical index bit reversal shuffles on two arrays of identical
+     * size. Each element in the array is swapped with another element based on
+     * the bit-reversal of the index. For example, in an array with length 16,
+     * item at binary index 0011 (decimal 3) would be swapped with the item at
+     * binary index 1100 (decimal 12).
      *
-     * @return a new DFT transformer, with unitary normalizing conventions
+     * @param a the first array to be shuffled
+     * @param b the second array to be shuffled
      */
-    public static FastFourierTransformer createUnitary() {
-        return new FastFourierTransformer(true);
-    }
-
-    public static void bitReversalShuffle2(double[] a, double[] b) {
+    private static void bitReversalShuffle2(double[] a, double[] b) {
         final int n = a.length;
-        assert(b.length == n);
+        assert b.length == n;
         final int halfOfN = n >> 1;
 
         int j = 0;
@@ -207,6 +196,50 @@ public class FastFourierTransformer impl
     }
 
     /**
+     * Applies the proper normalization to the specified transformed data.
+     *
+     * @param dataRI the unscaled transformed data
+     * @param type the type of transform
+     * @param inverse {@code true} if normalization should be performed for the
+     * inverse transform
+     */
+    private static void normalizeTransformedData(final double[][] dataRI,
+        final Normalization type, final boolean inverse) {
+
+        final double[] dataR = dataRI[0];
+        final double[] dataI = dataRI[1];
+        final int n = dataR.length;
+        assert dataI.length == n;
+
+        switch (type) {
+            case STANDARD:
+                if (inverse) {
+                    final double scaleFactor = 1.0 / ((double) n);
+                    for (int i = 0; i < n; i++) {
+                        dataR[i] *= scaleFactor;
+                        dataI[i] *= scaleFactor;
+                    }
+                }
+                break;
+            case UNITARY:
+                final double scaleFactor = 1.0 / FastMath.sqrt(n);
+                for (int i = 0; i < n; i++) {
+                    dataR[i] *= scaleFactor;
+                    dataI[i] *= scaleFactor;
+                }
+                break;
+            default:
+                /*
+                 * This should never occur in normal conditions. However this
+                 * clause has been added as a safeguard if other types of
+                 * normalizations are ever implemented, and the corresponding
+                 * test is forgotten in the present switch.
+                 */
+                throw new MathIllegalStateException();
+        }
+    }
+
+    /**
      * Computes the standard transform of the specified complex data. The
      * computation is done in place. The input data is laid out as follows
      * <ul>
@@ -218,6 +251,8 @@ public class FastFourierTransformer impl
      *
      * @param dataRI the two dimensional array of real and imaginary parts of
      * the data
+     * @param type the type of normalization to be applied to the transformed
+     * data
      * @param inverse {@code true} if the inverse standard transform must be
      * performed
      * @throws DimensionMismatchException if the number of rows of the specified
@@ -226,7 +261,7 @@ public class FastFourierTransformer impl
      * a power of two
      */
     public static void transformInPlace(final double[][] dataRI,
-        boolean inverse) throws
+        final Normalization type, final boolean inverse) throws
         DimensionMismatchException, MathIllegalArgumentException {
 
         if (dataRI.length != 2) {
@@ -260,12 +295,7 @@ public class FastFourierTransformer impl
             dataR[1] = srcR0 - srcR1;
             dataI[1] = srcI0 - srcI1;
 
-            if (inverse) {
-                dataR[0] /= 2;
-                dataI[0] /= 2;
-                dataR[1] /= 2;
-                dataI[1] /= 2;
-            }
+            normalizeTransformedData(dataRI, type, inverse);
             return;
         }
 
@@ -375,13 +405,7 @@ public class FastFourierTransformer impl
             lastLogN0 = logN0;
         }
 
-        if (inverse) {
-            final double scaleFactor = 1.0 / ((double) n);
-            for (int i = 0; i < n; i++) {
-                dataR[i] *= scaleFactor;
-                dataI[i] *= scaleFactor;
-            }
-        }
+        normalizeTransformedData(dataRI, type, inverse);
     }
 
     /**
@@ -397,13 +421,13 @@ public class FastFourierTransformer impl
             MathArrays.copyOf(f, f.length), new double[f.length]
         };
 
-        transformInPlace(dataRI, false);
+        transformInPlace(dataRI, type, false);
 
-        if (unitary) {
-            final double s = 1.0 / FastMath.sqrt(f.length);
-            TransformUtils.scaleArray(dataRI[0], s);
-            TransformUtils.scaleArray(dataRI[1], s);
-        }
+//        if (unitary) {
+//            final double s = 1.0 / FastMath.sqrt(f.length);
+//            TransformUtils.scaleArray(dataRI[0], s);
+//            TransformUtils.scaleArray(dataRI[1], s);
+//        }
 
         return TransformUtils.createComplexArray(dataRI);
     }
@@ -442,13 +466,12 @@ public class FastFourierTransformer impl
     public Complex[] transform(Complex[] f) {
         final double[][] dataRI = TransformUtils.createRealImaginaryArray(f);
 
-        transformInPlace(dataRI, false);
-
-        if (unitary) {
-            final double s = 1.0 / FastMath.sqrt(f.length);
-            TransformUtils.scaleArray(dataRI[0], s);
-            TransformUtils.scaleArray(dataRI[1], s);
-        }
+        transformInPlace(dataRI, type, false);
+        // if (unitary) {
+        // final double s = 1.0 / FastMath.sqrt(f.length);
+        // TransformUtils.scaleArray(dataRI[0], s);
+        // TransformUtils.scaleArray(dataRI[1], s);
+        // }
 
         return TransformUtils.createComplexArray(dataRI);
     }
@@ -466,13 +489,12 @@ public class FastFourierTransformer impl
             MathArrays.copyOf(f, f.length), new double[f.length]
         };
 
-        transformInPlace(dataRI, true);
-
-        if (unitary) {
-            final double s = FastMath.sqrt(f.length);
-            TransformUtils.scaleArray(dataRI[0], s);
-            TransformUtils.scaleArray(dataRI[1], s);
-        }
+        transformInPlace(dataRI, type, true);
+        // if (unitary) {
+        // final double s = FastMath.sqrt(f.length);
+        // TransformUtils.scaleArray(dataRI[0], s);
+        // TransformUtils.scaleArray(dataRI[1], s);
+        // }
 
         return TransformUtils.createComplexArray(dataRI);
     }
@@ -512,13 +534,12 @@ public class FastFourierTransformer impl
         final double[] dataR = dataRI[0];
         final double[] dataI = dataRI[1];
 
-        transformInPlace(dataRI, true);
-
-        if (unitary) {
-            final double s = FastMath.sqrt(f.length);
-            TransformUtils.scaleArray(dataR, s);
-            TransformUtils.scaleArray(dataI, s);
-        }
+        transformInPlace(dataRI, type, true);
+//        if (unitary) {
+//            final double s = FastMath.sqrt(f.length);
+//            TransformUtils.scaleArray(dataR, s);
+//            TransformUtils.scaleArray(dataI, s);
+//        }
 
         return TransformUtils.createComplexArray(dataRI);
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java?rev=1242230&r1=1242229&r2=1242230&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java Thu Feb  9 07:37:23 2012
@@ -25,6 +25,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.NonMonotonicSequenceException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.transform.FastFourierTransformer.Normalization;
 import org.apache.commons.math.util.ArithmeticUtils;
 import org.apache.commons.math.util.FastMath;
 
@@ -292,7 +293,8 @@ public class FastSineTransformer impleme
             x[i]     = a + b;
             x[n - i] = a - b;
         }
-        FastFourierTransformer transformer = FastFourierTransformer.create();
+        FastFourierTransformer transformer;
+        transformer = new FastFourierTransformer(Normalization.STANDARD);
         Complex[] y = transformer.transform(x);
 
         // reconstruct the FST result for the original array

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java?rev=1242230&r1=1242229&r2=1242230&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java Thu Feb  9 07:37:23 2012
@@ -26,6 +26,7 @@ import org.apache.commons.math.complex.C
 import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.NumberIsTooLargeException;
+import org.apache.commons.math.transform.FastFourierTransformer.Normalization;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -50,7 +51,8 @@ public final class FastFourierTransforme
     public void testStandardTransformComplexSizeNotAPowerOfTwo() {
         final int n = 127;
         final Complex[] x = createComplexData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.transform(x);
     }
 
@@ -58,7 +60,8 @@ public final class FastFourierTransforme
     public void testStandardTransformRealSizeNotAPowerOfTwo() {
         final int n = 127;
         final double[] x = createRealData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.transform(x);
     }
 
@@ -66,7 +69,8 @@ public final class FastFourierTransforme
     public void testStandardTransformFunctionSizeNotAPowerOfTwo() {
         final int n = 127;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.transform(f, 0.0, Math.PI, n);
     }
 
@@ -74,7 +78,8 @@ public final class FastFourierTransforme
     public void testStandardTransformFunctionNotStrictlyPositiveNumberOfSamples() {
         final int n = -128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.transform(f, 0.0, Math.PI, n);
     }
 
@@ -82,7 +87,8 @@ public final class FastFourierTransforme
     public void testStandardTransformFunctionInvalidBounds() {
         final int n = 128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.transform(f, Math.PI, 0.0, n);
     }
 
@@ -90,7 +96,8 @@ public final class FastFourierTransforme
     public void testStandardInverseTransformComplexSizeNotAPowerOfTwo() {
         final int n = 127;
         final Complex[] x = createComplexData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.inverseTransform(x);
     }
 
@@ -98,7 +105,8 @@ public final class FastFourierTransforme
     public void testStandardInverseTransformRealSizeNotAPowerOfTwo() {
         final int n = 127;
         final double[] x = createRealData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.inverseTransform(x);
     }
 
@@ -106,7 +114,8 @@ public final class FastFourierTransforme
     public void testStandardInverseTransformFunctionSizeNotAPowerOfTwo() {
         final int n = 127;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.inverseTransform(f, 0.0, Math.PI, n);
     }
 
@@ -114,7 +123,8 @@ public final class FastFourierTransforme
     public void testStandardInverseTransformFunctionNotStrictlyPositiveNumberOfSamples() {
         final int n = -128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.inverseTransform(f, 0.0, Math.PI, n);
     }
 
@@ -122,7 +132,8 @@ public final class FastFourierTransforme
     public void testStandardInverseTransformFunctionInvalidBounds() {
         final int n = 128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.create();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.STANDARD);
         fft.transform(f, Math.PI, 0.0, n);
     }
 
@@ -134,7 +145,8 @@ public final class FastFourierTransforme
     public void testUnitaryTransformComplexSizeNotAPowerOfTwo() {
         final int n = 127;
         final Complex[] x = createComplexData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.transform(x);
     }
 
@@ -142,7 +154,8 @@ public final class FastFourierTransforme
     public void testUnitaryTransformRealSizeNotAPowerOfTwo() {
         final int n = 127;
         final double[] x = createRealData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.transform(x);
     }
 
@@ -150,7 +163,8 @@ public final class FastFourierTransforme
     public void testUnitaryTransformFunctionSizeNotAPowerOfTwo() {
         final int n = 127;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.transform(f, 0.0, Math.PI, n);
     }
 
@@ -158,7 +172,8 @@ public final class FastFourierTransforme
     public void testUnitaryTransformFunctionNotStrictlyPositiveNumberOfSamples() {
         final int n = -128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.transform(f, 0.0, Math.PI, n);
     }
 
@@ -166,7 +181,8 @@ public final class FastFourierTransforme
     public void testUnitaryTransformFunctionInvalidBounds() {
         final int n = 128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.transform(f, Math.PI, 0.0, n);
     }
 
@@ -174,7 +190,8 @@ public final class FastFourierTransforme
     public void testUnitaryInverseTransformComplexSizeNotAPowerOfTwo() {
         final int n = 127;
         final Complex[] x = createComplexData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.inverseTransform(x);
     }
 
@@ -182,7 +199,8 @@ public final class FastFourierTransforme
     public void testUnitaryInverseTransformRealSizeNotAPowerOfTwo() {
         final int n = 127;
         final double[] x = createRealData(n);
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.inverseTransform(x);
     }
 
@@ -190,7 +208,8 @@ public final class FastFourierTransforme
     public void testUnitaryInverseTransformFunctionSizeNotAPowerOfTwo() {
         final int n = 127;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.inverseTransform(f, 0.0, Math.PI, n);
     }
 
@@ -198,7 +217,8 @@ public final class FastFourierTransforme
     public void testUnitaryInverseTransformFunctionNotStrictlyPositiveNumberOfSamples() {
         final int n = -128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.inverseTransform(f, 0.0, Math.PI, n);
     }
 
@@ -206,7 +226,8 @@ public final class FastFourierTransforme
     public void testUnitaryInverseTransformFunctionInvalidBounds() {
         final int n = 128;
         final UnivariateFunction f = new Sin();
-        final FastFourierTransformer fft = FastFourierTransformer.createUnitary();
+        final FastFourierTransformer fft;
+        fft = new FastFourierTransformer(Normalization.UNITARY);
         fft.transform(f, Math.PI, 0.0, n);
     }
 
@@ -266,9 +287,9 @@ public final class FastFourierTransforme
         final boolean forward, final boolean standard) {
         final FastFourierTransformer fft;
         if (standard) {
-            fft = FastFourierTransformer.create();
+            fft = new FastFourierTransformer(Normalization.STANDARD);
         } else {
-            fft = FastFourierTransformer.createUnitary();
+            fft = new FastFourierTransformer(Normalization.UNITARY);
         }
         final Complex[] x = createComplexData(n);
         final Complex[] expected;
@@ -298,9 +319,9 @@ public final class FastFourierTransforme
         final boolean forward, final boolean standard) {
         final FastFourierTransformer fft;
         if (standard) {
-            fft = FastFourierTransformer.create();
+            fft = new FastFourierTransformer(Normalization.STANDARD);
         } else {
-            fft = FastFourierTransformer.createUnitary();
+            fft = new FastFourierTransformer(Normalization.UNITARY);
         }
         final double[] x = createRealData(n);
         final Complex[] xc = new Complex[n];
@@ -335,9 +356,9 @@ public final class FastFourierTransforme
         final boolean forward, final boolean standard) {
         final FastFourierTransformer fft;
         if (standard) {
-            fft = FastFourierTransformer.create();
+            fft = new FastFourierTransformer(Normalization.STANDARD);
         } else {
-            fft = FastFourierTransformer.createUnitary();
+            fft = new FastFourierTransformer(Normalization.UNITARY);
         }
         final Complex[] x = new Complex[n];
         for (int i = 0; i < n; i++) {
@@ -552,7 +573,8 @@ public final class FastFourierTransforme
      */
     @Test
     public void testAdHocData() {
-        FastFourierTransformer transformer = FastFourierTransformer.create();
+        FastFourierTransformer transformer;
+        transformer = new FastFourierTransformer(Normalization.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};
@@ -582,7 +604,7 @@ public final class FastFourierTransforme
         TransformUtils.scaleArray(x2, 1.0 / FastMath.sqrt(x2.length));
         Complex y2[] = y;
 
-        transformer = FastFourierTransformer.createUnitary();
+        transformer = new FastFourierTransformer(Normalization.UNITARY);
         result = transformer.transform(y2);
         for (int i = 0; i < result.length; i++) {
             Assert.assertEquals(x2[i], result[i].getReal(), tolerance);
@@ -602,7 +624,8 @@ public final class FastFourierTransforme
     @Test
     public void testSinFunction() {
         UnivariateFunction f = new SinFunction();
-        FastFourierTransformer transformer = FastFourierTransformer.create();
+        FastFourierTransformer transformer;
+        transformer = new FastFourierTransformer(Normalization.STANDARD);
         Complex result[]; int N = 1 << 8;
         double min, max, tolerance = 1E-12;
 
@@ -635,7 +658,9 @@ public final class FastFourierTransforme
 
     @Test
     public void test2DData() {
-        FastFourierTransformer transformer = FastFourierTransformer.create();
+        FastFourierTransformer transformer;
+        transformer = new FastFourierTransformer(Normalization.STANDARD);
+
         double tolerance = 1E-12;
         Complex[][] input = new Complex[][] {new Complex[] {new Complex(1, 0),
                                                             new Complex(2, 0)},
@@ -674,7 +699,8 @@ public final class FastFourierTransforme
 
     @Test
     public void test2DDataUnitary() {
-        FastFourierTransformer transformer = FastFourierTransformer.createUnitary();
+        FastFourierTransformer transformer;
+        transformer = new FastFourierTransformer(Normalization.UNITARY);
         double tolerance = 1E-12;
         Complex[][] input = new Complex[][] {new Complex[] {new Complex(1, 0),
                                                             new Complex(2, 0)},