tighten rules for constants naming conventions
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@810196 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a3217e90b9
commit
0234e46518
|
@ -82,8 +82,10 @@
|
|||
<module name="FallThrough" />
|
||||
<module name="MissingSwitchDefault" />
|
||||
|
||||
<!--
|
||||
<!-- Constant names should obey the traditional all uppercase naming convention -->
|
||||
<module name="ConstantName" />
|
||||
|
||||
<!--
|
||||
<module name="HiddenField">
|
||||
<property name="ignoreConstructorParameter" value="true" />
|
||||
<property name="ignoreSetter" value="true" />
|
||||
|
@ -109,6 +111,11 @@
|
|||
<property name="onCommentFormat" value="CHECKSTYLE\: resume JavadocMethodCheck"/>
|
||||
<property name="checkFormat" value="JavadocMethodCheck"/>
|
||||
</module>
|
||||
<module name="SuppressionCommentFilter">
|
||||
<property name="offCommentFormat" value="CHECKSTYLE\: stop ConstantName"/>
|
||||
<property name="onCommentFormat" value="CHECKSTYLE\: resume ConstantName"/>
|
||||
<property name="checkFormat" value="ConstantName"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
|
|
|
@ -39,11 +39,11 @@ public class MessagesResources_fr
|
|||
*/
|
||||
@Override
|
||||
public Object[][] getContents() {
|
||||
return contents.clone();
|
||||
return CONTENTS.clone();
|
||||
}
|
||||
|
||||
/** Non-translated/translated messages arrays. */
|
||||
private static final Object[][] contents = {
|
||||
private static final Object[][] CONTENTS = {
|
||||
|
||||
// org.apache.commons.math.util.MathUtils
|
||||
{ "must have n >= k for binomial coefficient (n,k), got n = {0}, k = {1}",
|
||||
|
|
|
@ -50,9 +50,11 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
|||
|
||||
/** The square root of -1. A number representing "0.0 + 1.0i" */
|
||||
public static final Complex I = new Complex(0.0, 1.0);
|
||||
|
||||
|
||||
// CHECKSTYLE: stop ConstantName
|
||||
/** A complex number representing "NaN + NaNi" */
|
||||
public static final Complex NaN = new Complex(Double.NaN, Double.NaN);
|
||||
// CHECKSTYLE: resume ConstantName
|
||||
|
||||
/** A complex number representing "+INF + INFi" */
|
||||
public static final Complex INF = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
|
||||
|
|
|
@ -53,8 +53,10 @@ public class Vector3D
|
|||
/** Opposite of the third canonical vector (coordinates: 0, 0, -1). */
|
||||
public static final Vector3D MINUS_K = new Vector3D(0, 0, -1);
|
||||
|
||||
// CHECKSTYLE: stop ConstantName
|
||||
/** A vector with all coordinates set to NaN. */
|
||||
public static final Vector3D NaN = new Vector3D(Double.NaN, Double.NaN, Double.NaN);
|
||||
// CHECKSTYLE: resume ConstantName
|
||||
|
||||
/** A vector with all coordinates set to positive infinity. */
|
||||
public static final Vector3D POSITIVE_INFINITY =
|
||||
|
|
|
@ -133,7 +133,7 @@ import org.apache.commons.math.linear.MatrixUtils;
|
|||
public class AdamsNordsieckTransformer {
|
||||
|
||||
/** Cache for already computed coefficients. */
|
||||
private static final Map<Integer, AdamsNordsieckTransformer> cache =
|
||||
private static final Map<Integer, AdamsNordsieckTransformer> CACHE =
|
||||
new HashMap<Integer, AdamsNordsieckTransformer>();
|
||||
|
||||
/** Initialization matrix for the higher order derivatives wrt y'', y''' ... */
|
||||
|
@ -200,11 +200,11 @@ public class AdamsNordsieckTransformer {
|
|||
* @return Nordsieck transformer for the specified number of steps
|
||||
*/
|
||||
public static AdamsNordsieckTransformer getInstance(final int nSteps) {
|
||||
synchronized(cache) {
|
||||
AdamsNordsieckTransformer t = cache.get(nSteps);
|
||||
synchronized(CACHE) {
|
||||
AdamsNordsieckTransformer t = CACHE.get(nSteps);
|
||||
if (t == null) {
|
||||
t = new AdamsNordsieckTransformer(nSteps);
|
||||
cache.put(nSteps, t);
|
||||
CACHE.put(nSteps, t);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -46,19 +46,19 @@ package org.apache.commons.math.ode.nonstiff;
|
|||
public class ClassicalRungeKuttaIntegrator extends RungeKuttaIntegrator {
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] c = {
|
||||
private static final double[] STATIC_C = {
|
||||
1.0 / 2.0, 1.0 / 2.0, 1.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] a = {
|
||||
private static final double[][] STATIC_A = {
|
||||
{ 1.0 / 2.0 },
|
||||
{ 0.0, 1.0 / 2.0 },
|
||||
{ 0.0, 0.0, 1.0 }
|
||||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] b = {
|
||||
private static final double[] STATIC_B = {
|
||||
1.0 / 6.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 6.0
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class ClassicalRungeKuttaIntegrator extends RungeKuttaIntegrator {
|
|||
* @param step integration step
|
||||
*/
|
||||
public ClassicalRungeKuttaIntegrator(final double step) {
|
||||
super("classical Runge-Kutta", c, a, b,
|
||||
super("classical Runge-Kutta", STATIC_C, STATIC_A, STATIC_B,
|
||||
new ClassicalRungeKuttaStepInterpolator(), step);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ public class DormandPrince54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
private static final String METHOD_NAME = "Dormand-Prince 5(4)";
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] staticC = {
|
||||
private static final double[] STATIC_C = {
|
||||
1.0/5.0, 3.0/10.0, 4.0/5.0, 8.0/9.0, 1.0, 1.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] staticA = {
|
||||
private static final double[][] STATIC_A = {
|
||||
{1.0/5.0},
|
||||
{3.0/40.0, 9.0/40.0},
|
||||
{44.0/45.0, -56.0/15.0, 32.0/9.0},
|
||||
|
@ -65,29 +65,29 @@ public class DormandPrince54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] staticB = {
|
||||
private static final double[] STATIC_B = {
|
||||
35.0/384.0, 0.0, 500.0/1113.0, 125.0/192.0, -2187.0/6784.0, 11.0/84.0, 0.0
|
||||
};
|
||||
|
||||
/** Error array, element 1. */
|
||||
private static final double e1 = 71.0 / 57600.0;
|
||||
private static final double E1 = 71.0 / 57600.0;
|
||||
|
||||
// element 2 is zero, so it is neither stored nor used
|
||||
|
||||
/** Error array, element 3. */
|
||||
private static final double e3 = -71.0 / 16695.0;
|
||||
private static final double E3 = -71.0 / 16695.0;
|
||||
|
||||
/** Error array, element 4. */
|
||||
private static final double e4 = 71.0 / 1920.0;
|
||||
private static final double E4 = 71.0 / 1920.0;
|
||||
|
||||
/** Error array, element 5. */
|
||||
private static final double e5 = -17253.0 / 339200.0;
|
||||
private static final double E5 = -17253.0 / 339200.0;
|
||||
|
||||
/** Error array, element 6. */
|
||||
private static final double e6 = 22.0 / 525.0;
|
||||
private static final double E6 = 22.0 / 525.0;
|
||||
|
||||
/** Error array, element 7. */
|
||||
private static final double e7 = -1.0 / 40.0;
|
||||
private static final double E7 = -1.0 / 40.0;
|
||||
|
||||
/** Simple constructor.
|
||||
* Build a fifth order Dormand-Prince integrator with the given step bounds
|
||||
|
@ -101,7 +101,7 @@ public class DormandPrince54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
public DormandPrince54Integrator(final double minStep, final double maxStep,
|
||||
final double scalAbsoluteTolerance,
|
||||
final double scalRelativeTolerance) {
|
||||
super(METHOD_NAME, true, staticC, staticA, staticB, new DormandPrince54StepInterpolator(),
|
||||
super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B, new DormandPrince54StepInterpolator(),
|
||||
minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class DormandPrince54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
public DormandPrince54Integrator(final double minStep, final double maxStep,
|
||||
final double[] vecAbsoluteTolerance,
|
||||
final double[] vecRelativeTolerance) {
|
||||
super(METHOD_NAME, true, staticC, staticA, staticB, new DormandPrince54StepInterpolator(),
|
||||
super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B, new DormandPrince54StepInterpolator(),
|
||||
minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
|
||||
}
|
||||
|
||||
|
@ -136,9 +136,9 @@ public class DormandPrince54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
double error = 0;
|
||||
|
||||
for (int j = 0; j < y0.length; ++j) {
|
||||
final double errSum = e1 * yDotK[0][j] + e3 * yDotK[2][j] +
|
||||
e4 * yDotK[3][j] + e5 * yDotK[4][j] +
|
||||
e6 * yDotK[5][j] + e7 * yDotK[6][j];
|
||||
final double errSum = E1 * yDotK[0][j] + E3 * yDotK[2][j] +
|
||||
E4 * yDotK[3][j] + E5 * yDotK[4][j] +
|
||||
E6 * yDotK[5][j] + E7 * yDotK[6][j];
|
||||
|
||||
final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));
|
||||
final double tol = (vecAbsoluteTolerance == null) ?
|
||||
|
|
|
@ -132,10 +132,10 @@ class DormandPrince54StepInterpolator
|
|||
final double yDot4 = yDotK[4][i];
|
||||
final double yDot5 = yDotK[5][i];
|
||||
final double yDot6 = yDotK[6][i];
|
||||
v1[i] = a70 * yDot0 + a72 * yDot2 + a73 * yDot3 + a74 * yDot4 + a75 * yDot5;
|
||||
v1[i] = A70 * yDot0 + A72 * yDot2 + A73 * yDot3 + A74 * yDot4 + A75 * yDot5;
|
||||
v2[i] = yDot0 - v1[i];
|
||||
v3[i] = v1[i] - v2[i] - yDot6;
|
||||
v4[i] = d0 * yDot0 + d2 * yDot2 + d3 * yDot3 + d4 * yDot4 + d5 * yDot5 + d6 * yDot6;
|
||||
v4[i] = D0 * yDot0 + D2 * yDot2 + D3 * yDot3 + D4 * yDot4 + D5 * yDot5 + D6 * yDot6;
|
||||
}
|
||||
|
||||
vectorsInitialized = true;
|
||||
|
@ -172,41 +172,41 @@ class DormandPrince54StepInterpolator
|
|||
private boolean vectorsInitialized;
|
||||
|
||||
/** Last row of the Butcher-array internal weights, element 0. */
|
||||
private static final double a70 = 35.0 / 384.0;
|
||||
private static final double A70 = 35.0 / 384.0;
|
||||
|
||||
// element 1 is zero, so it is neither stored nor used
|
||||
|
||||
/** Last row of the Butcher-array internal weights, element 2. */
|
||||
private static final double a72 = 500.0 / 1113.0;
|
||||
private static final double A72 = 500.0 / 1113.0;
|
||||
|
||||
/** Last row of the Butcher-array internal weights, element 3. */
|
||||
private static final double a73 = 125.0 / 192.0;
|
||||
private static final double A73 = 125.0 / 192.0;
|
||||
|
||||
/** Last row of the Butcher-array internal weights, element 4. */
|
||||
private static final double a74 = -2187.0 / 6784.0;
|
||||
private static final double A74 = -2187.0 / 6784.0;
|
||||
|
||||
/** Last row of the Butcher-array internal weights, element 5. */
|
||||
private static final double a75 = 11.0 / 84.0;
|
||||
private static final double A75 = 11.0 / 84.0;
|
||||
|
||||
/** Shampine (1986) Dense output, element 0. */
|
||||
private static final double d0 = -12715105075.0 / 11282082432.0;
|
||||
private static final double D0 = -12715105075.0 / 11282082432.0;
|
||||
|
||||
// element 1 is zero, so it is neither stored nor used
|
||||
|
||||
/** Shampine (1986) Dense output, element 2. */
|
||||
private static final double d2 = 87487479700.0 / 32700410799.0;
|
||||
private static final double D2 = 87487479700.0 / 32700410799.0;
|
||||
|
||||
/** Shampine (1986) Dense output, element 3. */
|
||||
private static final double d3 = -10690763975.0 / 1880347072.0;
|
||||
private static final double D3 = -10690763975.0 / 1880347072.0;
|
||||
|
||||
/** Shampine (1986) Dense output, element 4. */
|
||||
private static final double d4 = 701980252875.0 / 199316789632.0;
|
||||
private static final double D4 = 701980252875.0 / 199316789632.0;
|
||||
|
||||
/** Shampine (1986) Dense output, element 5. */
|
||||
private static final double d5 = -1453857185.0 / 822651844.0;
|
||||
private static final double D5 = -1453857185.0 / 822651844.0;
|
||||
|
||||
/** Shampine (1986) Dense output, element 6. */
|
||||
private static final double d6 = 69997945.0 / 29380423.0;
|
||||
private static final double D6 = 69997945.0 / 29380423.0;
|
||||
|
||||
/** Serializable version identifier */
|
||||
private static final long serialVersionUID = 4104157279605906956L;
|
||||
|
|
|
@ -58,14 +58,14 @@ public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
private static final String METHOD_NAME = "Dormand-Prince 8 (5, 3)";
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] staticC = {
|
||||
private static final double[] STATIC_C = {
|
||||
(12.0 - 2.0 * Math.sqrt(6.0)) / 135.0, (6.0 - Math.sqrt(6.0)) / 45.0, (6.0 - Math.sqrt(6.0)) / 30.0,
|
||||
(6.0 + Math.sqrt(6.0)) / 30.0, 1.0/3.0, 1.0/4.0, 4.0/13.0, 127.0/195.0, 3.0/5.0,
|
||||
6.0/7.0, 1.0, 1.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] staticA = {
|
||||
private static final double[][] STATIC_A = {
|
||||
|
||||
// k2
|
||||
{(12.0 - 2.0 * Math.sqrt(6.0)) / 135.0},
|
||||
|
@ -132,7 +132,7 @@ public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] staticB = {
|
||||
private static final double[] STATIC_B = {
|
||||
104257.0/1920240.0,
|
||||
0.0,
|
||||
0.0,
|
||||
|
@ -149,57 +149,57 @@ public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
};
|
||||
|
||||
/** First error weights array, element 1. */
|
||||
private static final double e1_01 = 116092271.0 / 8848465920.0;
|
||||
private static final double E1_01 = 116092271.0 / 8848465920.0;
|
||||
|
||||
// elements 2 to 5 are zero, so they are neither stored nor used
|
||||
|
||||
/** First error weights array, element 6. */
|
||||
private static final double e1_06 = -1871647.0 / 1527680.0;
|
||||
private static final double E1_06 = -1871647.0 / 1527680.0;
|
||||
|
||||
/** First error weights array, element 7. */
|
||||
private static final double e1_07 = -69799717.0 / 140793660.0;
|
||||
private static final double E1_07 = -69799717.0 / 140793660.0;
|
||||
|
||||
/** First error weights array, element 8. */
|
||||
private static final double e1_08 = 1230164450203.0 / 739113984000.0;
|
||||
private static final double E1_08 = 1230164450203.0 / 739113984000.0;
|
||||
|
||||
/** First error weights array, element 9. */
|
||||
private static final double e1_09 = -1980813971228885.0 / 5654156025964544.0;
|
||||
private static final double E1_09 = -1980813971228885.0 / 5654156025964544.0;
|
||||
|
||||
/** First error weights array, element 10. */
|
||||
private static final double e1_10 = 464500805.0 / 1389975552.0;
|
||||
private static final double E1_10 = 464500805.0 / 1389975552.0;
|
||||
|
||||
/** First error weights array, element 11. */
|
||||
private static final double e1_11 = 1606764981773.0 / 19613062656000.0;
|
||||
private static final double E1_11 = 1606764981773.0 / 19613062656000.0;
|
||||
|
||||
/** First error weights array, element 12. */
|
||||
private static final double e1_12 = -137909.0 / 6168960.0;
|
||||
private static final double E1_12 = -137909.0 / 6168960.0;
|
||||
|
||||
|
||||
/** Second error weights array, element 1. */
|
||||
private static final double e2_01 = -364463.0 / 1920240.0;
|
||||
private static final double E2_01 = -364463.0 / 1920240.0;
|
||||
|
||||
// elements 2 to 5 are zero, so they are neither stored nor used
|
||||
|
||||
/** Second error weights array, element 6. */
|
||||
private static final double e2_06 = 3399327.0 / 763840.0;
|
||||
private static final double E2_06 = 3399327.0 / 763840.0;
|
||||
|
||||
/** Second error weights array, element 7. */
|
||||
private static final double e2_07 = 66578432.0 / 35198415.0;
|
||||
private static final double E2_07 = 66578432.0 / 35198415.0;
|
||||
|
||||
/** Second error weights array, element 8. */
|
||||
private static final double e2_08 = -1674902723.0 / 288716400.0;
|
||||
private static final double E2_08 = -1674902723.0 / 288716400.0;
|
||||
|
||||
/** Second error weights array, element 9. */
|
||||
private static final double e2_09 = -74684743568175.0 / 176692375811392.0;
|
||||
private static final double E2_09 = -74684743568175.0 / 176692375811392.0;
|
||||
|
||||
/** Second error weights array, element 10. */
|
||||
private static final double e2_10 = -734375.0 / 4826304.0;
|
||||
private static final double E2_10 = -734375.0 / 4826304.0;
|
||||
|
||||
/** Second error weights array, element 11. */
|
||||
private static final double e2_11 = 171414593.0 / 851261400.0;
|
||||
private static final double E2_11 = 171414593.0 / 851261400.0;
|
||||
|
||||
/** Second error weights array, element 12. */
|
||||
private static final double e2_12 = 69869.0 / 3084480.0;
|
||||
private static final double E2_12 = 69869.0 / 3084480.0;
|
||||
|
||||
/** Simple constructor.
|
||||
* Build an eighth order Dormand-Prince integrator with the given step bounds
|
||||
|
@ -213,7 +213,7 @@ public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
public DormandPrince853Integrator(final double minStep, final double maxStep,
|
||||
final double scalAbsoluteTolerance,
|
||||
final double scalRelativeTolerance) {
|
||||
super(METHOD_NAME, true, staticC, staticA, staticB,
|
||||
super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B,
|
||||
new DormandPrince853StepInterpolator(),
|
||||
minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
public DormandPrince853Integrator(final double minStep, final double maxStep,
|
||||
final double[] vecAbsoluteTolerance,
|
||||
final double[] vecRelativeTolerance) {
|
||||
super(METHOD_NAME, true, staticC, staticA, staticB,
|
||||
super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B,
|
||||
new DormandPrince853StepInterpolator(),
|
||||
minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
|
||||
}
|
||||
|
@ -250,14 +250,14 @@ public class DormandPrince853Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
double error2 = 0;
|
||||
|
||||
for (int j = 0; j < y0.length; ++j) {
|
||||
final double errSum1 = e1_01 * yDotK[0][j] + e1_06 * yDotK[5][j] +
|
||||
e1_07 * yDotK[6][j] + e1_08 * yDotK[7][j] +
|
||||
e1_09 * yDotK[8][j] + e1_10 * yDotK[9][j] +
|
||||
e1_11 * yDotK[10][j] + e1_12 * yDotK[11][j];
|
||||
final double errSum2 = e2_01 * yDotK[0][j] + e2_06 * yDotK[5][j] +
|
||||
e2_07 * yDotK[6][j] + e2_08 * yDotK[7][j] +
|
||||
e2_09 * yDotK[8][j] + e2_10 * yDotK[9][j] +
|
||||
e2_11 * yDotK[10][j] + e2_12 * yDotK[11][j];
|
||||
final double errSum1 = E1_01 * yDotK[0][j] + E1_06 * yDotK[5][j] +
|
||||
E1_07 * yDotK[6][j] + E1_08 * yDotK[7][j] +
|
||||
E1_09 * yDotK[8][j] + E1_10 * yDotK[9][j] +
|
||||
E1_11 * yDotK[10][j] + E1_12 * yDotK[11][j];
|
||||
final double errSum2 = E2_01 * yDotK[0][j] + E2_06 * yDotK[5][j] +
|
||||
E2_07 * yDotK[6][j] + E2_08 * yDotK[7][j] +
|
||||
E2_09 * yDotK[8][j] + E2_10 * yDotK[9][j] +
|
||||
E2_11 * yDotK[10][j] + E2_12 * yDotK[11][j];
|
||||
|
||||
final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));
|
||||
final double tol = (vecAbsoluteTolerance == null) ?
|
||||
|
|
|
@ -161,16 +161,16 @@ class DormandPrince853StepInterpolator
|
|||
final double yDot14 = yDotKLast[0][i];
|
||||
final double yDot15 = yDotKLast[1][i];
|
||||
final double yDot16 = yDotKLast[2][i];
|
||||
v[0][i] = b_01 * yDot1 + b_06 * yDot6 + b_07 * yDot7 +
|
||||
b_08 * yDot8 + b_09 * yDot9 + b_10 * yDot10 +
|
||||
b_11 * yDot11 + b_12 * yDot12;
|
||||
v[0][i] = B_01 * yDot1 + B_06 * yDot6 + B_07 * yDot7 +
|
||||
B_08 * yDot8 + B_09 * yDot9 + B_10 * yDot10 +
|
||||
B_11 * yDot11 + B_12 * yDot12;
|
||||
v[1][i] = yDot1 - v[0][i];
|
||||
v[2][i] = v[0][i] - v[1][i] - yDotK[12][i];
|
||||
for (int k = 0; k < d.length; ++k) {
|
||||
v[k+3][i] = d[k][0] * yDot1 + d[k][1] * yDot6 + d[k][2] * yDot7 +
|
||||
d[k][3] * yDot8 + d[k][4] * yDot9 + d[k][5] * yDot10 +
|
||||
d[k][6] * yDot11 + d[k][7] * yDot12 + d[k][8] * yDot13 +
|
||||
d[k][9] * yDot14 + d[k][10] * yDot15 + d[k][11] * yDot16;
|
||||
for (int k = 0; k < D.length; ++k) {
|
||||
v[k+3][i] = D[k][0] * yDot1 + D[k][1] * yDot6 + D[k][2] * yDot7 +
|
||||
D[k][3] * yDot8 + D[k][4] * yDot9 + D[k][5] * yDot10 +
|
||||
D[k][6] * yDot11 + D[k][7] * yDot12 + D[k][8] * yDot13 +
|
||||
D[k][9] * yDot14 + D[k][10] * yDot15 + D[k][11] * yDot16;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,32 +219,32 @@ class DormandPrince853StepInterpolator
|
|||
|
||||
// k14
|
||||
for (int j = 0; j < currentState.length; ++j) {
|
||||
s = k14_01 * yDotK[0][j] + k14_06 * yDotK[5][j] + k14_07 * yDotK[6][j] +
|
||||
k14_08 * yDotK[7][j] + k14_09 * yDotK[8][j] + k14_10 * yDotK[9][j] +
|
||||
k14_11 * yDotK[10][j] + k14_12 * yDotK[11][j] + k14_13 * yDotK[12][j];
|
||||
s = K14_01 * yDotK[0][j] + K14_06 * yDotK[5][j] + K14_07 * yDotK[6][j] +
|
||||
K14_08 * yDotK[7][j] + K14_09 * yDotK[8][j] + K14_10 * yDotK[9][j] +
|
||||
K14_11 * yDotK[10][j] + K14_12 * yDotK[11][j] + K14_13 * yDotK[12][j];
|
||||
yTmp[j] = currentState[j] + h * s;
|
||||
}
|
||||
integrator.computeDerivatives(previousTime + c14 * h, yTmp, yDotKLast[0]);
|
||||
integrator.computeDerivatives(previousTime + C14 * h, yTmp, yDotKLast[0]);
|
||||
|
||||
// k15
|
||||
for (int j = 0; j < currentState.length; ++j) {
|
||||
s = k15_01 * yDotK[0][j] + k15_06 * yDotK[5][j] + k15_07 * yDotK[6][j] +
|
||||
k15_08 * yDotK[7][j] + k15_09 * yDotK[8][j] + k15_10 * yDotK[9][j] +
|
||||
k15_11 * yDotK[10][j] + k15_12 * yDotK[11][j] + k15_13 * yDotK[12][j] +
|
||||
k15_14 * yDotKLast[0][j];
|
||||
s = K15_01 * yDotK[0][j] + K15_06 * yDotK[5][j] + K15_07 * yDotK[6][j] +
|
||||
K15_08 * yDotK[7][j] + K15_09 * yDotK[8][j] + K15_10 * yDotK[9][j] +
|
||||
K15_11 * yDotK[10][j] + K15_12 * yDotK[11][j] + K15_13 * yDotK[12][j] +
|
||||
K15_14 * yDotKLast[0][j];
|
||||
yTmp[j] = currentState[j] + h * s;
|
||||
}
|
||||
integrator.computeDerivatives(previousTime + c15 * h, yTmp, yDotKLast[1]);
|
||||
integrator.computeDerivatives(previousTime + C15 * h, yTmp, yDotKLast[1]);
|
||||
|
||||
// k16
|
||||
for (int j = 0; j < currentState.length; ++j) {
|
||||
s = k16_01 * yDotK[0][j] + k16_06 * yDotK[5][j] + k16_07 * yDotK[6][j] +
|
||||
k16_08 * yDotK[7][j] + k16_09 * yDotK[8][j] + k16_10 * yDotK[9][j] +
|
||||
k16_11 * yDotK[10][j] + k16_12 * yDotK[11][j] + k16_13 * yDotK[12][j] +
|
||||
k16_14 * yDotKLast[0][j] + k16_15 * yDotKLast[1][j];
|
||||
s = K16_01 * yDotK[0][j] + K16_06 * yDotK[5][j] + K16_07 * yDotK[6][j] +
|
||||
K16_08 * yDotK[7][j] + K16_09 * yDotK[8][j] + K16_10 * yDotK[9][j] +
|
||||
K16_11 * yDotK[10][j] + K16_12 * yDotK[11][j] + K16_13 * yDotK[12][j] +
|
||||
K16_14 * yDotKLast[0][j] + K16_15 * yDotKLast[1][j];
|
||||
yTmp[j] = currentState[j] + h * s;
|
||||
}
|
||||
integrator.computeDerivatives(previousTime + c16 * h, yTmp, yDotKLast[2]);
|
||||
integrator.computeDerivatives(previousTime + C16 * h, yTmp, yDotKLast[2]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -305,142 +305,142 @@ class DormandPrince853StepInterpolator
|
|||
private boolean vectorsInitialized;
|
||||
|
||||
/** Propagation weights, element 1. */
|
||||
private static final double b_01 = 104257.0 / 1920240.0;
|
||||
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;
|
||||
private static final double B_06 = 3399327.0 / 763840.0;
|
||||
|
||||
/** Propagation weights, element 7. */
|
||||
private static final double b_07 = 66578432.0 / 35198415.0;
|
||||
private static final double B_07 = 66578432.0 / 35198415.0;
|
||||
|
||||
/** Propagation weights, element 8. */
|
||||
private static final double b_08 = -1674902723.0 / 288716400.0;
|
||||
private static final double B_08 = -1674902723.0 / 288716400.0;
|
||||
|
||||
/** Propagation weights, element 9. */
|
||||
private static final double b_09 = 54980371265625.0 / 176692375811392.0;
|
||||
private static final double B_09 = 54980371265625.0 / 176692375811392.0;
|
||||
|
||||
/** Propagation weights, element 10. */
|
||||
private static final double b_10 = -734375.0 / 4826304.0;
|
||||
private static final double B_10 = -734375.0 / 4826304.0;
|
||||
|
||||
/** Propagation weights, element 11. */
|
||||
private static final double b_11 = 171414593.0 / 851261400.0;
|
||||
private static final double B_11 = 171414593.0 / 851261400.0;
|
||||
|
||||
/** Propagation weights, element 12. */
|
||||
private static final double b_12 = 137909.0 / 3084480.0;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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 = {
|
||||
private static final double[][] D = {
|
||||
|
||||
{ -17751989329.0 / 2106076560.0, 4272954039.0 / 7539864640.0,
|
||||
-118476319744.0 / 38604839385.0, 755123450731.0 / 316657731600.0,
|
||||
|
|
|
@ -49,15 +49,15 @@ package org.apache.commons.math.ode.nonstiff;
|
|||
public class EulerIntegrator extends RungeKuttaIntegrator {
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] c = {
|
||||
private static final double[] STATIC_C = {
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] a = {
|
||||
private static final double[][] STATIC_A = {
|
||||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] b = {
|
||||
private static final double[] STATIC_B = {
|
||||
1.0
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class EulerIntegrator extends RungeKuttaIntegrator {
|
|||
* @param step integration step
|
||||
*/
|
||||
public EulerIntegrator(final double step) {
|
||||
super("Euler", c, a, b, new EulerStepInterpolator(), step);
|
||||
super("Euler", STATIC_C, STATIC_A, STATIC_B, new EulerStepInterpolator(), step);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,19 +45,19 @@ package org.apache.commons.math.ode.nonstiff;
|
|||
public class GillIntegrator extends RungeKuttaIntegrator {
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] c = {
|
||||
private static final double[] STATIC_C = {
|
||||
1.0 / 2.0, 1.0 / 2.0, 1.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] a = {
|
||||
private static final double[][] STATIC_A = {
|
||||
{ 1.0 / 2.0 },
|
||||
{ (Math.sqrt(2.0) - 1.0) / 2.0, (2.0 - Math.sqrt(2.0)) / 2.0 },
|
||||
{ 0.0, -Math.sqrt(2.0) / 2.0, (2.0 + Math.sqrt(2.0)) / 2.0 }
|
||||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] b = {
|
||||
private static final double[] STATIC_B = {
|
||||
1.0 / 6.0, (2.0 - Math.sqrt(2.0)) / 6.0, (2.0 + Math.sqrt(2.0)) / 6.0, 1.0 / 6.0
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class GillIntegrator extends RungeKuttaIntegrator {
|
|||
* @param step integration step
|
||||
*/
|
||||
public GillIntegrator(final double step) {
|
||||
super("Gill", c, a, b, new GillStepInterpolator(), step);
|
||||
super("Gill", STATIC_C, STATIC_A, STATIC_B, new GillStepInterpolator(), step);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,13 +90,13 @@ class GillStepInterpolator
|
|||
final double soMt = s * oMt;
|
||||
final double c23 = soMt * (1 + twoTheta);
|
||||
final double coeff1 = soMt * (1 - fourTheta);
|
||||
final double coeff2 = c23 * tMq;
|
||||
final double coeff3 = c23 * tPq;
|
||||
final double coeff2 = c23 * TWO_MINUS_SQRT_2;
|
||||
final double coeff3 = c23 * TWO_PLUS_SQRT_2;
|
||||
final double coeff4 = s * (1 + theta * (1 + fourTheta));
|
||||
final double coeffDot1 = theta * (twoTheta - 3) + 1;
|
||||
final double cDot23 = theta * oMt;
|
||||
final double coeffDot2 = cDot23 * tMq;
|
||||
final double coeffDot3 = cDot23 * tPq;
|
||||
final double coeffDot2 = cDot23 * TWO_MINUS_SQRT_2;
|
||||
final double coeffDot3 = cDot23 * TWO_PLUS_SQRT_2;
|
||||
final double coeffDot4 = theta * (twoTheta - 1);
|
||||
|
||||
for (int i = 0; i < interpolatedState.length; ++i) {
|
||||
|
@ -113,10 +113,10 @@ class GillStepInterpolator
|
|||
}
|
||||
|
||||
/** First Gill coefficient. */
|
||||
private static final double tMq = 2 - Math.sqrt(2.0);
|
||||
private static final double TWO_MINUS_SQRT_2 = 2 - Math.sqrt(2.0);
|
||||
|
||||
/** Second Gill coefficient. */
|
||||
private static final double tPq = 2 + Math.sqrt(2.0);
|
||||
private static final double TWO_PLUS_SQRT_2 = 2 + Math.sqrt(2.0);
|
||||
|
||||
/** Serializable version identifier */
|
||||
private static final long serialVersionUID = -107804074496313322L;
|
||||
|
|
|
@ -38,12 +38,12 @@ public class HighamHall54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
private static final String METHOD_NAME = "Higham-Hall 5(4)";
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] staticC = {
|
||||
private static final double[] STATIC_C = {
|
||||
2.0/9.0, 1.0/3.0, 1.0/2.0, 3.0/5.0, 1.0, 1.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] staticA = {
|
||||
private static final double[][] STATIC_A = {
|
||||
{2.0/9.0},
|
||||
{1.0/12.0, 1.0/4.0},
|
||||
{1.0/8.0, 0.0, 3.0/8.0},
|
||||
|
@ -53,12 +53,12 @@ public class HighamHall54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] staticB = {
|
||||
private static final double[] STATIC_B = {
|
||||
1.0/12.0, 0.0, 27.0/32.0, -4.0/3.0, 125.0/96.0, 5.0/48.0, 0.0
|
||||
};
|
||||
|
||||
/** Error weights Butcher array. */
|
||||
private static final double[] staticE = {
|
||||
private static final double[] STATIC_E = {
|
||||
-1.0/20.0, 0.0, 81.0/160.0, -6.0/5.0, 25.0/32.0, 1.0/16.0, -1.0/10.0
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class HighamHall54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
public HighamHall54Integrator(final double minStep, final double maxStep,
|
||||
final double scalAbsoluteTolerance,
|
||||
final double scalRelativeTolerance) {
|
||||
super(METHOD_NAME, false, staticC, staticA, staticB, new HighamHall54StepInterpolator(),
|
||||
super(METHOD_NAME, false, STATIC_C, STATIC_A, STATIC_B, new HighamHall54StepInterpolator(),
|
||||
minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class HighamHall54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
public HighamHall54Integrator(final double minStep, final double maxStep,
|
||||
final double[] vecAbsoluteTolerance,
|
||||
final double[] vecRelativeTolerance) {
|
||||
super(METHOD_NAME, false, staticC, staticA, staticB, new HighamHall54StepInterpolator(),
|
||||
super(METHOD_NAME, false, STATIC_C, STATIC_A, STATIC_B, new HighamHall54StepInterpolator(),
|
||||
minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
|
||||
}
|
||||
|
||||
|
@ -109,9 +109,9 @@ public class HighamHall54Integrator extends EmbeddedRungeKuttaIntegrator {
|
|||
double error = 0;
|
||||
|
||||
for (int j = 0; j < y0.length; ++j) {
|
||||
double errSum = staticE[0] * yDotK[0][j];
|
||||
for (int l = 1; l < staticE.length; ++l) {
|
||||
errSum += staticE[l] * yDotK[l][j];
|
||||
double errSum = STATIC_E[0] * yDotK[0][j];
|
||||
for (int l = 1; l < STATIC_E.length; ++l) {
|
||||
errSum += STATIC_E[l] * yDotK[l][j];
|
||||
}
|
||||
|
||||
final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));
|
||||
|
|
|
@ -43,17 +43,17 @@ package org.apache.commons.math.ode.nonstiff;
|
|||
public class MidpointIntegrator extends RungeKuttaIntegrator {
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] c = {
|
||||
private static final double[] STATIC_C = {
|
||||
1.0 / 2.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] a = {
|
||||
private static final double[][] STATIC_A = {
|
||||
{ 1.0 / 2.0 }
|
||||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] b = {
|
||||
private static final double[] STATIC_B = {
|
||||
0.0, 1.0
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class MidpointIntegrator extends RungeKuttaIntegrator {
|
|||
* @param step integration step
|
||||
*/
|
||||
public MidpointIntegrator(final double step) {
|
||||
super("midpoint", c, a, b, new MidpointStepInterpolator(), step);
|
||||
super("midpoint", STATIC_C, STATIC_A, STATIC_B, new MidpointStepInterpolator(), step);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,19 +45,19 @@ package org.apache.commons.math.ode.nonstiff;
|
|||
public class ThreeEighthesIntegrator extends RungeKuttaIntegrator {
|
||||
|
||||
/** Time steps Butcher array. */
|
||||
private static final double[] c = {
|
||||
private static final double[] STATIC_C = {
|
||||
1.0 / 3.0, 2.0 / 3.0, 1.0
|
||||
};
|
||||
|
||||
/** Internal weights Butcher array. */
|
||||
private static final double[][] a = {
|
||||
private static final double[][] STATIC_A = {
|
||||
{ 1.0 / 3.0 },
|
||||
{ -1.0 / 3.0, 1.0 },
|
||||
{ 1.0, -1.0, 1.0 }
|
||||
};
|
||||
|
||||
/** Propagation weights Butcher array. */
|
||||
private static final double[] b = {
|
||||
private static final double[] STATIC_B = {
|
||||
1.0 / 8.0, 3.0 / 8.0, 3.0 / 8.0, 1.0 / 8.0
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class ThreeEighthesIntegrator extends RungeKuttaIntegrator {
|
|||
* @param step integration step
|
||||
*/
|
||||
public ThreeEighthesIntegrator(final double step) {
|
||||
super("3/8", c, a, b, new ThreeEighthesStepInterpolator(), step);
|
||||
super("3/8", STATIC_C, STATIC_A, STATIC_B, new ThreeEighthesStepInterpolator(), step);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class DummyStepHandler implements StepHandler {
|
|||
* @return the only instance
|
||||
*/
|
||||
public static DummyStepHandler getInstance() {
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/** Determines whether this handler needs dense output.
|
||||
|
@ -82,6 +82,6 @@ public class DummyStepHandler implements StepHandler {
|
|||
}
|
||||
|
||||
/** The only instance. */
|
||||
private static final DummyStepHandler instance = new DummyStepHandler();
|
||||
private static final DummyStepHandler INSTANCE = new DummyStepHandler();
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class BrentOptimizer extends AbstractUnivariateRealOptimizer {
|
|||
/**
|
||||
* Golden section.
|
||||
*/
|
||||
private static final double c = 0.5 * (3 - Math.sqrt(5));
|
||||
private static final double GOLDEN_SECTION = 0.5 * (3 - Math.sqrt(5));
|
||||
|
||||
/**
|
||||
* Construct a solver.
|
||||
|
@ -85,7 +85,7 @@ public class BrentOptimizer extends AbstractUnivariateRealOptimizer {
|
|||
private double localMin(final UnivariateRealFunction f, final GoalType goalType,
|
||||
double a, double b, final double eps, final double t)
|
||||
throws MaxIterationsExceededException, FunctionEvaluationException {
|
||||
double x = a + c * (b - a);
|
||||
double x = a + GOLDEN_SECTION * (b - a);
|
||||
double v = x;
|
||||
double w = x;
|
||||
double e = 0;
|
||||
|
@ -137,7 +137,7 @@ public class BrentOptimizer extends AbstractUnivariateRealOptimizer {
|
|||
}
|
||||
} else { // Golden section step.
|
||||
e = ((x < m) ? b : a) - x;
|
||||
d = c * e;
|
||||
d = GOLDEN_SECTION * e;
|
||||
}
|
||||
|
||||
// f must not be evaluated too close to a or b.
|
||||
|
|
|
@ -38,7 +38,7 @@ public class Gamma {
|
|||
private static final double DEFAULT_EPSILON = 10e-15;
|
||||
|
||||
/** Lanczos coefficients */
|
||||
private static final double[] lanczos =
|
||||
private static final double[] LANCZOS =
|
||||
{
|
||||
0.99999999999999709182,
|
||||
57.156235665862923517,
|
||||
|
@ -94,10 +94,10 @@ public class Gamma {
|
|||
double g = 607.0 / 128.0;
|
||||
|
||||
double sum = 0.0;
|
||||
for (int i = lanczos.length - 1; i > 0; --i) {
|
||||
sum = sum + (lanczos[i] / (x + i));
|
||||
for (int i = LANCZOS.length - 1; i > 0; --i) {
|
||||
sum = sum + (LANCZOS[i] / (x + i));
|
||||
}
|
||||
sum = sum + lanczos[0];
|
||||
sum = sum + LANCZOS[0];
|
||||
|
||||
double tmp = x + g + .5;
|
||||
ret = ((x + .5) * Math.log(tmp)) - tmp +
|
||||
|
|
|
@ -38,34 +38,34 @@ import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;
|
|||
public final class StatUtils {
|
||||
|
||||
/** sum */
|
||||
private static final UnivariateStatistic sum = new Sum();
|
||||
private static final UnivariateStatistic SUM = new Sum();
|
||||
|
||||
/** sumSq */
|
||||
private static final UnivariateStatistic sumSq = new SumOfSquares();
|
||||
private static final UnivariateStatistic SUM_OF_SQUARES = new SumOfSquares();
|
||||
|
||||
/** prod */
|
||||
private static final UnivariateStatistic prod = new Product();
|
||||
private static final UnivariateStatistic PRODUCT = new Product();
|
||||
|
||||
/** sumLog */
|
||||
private static final UnivariateStatistic sumLog = new SumOfLogs();
|
||||
private static final UnivariateStatistic SUM_OF_LOGS = new SumOfLogs();
|
||||
|
||||
/** min */
|
||||
private static final UnivariateStatistic min = new Min();
|
||||
private static final UnivariateStatistic MIN = new Min();
|
||||
|
||||
/** max */
|
||||
private static final UnivariateStatistic max = new Max();
|
||||
private static final UnivariateStatistic MAX = new Max();
|
||||
|
||||
/** mean */
|
||||
private static final UnivariateStatistic mean = new Mean();
|
||||
private static final UnivariateStatistic MEAN = new Mean();
|
||||
|
||||
/** variance */
|
||||
private static final Variance variance = new Variance();
|
||||
private static final Variance VARIANCE = new Variance();
|
||||
|
||||
/** percentile */
|
||||
private static final Percentile percentile = new Percentile();
|
||||
private static final Percentile PERCENTILE = new Percentile();
|
||||
|
||||
/** geometric mean */
|
||||
private static final GeometricMean geometricMean = new GeometricMean();
|
||||
private static final GeometricMean GEOMETRIC_MEAN = new GeometricMean();
|
||||
|
||||
/**
|
||||
* Private Constructor
|
||||
|
@ -86,7 +86,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double sum(final double[] values) {
|
||||
return sum.evaluate(values);
|
||||
return SUM.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +105,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double sum(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return sum.evaluate(values, begin, length);
|
||||
return SUM.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,7 +120,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double sumSq(final double[] values) {
|
||||
return sumSq.evaluate(values);
|
||||
return SUM_OF_SQUARES.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double sumSq(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return sumSq.evaluate(values, begin, length);
|
||||
return SUM_OF_SQUARES.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +153,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double product(final double[] values) {
|
||||
return prod.evaluate(values);
|
||||
return PRODUCT.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double product(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return prod.evaluate(values, begin, length);
|
||||
return PRODUCT.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +190,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double sumLog(final double[] values) {
|
||||
return sumLog.evaluate(values);
|
||||
return SUM_OF_LOGS.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,7 +213,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double sumLog(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return sumLog.evaluate(values, begin, length);
|
||||
return SUM_OF_LOGS.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,7 +230,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double mean(final double[] values) {
|
||||
return mean.evaluate(values);
|
||||
return MEAN.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,7 +252,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double mean(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return mean.evaluate(values, begin, length);
|
||||
return MEAN.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,7 +269,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double geometricMean(final double[] values) {
|
||||
return geometricMean.evaluate(values);
|
||||
return GEOMETRIC_MEAN.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,7 +291,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double geometricMean(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return geometricMean.evaluate(values, begin, length);
|
||||
return GEOMETRIC_MEAN.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,7 +311,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double variance(final double[] values) {
|
||||
return variance.evaluate(values);
|
||||
return VARIANCE.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,7 +336,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double variance(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return variance.evaluate(values, begin, length);
|
||||
return VARIANCE.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,7 +367,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double variance(final double[] values, final double mean,
|
||||
final int begin, final int length) {
|
||||
return variance.evaluate(values, mean, begin, length);
|
||||
return VARIANCE.evaluate(values, mean, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -393,7 +393,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double variance(final double[] values, final double mean) {
|
||||
return variance.evaluate(values, mean);
|
||||
return VARIANCE.evaluate(values, mean);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,7 +414,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double max(final double[] values) {
|
||||
return max.evaluate(values);
|
||||
return MAX.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,7 +441,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double max(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return max.evaluate(values, begin, length);
|
||||
return MAX.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,7 +462,7 @@ public final class StatUtils {
|
|||
* @throws IllegalArgumentException if the array is null
|
||||
*/
|
||||
public static double min(final double[] values) {
|
||||
return min.evaluate(values);
|
||||
return MIN.evaluate(values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -489,7 +489,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double min(final double[] values, final int begin,
|
||||
final int length) {
|
||||
return min.evaluate(values, begin, length);
|
||||
return MIN.evaluate(values, begin, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -516,7 +516,7 @@ public final class StatUtils {
|
|||
* or p is invalid
|
||||
*/
|
||||
public static double percentile(final double[] values, final double p) {
|
||||
return percentile.evaluate(values,p);
|
||||
return PERCENTILE.evaluate(values,p);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -548,7 +548,7 @@ public final class StatUtils {
|
|||
*/
|
||||
public static double percentile(final double[] values, final int begin,
|
||||
final int length, final double p) {
|
||||
return percentile.evaluate(values, begin, length, p);
|
||||
return PERCENTILE.evaluate(values, begin, length, p);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -470,7 +470,7 @@ public final class MathUtils {
|
|||
}
|
||||
|
||||
/** All long-representable factorials */
|
||||
private static final long[] factorials = new long[]
|
||||
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,
|
||||
|
@ -508,7 +508,7 @@ public final class MathUtils {
|
|||
throw new ArithmeticException(
|
||||
"factorial value is too large to fit in a long");
|
||||
}
|
||||
return factorials[n];
|
||||
return FACTORIALS[n];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue