commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1208942 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
Date Thu, 01 Dec 2011 03:37:03 GMT
Author: celestin
Date: Thu Dec  1 03:37:02 2011
New Revision: 1208942

URL: http://svn.apache.org/viewvc?rev=1208942&view=rev
Log:
Formatting (MATH-677).

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.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=1208942&r1=1208941&r2=1208942&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 Dec  1 03:37:02 2011
@@ -57,7 +57,7 @@ public class FastCosineTransformer imple
      * @return the real transformed array
      * @throws IllegalArgumentException if any parameters are invalid
      */
-    public double[] transform(double f[]) throws IllegalArgumentException {
+    public double[] transform(double[] f) throws IllegalArgumentException {
         return fct(f);
     }
 
@@ -78,7 +78,7 @@ public class FastCosineTransformer imple
     public double[] transform(UnivariateFunction f,
                               double min, double max, int n)
         throws IllegalArgumentException {
-        double data[] = FastFourierTransformer.sample(f, min, max, n);
+        double[] data = FastFourierTransformer.sample(f, min, max, n);
         return fct(data);
     }
 
@@ -93,7 +93,7 @@ public class FastCosineTransformer imple
      * @return the real transformed array
      * @throws IllegalArgumentException if any parameters are invalid
      */
-    public double[] transform2(double f[]) throws IllegalArgumentException {
+    public double[] transform2(double[] f) throws IllegalArgumentException {
 
         double scalingCoefficient = FastMath.sqrt(2.0 / (f.length - 1));
         return FastFourierTransformer.scaleArray(fct(f), scalingCoefficient);
@@ -118,7 +118,7 @@ public class FastCosineTransformer imple
                                double min, double max, int n)
         throws IllegalArgumentException {
 
-        double data[] = FastFourierTransformer.sample(f, min, max, n);
+        double[] data = FastFourierTransformer.sample(f, min, max, n);
         double scalingCoefficient = FastMath.sqrt(2.0 / (n - 1));
         return FastFourierTransformer.scaleArray(fct(data), scalingCoefficient);
     }
@@ -134,7 +134,7 @@ public class FastCosineTransformer imple
      * @return the real inversely transformed array
      * @throws IllegalArgumentException if any parameters are invalid
      */
-    public double[] inverseTransform(double f[])
+    public double[] inverseTransform(double[] f)
     throws IllegalArgumentException {
 
         double scalingCoefficient = 2.0 / (f.length - 1);
@@ -160,7 +160,7 @@ public class FastCosineTransformer imple
                                      double min, double max, int n)
         throws IllegalArgumentException {
 
-        double data[] = FastFourierTransformer.sample(f, min, max, n);
+        double[] data = FastFourierTransformer.sample(f, min, max, n);
         double scalingCoefficient = 2.0 / (n - 1);
         return FastFourierTransformer.scaleArray(fct(data), scalingCoefficient);
     }
@@ -176,7 +176,7 @@ public class FastCosineTransformer imple
      * @return the real inversely transformed array
      * @throws IllegalArgumentException if any parameters are invalid
      */
-    public double[] inverseTransform2(double f[])
+    public double[] inverseTransform2(double[] f)
         throws IllegalArgumentException {
         return transform2(f);
     }
@@ -210,10 +210,10 @@ public class FastCosineTransformer imple
      * @return the real transformed array
      * @throws IllegalArgumentException if any parameters are invalid
      */
-    protected double[] fct(double f[])
+    protected double[] fct(double[] f)
         throws IllegalArgumentException {
 
-        final double transformed[] = new double[f.length];
+        final double[] transformed = new double[f.length];
 
         final int n = f.length - 1;
         if (!FastFourierTransformer.isPowerOf2(n)) {
@@ -234,15 +234,15 @@ public class FastCosineTransformer imple
         // temporary variable for transformed[1]
         double t1 = 0.5 * (f[0] - f[n]);
         for (int i = 1; i < (n >> 1); i++) {
-            final double a = 0.5 * (f[i] + f[n-i]);
-            final double b = FastMath.sin(i * FastMath.PI / n) * (f[i] - f[n-i]);
-            final double c = FastMath.cos(i * FastMath.PI / n) * (f[i] - f[n-i]);
+            final double a = 0.5 * (f[i] + f[n - i]);
+            final double b = FastMath.sin(i * FastMath.PI / n) * (f[i] - f[n - i]);
+            final double c = FastMath.cos(i * FastMath.PI / n) * (f[i] - f[n - i]);
             x[i] = a - b;
-            x[n-i] = a + b;
+            x[n - i] = a + b;
             t1 += c;
         }
         FastFourierTransformer transformer = new FastFourierTransformer();
-        Complex y[] = transformer.transform(x);
+        Complex[] y = transformer.transform(x);
 
         // reconstruct the FCT result for the original array
         transformed[0] = y[0].getReal();



Mime
View raw message