You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/09/06 17:32:51 UTC
svn commit: r811827 [2/2] - in /commons/proper/math/trunk: ./
src/main/java/org/apache/commons/math/
src/main/java/org/apache/commons/math/analysis/interpolation/
src/main/java/org/apache/commons/math/analysis/solvers/
src/main/java/org/apache/commons/...
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -39,6 +39,186 @@
class DormandPrince853StepInterpolator
extends RungeKuttaStepInterpolator {
+ /** Serializable version identifier */
+ private static final long serialVersionUID = 7152276390558450974L;
+
+ /** Propagation weights, element 1. */
+ private static final double B_01 = 104257.0 / 1920240.0;
+
+ // elements 2 to 5 are zero, so they are neither stored nor used
+
+ /** Propagation weights, element 6. */
+ private static final double B_06 = 3399327.0 / 763840.0;
+
+ /** Propagation weights, element 7. */
+ private static final double B_07 = 66578432.0 / 35198415.0;
+
+ /** Propagation weights, element 8. */
+ private static final double B_08 = -1674902723.0 / 288716400.0;
+
+ /** Propagation weights, element 9. */
+ private static final double B_09 = 54980371265625.0 / 176692375811392.0;
+
+ /** Propagation weights, element 10. */
+ private static final double B_10 = -734375.0 / 4826304.0;
+
+ /** Propagation weights, element 11. */
+ private static final double B_11 = 171414593.0 / 851261400.0;
+
+ /** Propagation weights, element 12. */
+ private static final double B_12 = 137909.0 / 3084480.0;
+
+ /** Time step for stage 14 (interpolation only). */
+ private static final double C14 = 1.0 / 10.0;
+
+ /** Internal weights for stage 14, element 1. */
+ private static final double K14_01 = 13481885573.0 / 240030000000.0 - B_01;
+
+ // elements 2 to 5 are zero, so they are neither stored nor used
+
+ /** Internal weights for stage 14, element 6. */
+ private static final double K14_06 = 0.0 - B_06;
+
+ /** Internal weights for stage 14, element 7. */
+ private static final double K14_07 = 139418837528.0 / 549975234375.0 - B_07;
+
+ /** Internal weights for stage 14, element 8. */
+ private static final double K14_08 = -11108320068443.0 / 45111937500000.0 - B_08;
+
+ /** Internal weights for stage 14, element 9. */
+ private static final double K14_09 = -1769651421925959.0 / 14249385146080000.0 - B_09;
+
+ /** Internal weights for stage 14, element 10. */
+ private static final double K14_10 = 57799439.0 / 377055000.0 - B_10;
+
+ /** Internal weights for stage 14, element 11. */
+ private static final double K14_11 = 793322643029.0 / 96734250000000.0 - B_11;
+
+ /** Internal weights for stage 14, element 12. */
+ private static final double K14_12 = 1458939311.0 / 192780000000.0 - B_12;
+
+ /** Internal weights for stage 14, element 13. */
+ private static final double K14_13 = -4149.0 / 500000.0;
+
+ /** Time step for stage 15 (interpolation only). */
+ private static final double C15 = 1.0 / 5.0;
+
+
+ /** Internal weights for stage 15, element 1. */
+ private static final double K15_01 = 1595561272731.0 / 50120273500000.0 - B_01;
+
+ // elements 2 to 5 are zero, so they are neither stored nor used
+
+ /** Internal weights for stage 15, element 6. */
+ private static final double K15_06 = 975183916491.0 / 34457688031250.0 - B_06;
+
+ /** Internal weights for stage 15, element 7. */
+ private static final double K15_07 = 38492013932672.0 / 718912673015625.0 - B_07;
+
+ /** Internal weights for stage 15, element 8. */
+ private static final double K15_08 = -1114881286517557.0 / 20298710767500000.0 - B_08;
+
+ /** Internal weights for stage 15, element 9. */
+ private static final double K15_09 = 0.0 - B_09;
+
+ /** Internal weights for stage 15, element 10. */
+ private static final double K15_10 = 0.0 - B_10;
+
+ /** Internal weights for stage 15, element 11. */
+ private static final double K15_11 = -2538710946863.0 / 23431227861250000.0 - B_11;
+
+ /** Internal weights for stage 15, element 12. */
+ private static final double K15_12 = 8824659001.0 / 23066716781250.0 - B_12;
+
+ /** Internal weights for stage 15, element 13. */
+ private static final double K15_13 = -11518334563.0 / 33831184612500.0;
+
+ /** Internal weights for stage 15, element 14. */
+ private static final double K15_14 = 1912306948.0 / 13532473845.0;
+
+ /** Time step for stage 16 (interpolation only). */
+ private static final double C16 = 7.0 / 9.0;
+
+
+ /** Internal weights for stage 16, element 1. */
+ private static final double K16_01 = -13613986967.0 / 31741908048.0 - B_01;
+
+ // elements 2 to 5 are zero, so they are neither stored nor used
+
+ /** Internal weights for stage 16, element 6. */
+ private static final double K16_06 = -4755612631.0 / 1012344804.0 - B_06;
+
+ /** Internal weights for stage 16, element 7. */
+ private static final double K16_07 = 42939257944576.0 / 5588559685701.0 - B_07;
+
+ /** Internal weights for stage 16, element 8. */
+ private static final double K16_08 = 77881972900277.0 / 19140370552944.0 - B_08;
+
+ /** Internal weights for stage 16, element 9. */
+ private static final double K16_09 = 22719829234375.0 / 63689648654052.0 - B_09;
+
+ /** Internal weights for stage 16, element 10. */
+ private static final double K16_10 = 0.0 - B_10;
+
+ /** Internal weights for stage 16, element 11. */
+ private static final double K16_11 = 0.0 - B_11;
+
+ /** Internal weights for stage 16, element 12. */
+ private static final double K16_12 = 0.0 - B_12;
+
+ /** Internal weights for stage 16, element 13. */
+ private static final double K16_13 = -1199007803.0 / 857031517296.0;
+
+ /** Internal weights for stage 16, element 14. */
+ private static final double K16_14 = 157882067000.0 / 53564469831.0;
+
+ /** Internal weights for stage 16, element 15. */
+ private static final double K16_15 = -290468882375.0 / 31741908048.0;
+
+ /** Interpolation weights.
+ * (beware that only the non-null values are in the table)
+ */
+ private static final double[][] D = {
+
+ { -17751989329.0 / 2106076560.0, 4272954039.0 / 7539864640.0,
+ -118476319744.0 / 38604839385.0, 755123450731.0 / 316657731600.0,
+ 3692384461234828125.0 / 1744130441634250432.0, -4612609375.0 / 5293382976.0,
+ 2091772278379.0 / 933644586600.0, 2136624137.0 / 3382989120.0,
+ -126493.0 / 1421424.0, 98350000.0 / 5419179.0,
+ -18878125.0 / 2053168.0, -1944542619.0 / 438351368.0},
+
+ { 32941697297.0 / 3159114840.0, 456696183123.0 / 1884966160.0,
+ 19132610714624.0 / 115814518155.0, -177904688592943.0 / 474986597400.0,
+ -4821139941836765625.0 / 218016305204281304.0, 30702015625.0 / 3970037232.0,
+ -85916079474274.0 / 2800933759800.0, -5919468007.0 / 634310460.0,
+ 2479159.0 / 157936.0, -18750000.0 / 602131.0,
+ -19203125.0 / 2053168.0, 15700361463.0 / 438351368.0},
+
+ { 12627015655.0 / 631822968.0, -72955222965.0 / 188496616.0,
+ -13145744952320.0 / 69488710893.0, 30084216194513.0 / 56998391688.0,
+ -296858761006640625.0 / 25648977082856624.0, 569140625.0 / 82709109.0,
+ -18684190637.0 / 18672891732.0, 69644045.0 / 89549712.0,
+ -11847025.0 / 4264272.0, -978650000.0 / 16257537.0,
+ 519371875.0 / 6159504.0, 5256837225.0 / 438351368.0},
+
+ { -450944925.0 / 17550638.0, -14532122925.0 / 94248308.0,
+ -595876966400.0 / 2573655959.0, 188748653015.0 / 527762886.0,
+ 2545485458115234375.0 / 27252038150535163.0, -1376953125.0 / 36759604.0,
+ 53995596795.0 / 518691437.0, 210311225.0 / 7047894.0,
+ -1718875.0 / 39484.0, 58000000.0 / 602131.0,
+ -1546875.0 / 39484.0, -1262172375.0 / 8429834.0}
+
+ };
+
+ /** Last evaluations. */
+ private double[][] yDotKLast;
+
+ /** Vectors for interpolation. */
+ private double[][] v;
+
+ /** Initialization indicator for the interpolation vectors. */
+ private boolean vectorsInitialized;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link #reinitialize} method should be called before using the
@@ -295,184 +475,4 @@
}
- /** Last evaluations. */
- private double[][] yDotKLast;
-
- /** Vectors for interpolation. */
- private double[][] v;
-
- /** Initialization indicator for the interpolation vectors. */
- private boolean vectorsInitialized;
-
- /** Propagation weights, element 1. */
- private static final double B_01 = 104257.0 / 1920240.0;
-
- // elements 2 to 5 are zero, so they are neither stored nor used
-
- /** Propagation weights, element 6. */
- private static final double B_06 = 3399327.0 / 763840.0;
-
- /** Propagation weights, element 7. */
- private static final double B_07 = 66578432.0 / 35198415.0;
-
- /** Propagation weights, element 8. */
- private static final double B_08 = -1674902723.0 / 288716400.0;
-
- /** Propagation weights, element 9. */
- private static final double B_09 = 54980371265625.0 / 176692375811392.0;
-
- /** Propagation weights, element 10. */
- private static final double B_10 = -734375.0 / 4826304.0;
-
- /** Propagation weights, element 11. */
- private static final double B_11 = 171414593.0 / 851261400.0;
-
- /** Propagation weights, element 12. */
- private static final double B_12 = 137909.0 / 3084480.0;
-
- /** Time step for stage 14 (interpolation only). */
- private static final double C14 = 1.0 / 10.0;
-
- /** Internal weights for stage 14, element 1. */
- private static final double K14_01 = 13481885573.0 / 240030000000.0 - B_01;
-
- // elements 2 to 5 are zero, so they are neither stored nor used
-
- /** Internal weights for stage 14, element 6. */
- private static final double K14_06 = 0.0 - B_06;
-
- /** Internal weights for stage 14, element 7. */
- private static final double K14_07 = 139418837528.0 / 549975234375.0 - B_07;
-
- /** Internal weights for stage 14, element 8. */
- private static final double K14_08 = -11108320068443.0 / 45111937500000.0 - B_08;
-
- /** Internal weights for stage 14, element 9. */
- private static final double K14_09 = -1769651421925959.0 / 14249385146080000.0 - B_09;
-
- /** Internal weights for stage 14, element 10. */
- private static final double K14_10 = 57799439.0 / 377055000.0 - B_10;
-
- /** Internal weights for stage 14, element 11. */
- private static final double K14_11 = 793322643029.0 / 96734250000000.0 - B_11;
-
- /** Internal weights for stage 14, element 12. */
- private static final double K14_12 = 1458939311.0 / 192780000000.0 - B_12;
-
- /** Internal weights for stage 14, element 13. */
- private static final double K14_13 = -4149.0 / 500000.0;
-
- /** Time step for stage 15 (interpolation only). */
- private static final double C15 = 1.0 / 5.0;
-
-
- /** Internal weights for stage 15, element 1. */
- private static final double K15_01 = 1595561272731.0 / 50120273500000.0 - B_01;
-
- // elements 2 to 5 are zero, so they are neither stored nor used
-
- /** Internal weights for stage 15, element 6. */
- private static final double K15_06 = 975183916491.0 / 34457688031250.0 - B_06;
-
- /** Internal weights for stage 15, element 7. */
- private static final double K15_07 = 38492013932672.0 / 718912673015625.0 - B_07;
-
- /** Internal weights for stage 15, element 8. */
- private static final double K15_08 = -1114881286517557.0 / 20298710767500000.0 - B_08;
-
- /** Internal weights for stage 15, element 9. */
- private static final double K15_09 = 0.0 - B_09;
-
- /** Internal weights for stage 15, element 10. */
- private static final double K15_10 = 0.0 - B_10;
-
- /** Internal weights for stage 15, element 11. */
- private static final double K15_11 = -2538710946863.0 / 23431227861250000.0 - B_11;
-
- /** Internal weights for stage 15, element 12. */
- private static final double K15_12 = 8824659001.0 / 23066716781250.0 - B_12;
-
- /** Internal weights for stage 15, element 13. */
- private static final double K15_13 = -11518334563.0 / 33831184612500.0;
-
- /** Internal weights for stage 15, element 14. */
- private static final double K15_14 = 1912306948.0 / 13532473845.0;
-
- /** Time step for stage 16 (interpolation only). */
- private static final double C16 = 7.0 / 9.0;
-
-
- /** Internal weights for stage 16, element 1. */
- private static final double K16_01 = -13613986967.0 / 31741908048.0 - B_01;
-
- // elements 2 to 5 are zero, so they are neither stored nor used
-
- /** Internal weights for stage 16, element 6. */
- private static final double K16_06 = -4755612631.0 / 1012344804.0 - B_06;
-
- /** Internal weights for stage 16, element 7. */
- private static final double K16_07 = 42939257944576.0 / 5588559685701.0 - B_07;
-
- /** Internal weights for stage 16, element 8. */
- private static final double K16_08 = 77881972900277.0 / 19140370552944.0 - B_08;
-
- /** Internal weights for stage 16, element 9. */
- private static final double K16_09 = 22719829234375.0 / 63689648654052.0 - B_09;
-
- /** Internal weights for stage 16, element 10. */
- private static final double K16_10 = 0.0 - B_10;
-
- /** Internal weights for stage 16, element 11. */
- private static final double K16_11 = 0.0 - B_11;
-
- /** Internal weights for stage 16, element 12. */
- private static final double K16_12 = 0.0 - B_12;
-
- /** Internal weights for stage 16, element 13. */
- private static final double K16_13 = -1199007803.0 / 857031517296.0;
-
- /** Internal weights for stage 16, element 14. */
- private static final double K16_14 = 157882067000.0 / 53564469831.0;
-
- /** Internal weights for stage 16, element 15. */
- private static final double K16_15 = -290468882375.0 / 31741908048.0;
-
- /** Interpolation weights.
- * (beware that only the non-null values are in the table)
- */
- private static final double[][] D = {
-
- { -17751989329.0 / 2106076560.0, 4272954039.0 / 7539864640.0,
- -118476319744.0 / 38604839385.0, 755123450731.0 / 316657731600.0,
- 3692384461234828125.0 / 1744130441634250432.0, -4612609375.0 / 5293382976.0,
- 2091772278379.0 / 933644586600.0, 2136624137.0 / 3382989120.0,
- -126493.0 / 1421424.0, 98350000.0 / 5419179.0,
- -18878125.0 / 2053168.0, -1944542619.0 / 438351368.0},
-
- { 32941697297.0 / 3159114840.0, 456696183123.0 / 1884966160.0,
- 19132610714624.0 / 115814518155.0, -177904688592943.0 / 474986597400.0,
- -4821139941836765625.0 / 218016305204281304.0, 30702015625.0 / 3970037232.0,
- -85916079474274.0 / 2800933759800.0, -5919468007.0 / 634310460.0,
- 2479159.0 / 157936.0, -18750000.0 / 602131.0,
- -19203125.0 / 2053168.0, 15700361463.0 / 438351368.0},
-
- { 12627015655.0 / 631822968.0, -72955222965.0 / 188496616.0,
- -13145744952320.0 / 69488710893.0, 30084216194513.0 / 56998391688.0,
- -296858761006640625.0 / 25648977082856624.0, 569140625.0 / 82709109.0,
- -18684190637.0 / 18672891732.0, 69644045.0 / 89549712.0,
- -11847025.0 / 4264272.0, -978650000.0 / 16257537.0,
- 519371875.0 / 6159504.0, 5256837225.0 / 438351368.0},
-
- { -450944925.0 / 17550638.0, -14532122925.0 / 94248308.0,
- -595876966400.0 / 2573655959.0, 188748653015.0 / 527762886.0,
- 2545485458115234375.0 / 27252038150535163.0, -1376953125.0 / 36759604.0,
- 53995596795.0 / 518691437.0, 210311225.0 / 7047894.0,
- -1718875.0 / 39484.0, 58000000.0 / 602131.0,
- -1546875.0 / 39484.0, -1262172375.0 / 8429834.0}
-
- };
-
- /** Serializable version identifier */
- private static final long serialVersionUID = 7152276390558450974L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java Sun Sep 6 15:32:50 2009
@@ -67,6 +67,33 @@
public abstract class EmbeddedRungeKuttaIntegrator
extends AdaptiveStepsizeIntegrator {
+ /** Indicator for <i>fsal</i> methods. */
+ private final boolean fsal;
+
+ /** Time steps from Butcher array (without the first zero). */
+ private final double[] c;
+
+ /** Internal weights from Butcher array (without the first empty row). */
+ private final double[][] a;
+
+ /** External weights for the high order method from Butcher array. */
+ private final double[] b;
+
+ /** Prototype of the step interpolator. */
+ private final RungeKuttaStepInterpolator prototype;
+
+ /** Stepsize control exponent. */
+ private final double exp;
+
+ /** Safety factor for stepsize control. */
+ private double safety;
+
+ /** Minimal reduction factor for stepsize control. */
+ private double minReduction;
+
+ /** Maximal growth factor for stepsize control. */
+ private double maxGrowth;
+
/** Build a Runge-Kutta integrator with the given Butcher array.
* @param name name of the method
* @param fsal indicate that the method is an <i>fsal</i>
@@ -372,31 +399,4 @@
double[] y0, double[] y1,
double h);
- /** Indicator for <i>fsal</i> methods. */
- private boolean fsal;
-
- /** Time steps from Butcher array (without the first zero). */
- private double[] c;
-
- /** Internal weights from Butcher array (without the first empty row). */
- private double[][] a;
-
- /** External weights for the high order method from Butcher array. */
- private double[] b;
-
- /** Prototype of the step interpolator. */
- private RungeKuttaStepInterpolator prototype;
-
- /** Stepsize control exponent. */
- private double exp;
-
- /** Safety factor for stepsize control. */
- private double safety;
-
- /** Minimal reduction factor for stepsize control. */
- private double minReduction;
-
- /** Maximal growth factor for stepsize control. */
- private double maxGrowth;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -47,6 +47,15 @@
class GillStepInterpolator
extends RungeKuttaStepInterpolator {
+ /** First Gill coefficient. */
+ private static final double TWO_MINUS_SQRT_2 = 2 - Math.sqrt(2.0);
+
+ /** Second Gill coefficient. */
+ private static final double TWO_PLUS_SQRT_2 = 2 + Math.sqrt(2.0);
+
+ /** Serializable version identifier */
+ private static final long serialVersionUID = -107804074496313322L;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link
@@ -112,13 +121,4 @@
}
- /** First Gill coefficient. */
- private static final double TWO_MINUS_SQRT_2 = 2 - Math.sqrt(2.0);
-
- /** Second Gill coefficient. */
- private static final double TWO_PLUS_SQRT_2 = 2 + Math.sqrt(2.0);
-
- /** Serializable version identifier */
- private static final long serialVersionUID = -107804074496313322L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java Sun Sep 6 15:32:50 2009
@@ -93,8 +93,65 @@
public class GraggBulirschStoerIntegrator extends AdaptiveStepsizeIntegrator {
- /** Integrator method name. */
- private static final String METHOD_NAME = "Gragg-Bulirsch-Stoer";
+ /** Integrator method name. */
+ private static final String METHOD_NAME = "Gragg-Bulirsch-Stoer";
+
+ /** maximal order. */
+ private int maxOrder;
+
+ /** step size sequence. */
+ private int[] sequence;
+
+ /** overall cost of applying step reduction up to iteration k+1, in number of calls. */
+ private int[] costPerStep;
+
+ /** cost per unit step. */
+ private double[] costPerTimeUnit;
+
+ /** optimal steps for each order. */
+ private double[] optimalStep;
+
+ /** extrapolation coefficients. */
+ private double[][] coeff;
+
+ /** stability check enabling parameter. */
+ private boolean performTest;
+
+ /** maximal number of checks for each iteration. */
+ private int maxChecks;
+
+ /** maximal number of iterations for which checks are performed. */
+ private int maxIter;
+
+ /** stepsize reduction factor in case of stability check failure. */
+ private double stabilityReduction;
+
+ /** first stepsize control factor. */
+ private double stepControl1;
+
+ /** second stepsize control factor. */
+ private double stepControl2;
+
+ /** third stepsize control factor. */
+ private double stepControl3;
+
+ /** fourth stepsize control factor. */
+ private double stepControl4;
+
+ /** first order control factor. */
+ private double orderControl1;
+
+ /** second order control factor. */
+ private double orderControl2;
+
+ /** dense outpute required. */
+ private boolean denseOutput;
+
+ /** use interpolation error in stepsize control. */
+ private boolean useInterpolationError;
+
+ /** interpolation order control parameter. */
+ private int mudif;
/** Simple constructor.
* Build a Gragg-Bulirsch-Stoer integrator with the given step
@@ -941,63 +998,4 @@
}
- /** maximal order. */
- private int maxOrder;
-
- /** step size sequence. */
- private int[] sequence;
-
- /** overall cost of applying step reduction up to iteration k+1,
- * in number of calls.
- */
- private int[] costPerStep;
-
- /** cost per unit step. */
- private double[] costPerTimeUnit;
-
- /** optimal steps for each order. */
- private double[] optimalStep;
-
- /** extrapolation coefficients. */
- private double[][] coeff;
-
- /** stability check enabling parameter. */
- private boolean performTest;
-
- /** maximal number of checks for each iteration. */
- private int maxChecks;
-
- /** maximal number of iterations for which checks are performed. */
- private int maxIter;
-
- /** stepsize reduction factor in case of stability check failure. */
- private double stabilityReduction;
-
- /** first stepsize control factor. */
- private double stepControl1;
-
- /** second stepsize control factor. */
- private double stepControl2;
-
- /** third stepsize control factor. */
- private double stepControl3;
-
- /** fourth stepsize control factor. */
- private double stepControl4;
-
- /** first order control factor. */
- private double orderControl1;
-
- /** second order control factor. */
- private double orderControl2;
-
- /** dense outpute required. */
- private boolean denseOutput;
-
- /** use interpolation error in stepsize control. */
- private boolean useInterpolationError;
-
- /** interpolation order control parameter. */
- private int mudif;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -77,75 +77,31 @@
class GraggBulirschStoerStepInterpolator
extends AbstractStepInterpolator {
- /** Slope at the beginning of the step. */
- private double[] y0Dot;
+ /** Serializable version identifier. */
+ private static final long serialVersionUID = 7320613236731409847L;
- /** State at the end of the step. */
- private double[] y1;
+ /** Slope at the beginning of the step. */
+ private double[] y0Dot;
- /** Slope at the end of the step. */
- private double[] y1Dot;
+ /** State at the end of the step. */
+ private double[] y1;
- /** Derivatives at the middle of the step.
- * element 0 is state at midpoint, element 1 is first derivative ...
- */
- private double[][] yMidDots;
-
- /** Interpolation polynoms. */
- private double[][] polynoms;
-
- /** Error coefficients for the interpolation. */
- private double[] errfac;
-
- /** Degree of the interpolation polynoms. */
- private int currentDegree;
-
- /** Reallocate the internal tables.
- * Reallocate the internal tables in order to be able to handle
- * interpolation polynoms up to the given degree
- * @param maxDegree maximal degree to handle
- */
- private void resetTables(final int maxDegree) {
-
- if (maxDegree < 0) {
- polynoms = null;
- errfac = null;
- currentDegree = -1;
- } else {
-
- final double[][] newPols = new double[maxDegree + 1][];
- if (polynoms != null) {
- System.arraycopy(polynoms, 0, newPols, 0, polynoms.length);
- for (int i = polynoms.length; i < newPols.length; ++i) {
- newPols[i] = new double[currentState.length];
- }
- } else {
- for (int i = 0; i < newPols.length; ++i) {
- newPols[i] = new double[currentState.length];
- }
- }
- polynoms = newPols;
+ /** Slope at the end of the step. */
+ private double[] y1Dot;
- // initialize the error factors array for interpolation
- if (maxDegree <= 4) {
- errfac = null;
- } else {
- errfac = new double[maxDegree - 4];
- for (int i = 0; i < errfac.length; ++i) {
- final int ip5 = i + 5;
- errfac[i] = 1.0 / (ip5 * ip5);
- final double e = 0.5 * Math.sqrt (((double) (i + 1)) / ip5);
- for (int j = 0; j <= i; ++j) {
- errfac[i] *= e / (j + 1);
- }
- }
- }
+ /** Derivatives at the middle of the step.
+ * element 0 is state at midpoint, element 1 is first derivative ...
+ */
+ private double[][] yMidDots;
- currentDegree = 0;
+ /** Interpolation polynoms. */
+ private double[][] polynoms;
- }
+ /** Error coefficients for the interpolation. */
+ private double[] errfac;
- }
+ /** Degree of the interpolation polynoms. */
+ private int currentDegree;
/** Simple constructor.
* This constructor should not be used directly, it is only intended
@@ -221,6 +177,53 @@
}
+ /** Reallocate the internal tables.
+ * Reallocate the internal tables in order to be able to handle
+ * interpolation polynoms up to the given degree
+ * @param maxDegree maximal degree to handle
+ */
+ private void resetTables(final int maxDegree) {
+
+ if (maxDegree < 0) {
+ polynoms = null;
+ errfac = null;
+ currentDegree = -1;
+ } else {
+
+ final double[][] newPols = new double[maxDegree + 1][];
+ if (polynoms != null) {
+ System.arraycopy(polynoms, 0, newPols, 0, polynoms.length);
+ for (int i = polynoms.length; i < newPols.length; ++i) {
+ newPols[i] = new double[currentState.length];
+ }
+ } else {
+ for (int i = 0; i < newPols.length; ++i) {
+ newPols[i] = new double[currentState.length];
+ }
+ }
+ polynoms = newPols;
+
+ // initialize the error factors array for interpolation
+ if (maxDegree <= 4) {
+ errfac = null;
+ } else {
+ errfac = new double[maxDegree - 4];
+ for (int i = 0; i < errfac.length; ++i) {
+ final int ip5 = i + 5;
+ errfac[i] = 1.0 / (ip5 * ip5);
+ final double e = 0.5 * Math.sqrt (((double) (i + 1)) / ip5);
+ for (int j = 0; j <= i; ++j) {
+ errfac[i] *= e / (j + 1);
+ }
+ }
+ }
+
+ currentDegree = 0;
+
+ }
+
+ }
+
/** {@inheritDoc} */
@Override
protected StepInterpolator doCopy() {
@@ -396,7 +399,4 @@
}
- /** Serializable version identifier */
- private static final long serialVersionUID = 7320613236731409847L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -33,6 +33,9 @@
class HighamHall54StepInterpolator
extends RungeKuttaStepInterpolator {
+ /** Serializable version identifier */
+ private static final long serialVersionUID = -3583240427587318654L;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link
@@ -97,7 +100,4 @@
}
- /** Serializable version identifier */
- private static final long serialVersionUID = -3583240427587318654L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -44,6 +44,9 @@
class MidpointStepInterpolator
extends RungeKuttaStepInterpolator {
+ /** Serializable version identifier */
+ private static final long serialVersionUID = -865524111506042509L;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link
@@ -94,7 +97,4 @@
}
- /** Serializable version identifier */
- private static final long serialVersionUID = -865524111506042509L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java Sun Sep 6 15:32:50 2009
@@ -54,6 +54,21 @@
public abstract class RungeKuttaIntegrator extends AbstractIntegrator {
+ /** Time steps from Butcher array (without the first zero). */
+ private final double[] c;
+
+ /** Internal weights from Butcher array (without the first empty row). */
+ private final double[][] a;
+
+ /** External weights for the high order method from Butcher array. */
+ private final double[] b;
+
+ /** Prototype of the step interpolator. */
+ private final RungeKuttaStepInterpolator prototype;
+
+ /** Integration step. */
+ private final double step;
+
/** Simple constructor.
* Build a Runge-Kutta integrator with the given
* step. The default step handler does nothing.
@@ -200,19 +215,4 @@
}
- /** Time steps from Butcher array (without the first zero). */
- private double[] c;
-
- /** Internal weights from Butcher array (without the first empty row). */
- private double[][] a;
-
- /** External weights for the high order method from Butcher array. */
- private double[] b;
-
- /** Prototype of the step interpolator. */
- private RungeKuttaStepInterpolator prototype;
-
- /** Integration step. */
- private double step;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -37,6 +37,12 @@
abstract class RungeKuttaStepInterpolator
extends AbstractStepInterpolator {
+ /** Slopes at the intermediate points */
+ protected double[][] yDotK;
+
+ /** Reference to the integrator. */
+ protected AbstractIntegrator integrator;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link #reinitialize} method should be called before using the
@@ -174,10 +180,4 @@
}
- /** Slopes at the intermediate points */
- protected double[][] yDotK;
-
- /** Reference to the integrator. */
- protected AbstractIntegrator integrator;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -49,6 +49,9 @@
class ThreeEighthesStepInterpolator
extends RungeKuttaStepInterpolator {
+ /** Serializable version identifier */
+ private static final long serialVersionUID = -3345024435978721931L;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link
@@ -110,7 +113,4 @@
}
- /** Serializable version identifier */
- private static final long serialVersionUID = -3345024435978721931L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepHandler.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepHandler.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepHandler.java Sun Sep 6 15:32:50 2009
@@ -17,7 +17,6 @@
package org.apache.commons.math.ode.sampling;
-
/**
* This class is a step handler that does nothing.
@@ -37,51 +36,66 @@
public class DummyStepHandler implements StepHandler {
- /** Private constructor.
- * The constructor is private to prevent users from creating
- * instances (Singleton design-pattern).
- */
- private DummyStepHandler() {
- }
-
- /** Get the only instance.
- * @return the only instance
- */
- public static DummyStepHandler getInstance() {
- return INSTANCE;
- }
-
- /** Determines whether this handler needs dense output.
- * Since this handler does nothing, it does not require dense output.
- * @return always false
- */
- public boolean requiresDenseOutput() {
- return false;
- }
-
- /** Reset the step handler.
- * Initialize the internal data as required before the first step is
- * handled.
- */
- public void reset() {
- }
-
- /**
- * Handle the last accepted step.
- * This method does nothing in this class.
- * @param interpolator interpolator for the last accepted step. For
- * efficiency purposes, the various integrators reuse the same
- * object on each call, so if the instance wants to keep it across
- * all calls (for example to provide at the end of the integration a
- * continuous model valid throughout the integration range), it
- * should build a local copy using the clone method and store this
- * copy.
- * @param isLast true if the step is the last one
- */
- public void handleStep(final StepInterpolator interpolator, final boolean isLast) {
- }
-
- /** The only instance. */
- private static final DummyStepHandler INSTANCE = new DummyStepHandler();
+ /** Private constructor.
+ * The constructor is private to prevent users from creating
+ * instances (Singleton design-pattern).
+ */
+ private DummyStepHandler() {
+ }
+
+ /** Get the only instance.
+ * @return the only instance
+ */
+ public static DummyStepHandler getInstance() {
+ return LazyHolder.INSTANCE;
+ }
+
+ /** Determines whether this handler needs dense output.
+ * Since this handler does nothing, it does not require dense output.
+ * @return always false
+ */
+ public boolean requiresDenseOutput() {
+ return false;
+ }
+
+ /** Reset the step handler.
+ * Initialize the internal data as required before the first step is
+ * handled.
+ */
+ public void reset() {
+ }
+
+ /**
+ * Handle the last accepted step.
+ * This method does nothing in this class.
+ * @param interpolator interpolator for the last accepted step. For
+ * efficiency purposes, the various integrators reuse the same
+ * object on each call, so if the instance wants to keep it across
+ * all calls (for example to provide at the end of the integration a
+ * continuous model valid throughout the integration range), it
+ * should build a local copy using the clone method and store this
+ * copy.
+ * @param isLast true if the step is the last one
+ */
+ public void handleStep(final StepInterpolator interpolator, final boolean isLast) {
+ }
+
+ // CHECKSTYLE: stop HideUtilityClassConstructor
+ /** Holder for the instance.
+ * <p>We use here the Initialization On Demand Holder Idiom.</p>
+ */
+ private static class LazyHolder {
+ /** Cached field instance. */
+ private static final DummyStepHandler INSTANCE = new DummyStepHandler();
+ }
+ // CHECKSTYLE: resume HideUtilityClassConstructor
+
+ /** Handle deserialization of the singleton.
+ * @return the singleton instance
+ */
+ private Object readResolve() {
+ // return the singleton instance
+ return LazyHolder.INSTANCE;
+ }
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -40,6 +40,9 @@
public class DummyStepInterpolator
extends AbstractStepInterpolator {
+ /** Serializable version identifier */
+ private static final long serialVersionUID = 1708010296707839488L;
+
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* <code>AbstractStepInterpolator.reinitialize</code> protected method
@@ -123,7 +126,4 @@
}
- /** Serializable version identifier */
- private static final long serialVersionUID = 1708010296707839488L;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java Sun Sep 6 15:32:50 2009
@@ -42,6 +42,9 @@
/** Serializable version identifier */
private static final long serialVersionUID = -7179861704951334960L;
+ /** State variation. */
+ protected double[] stateVariation;
+
/** Step size used in the first scaled derivative and Nordsieck vector. */
private double scalingH;
@@ -59,9 +62,6 @@
/** Nordsieck vector. */
private Array2DRowRealMatrix nordsieck;
- /** State variation. */
- protected double[] stateVariation;
-
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link AbstractStepInterpolator#reinitialize} method should be called
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java Sun Sep 6 15:32:50 2009
@@ -45,21 +45,6 @@
/** Default maximal number of iterations allowed. */
public static final int DEFAULT_MAX_ITERATIONS = 100;
- /** Maximal number of iterations allowed. */
- private int maxIterations;
-
- /** Number of iterations already performed. */
- private int iterations;
-
- /** Maximal number of evaluations allowed. */
- private int maxEvaluations;
-
- /** Number of evaluations already performed. */
- private int objectiveEvaluations;
-
- /** Number of jacobian evaluations. */
- private int jacobianEvaluations;
-
/** Convergence checker. */
protected VectorialConvergenceChecker checker;
@@ -78,12 +63,6 @@
/** Number of rows of the jacobian matrix. */
protected int rows;
- /** Objective function. */
- private DifferentiableMultivariateVectorialFunction function;
-
- /** Objective function derivatives. */
- private MultivariateMatrixFunction jF;
-
/** Target value for the objective functions at optimum. */
protected double[] targetValues;
@@ -102,6 +81,27 @@
/** Cost value (square root of the sum of the residuals). */
protected double cost;
+ /** Maximal number of iterations allowed. */
+ private int maxIterations;
+
+ /** Number of iterations already performed. */
+ private int iterations;
+
+ /** Maximal number of evaluations allowed. */
+ private int maxEvaluations;
+
+ /** Number of evaluations already performed. */
+ private int objectiveEvaluations;
+
+ /** Number of jacobian evaluations. */
+ private int jacobianEvaluations;
+
+ /** Objective function. */
+ private DifferentiableMultivariateVectorialFunction function;
+
+ /** Objective function derivatives. */
+ private MultivariateMatrixFunction jF;
+
/** Simple constructor with default settings.
* <p>The convergence check is set to a {@link SimpleVectorialValueChecker}
* and the maximal number of evaluation is set to its default value.</p>
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java Sun Sep 6 15:32:50 2009
@@ -42,6 +42,15 @@
/** Default maximal number of iterations allowed. */
public static final int DEFAULT_MAX_ITERATIONS = 100;
+ /** Convergence checker. */
+ protected RealConvergenceChecker checker;
+
+ /** Type of optimization. */
+ protected GoalType goal;
+
+ /** Current point set. */
+ protected double[] point;
+
/** Maximal number of iterations allowed. */
private int maxIterations;
@@ -57,21 +66,12 @@
/** Number of gradient evaluations. */
private int gradientEvaluations;
- /** Convergence checker. */
- protected RealConvergenceChecker checker;
-
/** Objective function. */
private DifferentiableMultivariateRealFunction function;
/** Objective function gradient. */
private MultivariateVectorialFunction gradient;
- /** Type of optimization. */
- protected GoalType goal;
-
- /** Current point set. */
- protected double[] point;
-
/** Simple constructor with default settings.
* <p>The convergence check is set to a {@link SimpleScalarValueChecker}
* and the maximal number of evaluation is set to its default value.</p>
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java Sun Sep 6 15:32:50 2009
@@ -37,12 +37,6 @@
/** Default maximal number of iterations allowed. */
public static final int DEFAULT_MAX_ITERATIONS = 100;
- /** Maximal number of iterations allowed. */
- private int maxIterations;
-
- /** Number of iterations already performed. */
- private int iterations;
-
/** Linear objective function. */
protected LinearObjectiveFunction function;
@@ -55,6 +49,12 @@
/** Whether to restrict the variables to non-negative values. */
protected boolean nonNegative;
+ /** Maximal number of iterations allowed. */
+ private int maxIterations;
+
+ /** Number of iterations already performed. */
+ private int iterations;
+
/** Simple constructor with default settings.
* <p>The maximal number of evaluation is set to its default value.</p>
*/
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java Sun Sep 6 15:32:50 2009
@@ -75,19 +75,19 @@
private final boolean restrictToNonNegative;
/** Simple tableau. */
- protected transient RealMatrix tableau;
+ private transient RealMatrix tableau;
/** Number of decision variables. */
- protected final int numDecisionVariables;
+ private final int numDecisionVariables;
/** Number of slack variables. */
- protected final int numSlackVariables;
+ private final int numSlackVariables;
/** Number of artificial variables. */
- protected int numArtificialVariables;
+ private int numArtificialVariables;
/** Amount of error to accept in floating point comparisons. */
- protected final double epsilon;
+ private final double epsilon;
/**
* Build a tableau for a linear problem.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java Sun Sep 6 15:32:50 2009
@@ -62,6 +62,21 @@
public class CorrelatedRandomVectorGenerator
implements RandomVectorGenerator {
+ /** Mean vector. */
+ private final double[] mean;
+
+ /** Underlying generator. */
+ private final NormalizedRandomGenerator generator;
+
+ /** Storage for the normalized vector. */
+ private final double[] normalized;
+
+ /** Permutated Cholesky root of the covariance matrix. */
+ private RealMatrix root;
+
+ /** Rank of the covariance matrix. */
+ private int rank;
+
/** Simple constructor.
* <p>Build a correlated random vector generator from its mean
* vector and covariance matrix.</p>
@@ -285,19 +300,4 @@
}
- /** Mean vector. */
- private double[] mean;
-
- /** Permutated Cholesky root of the covariance matrix. */
- private RealMatrix root;
-
- /** Rank of the covariance matrix. */
- private int rank;
-
- /** Underlying generator. */
- private NormalizedRandomGenerator generator;
-
- /** Storage for the normalized vector. */
- private double[] normalized;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/GaussianRandomGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/GaussianRandomGenerator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/GaussianRandomGenerator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/GaussianRandomGenerator.java Sun Sep 6 15:32:50 2009
@@ -27,10 +27,13 @@
public class GaussianRandomGenerator implements NormalizedRandomGenerator {
+ /** Underlying generator. */
+ private final RandomGenerator generator;
+
/** Create a new generator.
* @param generator underlying random generator to use
*/
- public GaussianRandomGenerator(RandomGenerator generator) {
+ public GaussianRandomGenerator(final RandomGenerator generator) {
this.generator = generator;
}
@@ -41,7 +44,4 @@
return generator.nextGaussian();
}
- /** Underlying generator. */
- private RandomGenerator generator;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java Sun Sep 6 15:32:50 2009
@@ -33,6 +33,15 @@
public class UncorrelatedRandomVectorGenerator
implements RandomVectorGenerator {
+ /** Underlying scalar generator. */
+ private final NormalizedRandomGenerator generator;
+
+ /** Mean vector. */
+ private final double[] mean;
+
+ /** Standard deviation vector. */
+ private final double[] standardDeviation;
+
/** Simple constructor.
* <p>Build an uncorrelated random vector generator from
* its mean and standard deviation vectors.</p>
@@ -83,13 +92,4 @@
}
- /** Mean vector. */
- private double[] mean;
-
- /** Standard deviation vector. */
- private double[] standardDeviation;
-
- /** Underlying scalar generator. */
- private NormalizedRandomGenerator generator;
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UniformRandomGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UniformRandomGenerator.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UniformRandomGenerator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UniformRandomGenerator.java Sun Sep 6 15:32:50 2009
@@ -34,6 +34,12 @@
/** Serializable version identifier. */
private static final long serialVersionUID = 1569292426375546027L;
+ /** Square root of three. */
+ private static final double SQRT3 = Math.sqrt(3.0);
+
+ /** Underlying generator. */
+ private final RandomGenerator generator;
+
/** Create a new generator.
* @param generator underlying random generator to use
*/
@@ -50,10 +56,4 @@
return SQRT3 * (2 * generator.nextDouble() - 1.0);
}
- /** Underlying generator. */
- private RandomGenerator generator;
-
- /** Square root of three. */
- private static final double SQRT3 = Math.sqrt(3.0);
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/ValueServer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/ValueServer.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/ValueServer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/ValueServer.java Sun Sep 6 15:32:50 2009
@@ -46,52 +46,64 @@
*
*/
public class ValueServer {
- /** mode determines how values are generated */
+
+ /** Use empirical distribution. */
+ public static final int DIGEST_MODE = 0;
+
+ /** Replay data from valuesFilePath. */
+ public static final int REPLAY_MODE = 1;
+
+ /** Uniform random deviates with mean = μ. */
+ public static final int UNIFORM_MODE = 2;
+
+ /** Exponential random deviates with mean = μ. */
+ public static final int EXPONENTIAL_MODE = 3;
+
+ /** Gaussian random deviates with mean = μ, std dev = σ. */
+ public static final int GAUSSIAN_MODE = 4;
+
+ /** Always return mu */
+ public static final int CONSTANT_MODE = 5;
+
+ /** mode determines how values are generated. */
private int mode = 5;
- /** URI to raw data values */
+ /** URI to raw data values. */
private URL valuesFileURL = null;
- /** Mean for use with non-data-driven modes */
+ /** Mean for use with non-data-driven modes. */
private double mu = 0.0;
- /** Standard deviation for use with GAUSSIAN_MODE */
+ /** Standard deviation for use with GAUSSIAN_MODE. */
private double sigma = 0.0;
- /** Empirical probability distribution for use with DIGEST_MODE */
+ /** Empirical probability distribution for use with DIGEST_MODE. */
private EmpiricalDistribution empiricalDistribution = null;
- /** file pointer for REPLAY_MODE */
+ /** File pointer for REPLAY_MODE. */
private BufferedReader filePointer = null;
- /** RandomDataImpl to use for random data generation */
+ /** RandomDataImpl to use for random data generation. */
private RandomData randomData = new RandomDataImpl();
// Data generation modes ======================================
- /** Use empirical distribution */
- public static final int DIGEST_MODE = 0;
-
- /** Replay data from valuesFilePath */
- public static final int REPLAY_MODE = 1;
-
- /** Uniform random deviates with mean = mu */
- public static final int UNIFORM_MODE = 2;
-
- /** Exponential random deviates with mean = mu */
- public static final int EXPONENTIAL_MODE = 3;
-
- /** Gaussian random deviates with mean = mu, std dev = sigma */
- public static final int GAUSSIAN_MODE = 4;
-
- /** Always return mu */
- public static final int CONSTANT_MODE = 5;
-
/** Creates new ValueServer */
public ValueServer() {
}
/**
+ * Construct a ValueServer instance using a RandomData as its source
+ * of random data.
+ *
+ * @param randomData the RandomData instance used to source random data
+ * @since 1.1
+ */
+ public ValueServer(RandomData randomData) {
+ this.randomData = randomData;
+ }
+
+ /**
* Returns the next generated value, generated according
* to the mode value (see MODE constants).
*
@@ -369,15 +381,4 @@
return randomData.nextGaussian(mu, sigma);
}
- /**
- * Construct a ValueServer instance using a RandomData as its source
- * of random data.
- *
- * @param randomData the RandomData instance used to source random data
- * @since 1.1
- */
- public ValueServer(RandomData randomData) {
- super();
- this.randomData = randomData;
- }
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java Sun Sep 6 15:32:50 2009
@@ -60,6 +60,12 @@
/** Avoid repeated computation of log of 2 PI in logGamma */
private static final double HALF_LOG_2_PI = 0.5 * Math.log(2.0 * Math.PI);
+ // limits for switching algorithm in digamma
+ /** C limit. */
+ private static final double C_LIMIT = 49;
+
+ /** S limit. */
+ private static final double S_LIMIT = 1e-5;
/**
* Default constructor. Prohibit instantiation.
@@ -262,12 +268,6 @@
}
- // limits for switching algorithm in digamma
- /** C limit */
- private static final double C_LIMIT = 49;
- /** S limit */
- private static final double S_LIMIT = 1e-5;
-
/**
* <p>Computes the digamma function of x.</p>
*
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java Sun Sep 6 15:32:50 2009
@@ -55,6 +55,13 @@
*/
public class DescriptiveStatistics implements StatisticalSummary, Serializable {
+ /**
+ * Represents an infinite window size. When the {@link #getWindowSize()}
+ * returns this value, there is no limit to the number of data values
+ * that can be stored in the dataset.
+ */
+ public static final int INFINITE_WINDOW = -1;
+
/** Serialization UID */
private static final long serialVersionUID = 4133067267405273064L;
@@ -122,13 +129,6 @@
}
/**
- * Represents an infinite window size. When the {@link #getWindowSize()}
- * returns this value, there is no limit to the number of data values
- * that can be stored in the dataset.
- */
- public static final int INFINITE_WINDOW = -1;
-
- /**
* Adds the value to the dataset. If the dataset is at the maximum size
* (i.e., the number of stored elements equals the currently configured
* windowSize), the first (oldest) element in the dataset is discarded
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java Sun Sep 6 15:32:50 2009
@@ -71,6 +71,36 @@
/** Serialization UID */
private static final long serialVersionUID = 2271900808994826718L;
+ /** Dimension of the data. */
+ private int k;
+
+ /** Count of values that have been added */
+ private long n = 0;
+
+ /** Sum statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] sumImpl;
+
+ /** Sum of squares statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] sumSqImpl;
+
+ /** Minimum statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] minImpl;
+
+ /** Maximum statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] maxImpl;
+
+ /** Sum of log statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] sumLogImpl;
+
+ /** Geometric mean statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] geoMeanImpl;
+
+ /** Mean statistic implementation - can be reset by setter. */
+ private StorelessUnivariateStatistic[] meanImpl;
+
+ /** Covariance statistic implementation - cannot be reset. */
+ private VectorialCovariance covarianceImpl;
+
/**
* Construct a MultivariateSummaryStatistics instance
* @param k dimension of the data
@@ -104,36 +134,6 @@
}
- /** Dimension of the data. */
- private int k;
-
- /** Count of values that have been added */
- private long n = 0;
-
- /** Sum statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] sumImpl;
-
- /** Sum of squares statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] sumSqImpl;
-
- /** Minimum statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] minImpl;
-
- /** Maximum statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] maxImpl;
-
- /** Sum of log statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] sumLogImpl;
-
- /** Geometric mean statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] geoMeanImpl;
-
- /** Mean statistic implementation - can be reset by setter. */
- private StorelessUnivariateStatistic[] meanImpl;
-
- /** Covariance statistic implementation - cannot be reset. */
- private VectorialCovariance covarianceImpl;
-
/**
* Add an n-tuple to the data
*
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java Sun Sep 6 15:32:50 2009
@@ -59,21 +59,6 @@
/** Serialization UID */
private static final long serialVersionUID = -2021321786743555871L;
- /**
- * Construct a SummaryStatistics instance
- */
- public SummaryStatistics() {
- }
-
- /**
- * A copy constructor. Creates a deep-copy of the {@code original}.
- *
- * @param original the {@code SummaryStatistics} instance to copy
- */
- public SummaryStatistics(SummaryStatistics original) {
- copy(original, this);
- }
-
/** count of values that have been added */
protected long n = 0;
@@ -129,6 +114,21 @@
private StorelessUnivariateStatistic varianceImpl = variance;
/**
+ * Construct a SummaryStatistics instance
+ */
+ public SummaryStatistics() {
+ }
+
+ /**
+ * A copy constructor. Creates a deep-copy of the {@code original}.
+ *
+ * @param original the {@code SummaryStatistics} instance to copy
+ */
+ public SummaryStatistics(SummaryStatistics original) {
+ copy(original, this);
+ }
+
+ /**
* Return a {@link StatisticalSummaryValues} instance reporting current
* statistics.
* @return Current values of statistics
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java Sun Sep 6 15:32:50 2009
@@ -74,6 +74,14 @@
}
/**
+ * Create a GeometricMean instance using the given SumOfLogs instance
+ * @param sumOfLogs sum of logs instance to use for computation
+ */
+ public GeometricMean(SumOfLogs sumOfLogs) {
+ this.sumOfLogs = sumOfLogs;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
@@ -84,14 +92,6 @@
}
/**
- * Create a GeometricMean instance using the given SumOfLogs instance
- * @param sumOfLogs sum of logs instance to use for computation
- */
- public GeometricMean(SumOfLogs sumOfLogs) {
- this.sumOfLogs = sumOfLogs;
- }
-
- /**
* {@inheritDoc}
*/
@Override
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/TestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/TestUtils.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/TestUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/TestUtils.java Sun Sep 6 15:32:50 2009
@@ -28,12 +28,6 @@
* @version $Revision$ $Date$
*/
public class TestUtils {
- /**
- * Prevent instantiation.
- */
- protected TestUtils() {
- super();
- }
/** Singleton TTest instance using default implementation. */
private static TTest tTest = new TTestImpl();
@@ -51,6 +45,13 @@
new OneWayAnovaImpl();
/**
+ * Prevent instantiation.
+ */
+ protected TestUtils() {
+ super();
+ }
+
+ /**
* Set the (singleton) TTest instance.
*
* @param chiSquareTest the new instance to use
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java Sun Sep 6 15:32:50 2009
@@ -69,6 +69,12 @@
*/
public class NaturalRanking implements RankingAlgorithm {
+ /** default NaN strategy */
+ public static final NaNStrategy DEFAULT_NAN_STRATEGY = NaNStrategy.MAXIMAL;
+
+ /** default ties strategy */
+ public static final TiesStrategy DEFAULT_TIES_STRATEGY = TiesStrategy.AVERAGE;
+
/** NaN strategy - defaults to NaNs maximal */
private final NaNStrategy nanStrategy;
@@ -78,12 +84,6 @@
/** Source of random data - used only when ties strategy is RANDOM */
private final RandomData randomData;
- /** default NaN strategy */
- public static final NaNStrategy DEFAULT_NAN_STRATEGY = NaNStrategy.MAXIMAL;
-
- /** default ties strategy */
- public static final TiesStrategy DEFAULT_TIES_STRATEGY = TiesStrategy.AVERAGE;
-
/**
* Create a NaturalRanking with default strategies for handling ties and NaNs.
*/
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigReal.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigReal.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigReal.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigReal.java Sun Sep 6 15:32:50 2009
@@ -36,15 +36,15 @@
*/
public class BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Serializable {
- /** Serializable version identifier. */
- private static final long serialVersionUID = 7887631840434052850L;
-
/** A big real representing 0. */
public static final BigReal ZERO = new BigReal(BigDecimal.ZERO);
/** A big real representing 1. */
public static final BigReal ONE = new BigReal(BigDecimal.ONE);
+ /** Serializable version identifier. */
+ private static final long serialVersionUID = 7887631840434052850L;
+
/** Underlying BigDecimal. */
private final BigDecimal d;
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigRealField.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigRealField.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigRealField.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/BigRealField.java Sun Sep 6 15:32:50 2009
@@ -57,19 +57,15 @@
return BigReal.ZERO;
}
+ // CHECKSTYLE: stop HideUtilityClassConstructor
/** Holder for the instance.
* <p>We use here the Initialization On Demand Holder Idiom.</p>
*/
private static class LazyHolder {
-
- /** Private constructor. */
- private LazyHolder() {
- }
-
/** Cached field instance. */
private static final BigRealField INSTANCE = new BigRealField();
-
}
+ // CHECKSTYLE: resume HideUtilityClassConstructor
/** Handle deserialization of the singleton.
* @return the singleton instance
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java Sun Sep 6 15:32:50 2009
@@ -65,6 +65,16 @@
/** Offset to order signed double numbers lexicographically. */
private static final long SGN_MASK = 0x8000000000000000L;
+ /** All long-representable factorials */
+ private static final long[] FACTORIALS = new long[] {
+ 1l, 1l, 2l,
+ 6l, 24l, 120l,
+ 720l, 5040l, 40320l,
+ 362880l, 3628800l, 39916800l,
+ 479001600l, 6227020800l, 87178291200l,
+ 1307674368000l, 20922789888000l, 355687428096000l,
+ 6402373705728000l, 121645100408832000l, 2432902008176640000l };
+
/**
* Private Constructor
*/
@@ -469,13 +479,6 @@
return true;
}
- /** All long-representable factorials */
- private static final long[] FACTORIALS = new long[]
- {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800,
- 479001600, 6227020800l, 87178291200l, 1307674368000l, 20922789888000l,
- 355687428096000l, 6402373705728000l, 121645100408832000l,
- 2432902008176640000l};
-
/**
* Returns n!. Shorthand for <code>n</code> <a
* href="http://mathworld.wolfram.com/Factorial.html"> Factorial</a>, the
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java Sun Sep 6 15:32:50 2009
@@ -38,6 +38,15 @@
*/
public class OpenIntToDoubleHashMap implements Serializable {
+ /** Status indicator for free table entries. */
+ protected static final byte FREE = 0;
+
+ /** Status indicator for full table entries. */
+ protected static final byte FULL = 1;
+
+ /** Status indicator for removed table entries. */
+ protected static final byte REMOVED = 2;
+
/** Serializable version identifier */
private static final long serialVersionUID = -3646337053166149105L;
@@ -57,15 +66,6 @@
/** Number of bits to perturb the index when probing for collision resolution. */
private static final int PERTURB_SHIFT = 5;
- /** Status indicator for free table entries. */
- protected static final byte FREE = 0;
-
- /** Status indicator for full table entries. */
- protected static final byte FULL = 1;
-
- /** Status indicator for removed table entries. */
- protected static final byte REMOVED = 2;
-
/** Keys table. */
private int[] keys;
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java Sun Sep 6 15:32:50 2009
@@ -41,6 +41,15 @@
*/
public class OpenIntToFieldHashMap<T extends FieldElement<T>> implements Serializable {
+ /** Status indicator for free table entries. */
+ protected static final byte FREE = 0;
+
+ /** Status indicator for full table entries. */
+ protected static final byte FULL = 1;
+
+ /** Status indicator for removed table entries. */
+ protected static final byte REMOVED = 2;
+
/** Serializable version identifier. */
private static final long serialVersionUID = -9179080286849120720L;
@@ -60,15 +69,6 @@
/** Number of bits to perturb the index when probing for collision resolution. */
private static final int PERTURB_SHIFT = 5;
- /** Status indicator for free table entries. */
- protected static final byte FREE = 0;
-
- /** Status indicator for full table entries. */
- protected static final byte FULL = 1;
-
- /** Status indicator for removed table entries. */
- protected static final byte REMOVED = 2;
-
/** Field to which the elements belong. */
private final Field<T> field;
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java?rev=811827&r1=811826&r2=811827&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java Sun Sep 6 15:32:50 2009
@@ -73,15 +73,15 @@
*/
public class ResizableDoubleArray implements DoubleArray, Serializable {
- /** Serializable version identifier */
- private static final long serialVersionUID = -3485529955529426875L;
-
/** additive expansion mode */
public static final int ADDITIVE_MODE = 1;
/** multiplicative expansion mode */
public static final int MULTIPLICATIVE_MODE = 0;
+ /** Serializable version identifier */
+ private static final long serialVersionUID = -3485529955529426875L;
+
/**
* The contraction criteria determines when the internal array will be
* contracted to fit the number of elements contained in the element