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 2011/11/30 07:43:51 UTC
svn commit: r1208295 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
Author: celestin
Date: Wed Nov 30 06:43:50 2011
New Revision: 1208295
URL: http://svn.apache.org/viewvc?rev=1208295&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=1208295&r1=1208294&r2=1208295&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 Wed Nov 30 06:43:50 2011
@@ -95,8 +95,8 @@ public class FastCosineTransformer imple
*/
public double[] transform2(double f[]) throws IllegalArgumentException {
- double scaling_coefficient = FastMath.sqrt(2.0 / (f.length-1));
- return FastFourierTransformer.scaleArray(fct(f), scaling_coefficient);
+ double scalingCoefficient = FastMath.sqrt(2.0 / (f.length - 1));
+ return FastFourierTransformer.scaleArray(fct(f), scalingCoefficient);
}
/**
@@ -119,8 +119,8 @@ public class FastCosineTransformer imple
throws IllegalArgumentException {
double data[] = FastFourierTransformer.sample(f, min, max, n);
- double scaling_coefficient = FastMath.sqrt(2.0 / (n-1));
- return FastFourierTransformer.scaleArray(fct(data), scaling_coefficient);
+ double scalingCoefficient = FastMath.sqrt(2.0 / (n - 1));
+ return FastFourierTransformer.scaleArray(fct(data), scalingCoefficient);
}
/**
@@ -134,14 +134,16 @@ public class FastCosineTransformer imple
* @return the real inversely transformed array
* @throws IllegalArgumentException if any parameters are invalid
*/
- public double[] inverseTransform(double f[]) throws IllegalArgumentException {
+ public double[] inverseTransform(double f[])
+ throws IllegalArgumentException {
- double scaling_coefficient = 2.0 / (f.length - 1);
- return FastFourierTransformer.scaleArray(fct(f), scaling_coefficient);
+ double scalingCoefficient = 2.0 / (f.length - 1);
+ return FastFourierTransformer.scaleArray(fct(f), scalingCoefficient);
}
/**
- * Inversely transform the given real function, sampled on the given interval.
+ * Inversely transform the given real function, sampled on the given
+ * interval.
* <p>
* The formula is f<sub>k</sub> = (1/N) [F<sub>0</sub> + (-1)<sup>k</sup> F<sub>N</sub>] +
* (2/N) ∑<sub>n=1</sub><sup>N-1</sup> F<sub>n</sub> cos(π nk/N)
@@ -159,8 +161,8 @@ public class FastCosineTransformer imple
throws IllegalArgumentException {
double data[] = FastFourierTransformer.sample(f, min, max, n);
- double scaling_coefficient = 2.0 / (n - 1);
- return FastFourierTransformer.scaleArray(fct(data), scaling_coefficient);
+ double scalingCoefficient = 2.0 / (n - 1);
+ return FastFourierTransformer.scaleArray(fct(data), scalingCoefficient);
}
/**
@@ -174,12 +176,14 @@ public class FastCosineTransformer imple
* @return the real inversely transformed array
* @throws IllegalArgumentException if any parameters are invalid
*/
- public double[] inverseTransform2(double f[]) throws IllegalArgumentException {
+ public double[] inverseTransform2(double f[])
+ throws IllegalArgumentException {
return transform2(f);
}
/**
- * Inversely transform the given real function, sampled on the given interval.
+ * Inversely transform the given real function, sampled on the given
+ * interval.
* <p>
* The formula is f<sub>k</sub> = √(1/2N) [F<sub>0</sub> + (-1)<sup>k</sup> F<sub>N</sub>] +
* √(2/N) ∑<sub>n=1</sub><sup>N-1</sup> F<sub>n</sub> cos(π nk/N)
@@ -227,7 +231,8 @@ public class FastCosineTransformer imple
final double[] x = new double[n];
x[0] = 0.5 * (f[0] + f[n]);
x[n >> 1] = f[n >> 1];
- double t1 = 0.5 * (f[0] - f[n]); // temporary variable for transformed[1]
+ // 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]);