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 2015/11/15 10:41:50 UTC
[math] Whitespace.
Repository: commons-math
Updated Branches:
refs/heads/field-ode ea0dabfd1 -> 97a65021c
Whitespace.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/97a65021
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/97a65021
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/97a65021
Branch: refs/heads/field-ode
Commit: 97a65021c7b9efe570dd0688c871c190be3bb445
Parents: ea0dabf
Author: Luc Maisonobe <lu...@apache.org>
Authored: Sun Nov 15 10:41:39 2015 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Sun Nov 15 10:41:39 2015 +0100
----------------------------------------------------------------------
.../ode/nonstiff/EulerFieldIntegrator.java | 36 ++++----
.../nonstiff/EulerFieldStepInterpolator.java | 91 ++++++++++----------
2 files changed, 62 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/97a65021/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
index ac380fe..c591e3e 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java
@@ -51,26 +51,26 @@ import org.apache.commons.math3.RealFieldElement;
public class EulerFieldIntegrator<T extends RealFieldElement<T>> extends RungeKuttaFieldIntegrator<T> {
- /** Time steps Butcher array. */
- private static final double[] STATIC_C = {
- };
+ /** Time steps Butcher array. */
+ private static final double[] STATIC_C = {
+ };
- /** Internal weights Butcher array. */
- private static final double[][] STATIC_A = {
- };
+ /** Internal weights Butcher array. */
+ private static final double[][] STATIC_A = {
+ };
- /** Propagation weights Butcher array. */
- private static final double[] STATIC_B = {
- 1.0
- };
+ /** Propagation weights Butcher array. */
+ private static final double[] STATIC_B = {
+ 1.0
+ };
- /** Simple constructor.
- * Build an Euler integrator with the given step.
- * @param field field to which the time and state vector elements belong
- * @param step integration step
- */
- public EulerFieldIntegrator(final Field<T> field, final T step) {
- super(field, "Euler", STATIC_C, STATIC_A, STATIC_B, new EulerFieldStepInterpolator<T>(), step);
- }
+ /** Simple constructor.
+ * Build an Euler integrator with the given step.
+ * @param field field to which the time and state vector elements belong
+ * @param step integration step
+ */
+ public EulerFieldIntegrator(final Field<T> field, final T step) {
+ super(field, "Euler", STATIC_C, STATIC_A, STATIC_B, new EulerFieldStepInterpolator<T>(), step);
+ }
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/97a65021/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
index 777a00f..1b55db8 100644
--- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java
@@ -47,57 +47,54 @@ import org.apache.commons.math3.util.MathArrays;
*/
class EulerFieldStepInterpolator<T extends RealFieldElement<T>>
- extends RungeKuttaFieldStepInterpolator<T> {
+ extends RungeKuttaFieldStepInterpolator<T> {
- /** Simple constructor.
- * This constructor builds an instance that is not usable yet, the
- * {@link
- * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
- * method should be called before using the instance in order to
- * initialize the internal arrays. This constructor is used only
- * in order to delay the initialization in some cases. The {@link
- * RungeKuttaIntegrator} class uses the prototyping design pattern
- * to create the step interpolators by cloning an uninitialized model
- * and later initializing the copy.
- */
- EulerFieldStepInterpolator() {
- }
+ /** Simple constructor.
+ * This constructor builds an instance that is not usable yet, the
+ * {@link
+ * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+ * method should be called before using the instance in order to
+ * initialize the internal arrays. This constructor is used only
+ * in order to delay the initialization in some cases. The {@link
+ * RungeKuttaIntegrator} class uses the prototyping design pattern
+ * to create the step interpolators by cloning an uninitialized model
+ * and later initializing the copy.
+ */
+ EulerFieldStepInterpolator() {
+ }
- /** Copy constructor.
- * @param interpolator interpolator to copy from. The copy is a deep
- * copy: its arrays are separated from the original arrays of the
- * instance
- */
- EulerFieldStepInterpolator(final EulerFieldStepInterpolator<T> interpolator) {
- super(interpolator);
- }
+ /** Copy constructor.
+ * @param interpolator interpolator to copy from. The copy is a deep
+ * copy: its arrays are separated from the original arrays of the
+ * instance
+ */
+ EulerFieldStepInterpolator(final EulerFieldStepInterpolator<T> interpolator) {
+ super(interpolator);
+ }
- /** {@inheritDoc} */
- @Override
- protected EulerFieldStepInterpolator<T> doCopy() {
- return new EulerFieldStepInterpolator<T>(this);
- }
+ /** {@inheritDoc} */
+ @Override
+ protected EulerFieldStepInterpolator<T> doCopy() {
+ return new EulerFieldStepInterpolator<T>(this);
+ }
+ /** {@inheritDoc} */
+ @Override
+ protected FieldODEStateAndDerivative<T> computeInterpolatedStateAndDerivatives(final FieldEquationsMapper<T> mapper,
+ final T time, final T theta,
+ final T oneMinusThetaH) {
+ final T[] interpolatedState = MathArrays.buildArray(theta.getField(), previousState.length);
+ if ((previousState != null) && (theta.getReal() <= 0.5)) {
+ for (int i = 0; i < previousState.length; ++i) {
+ interpolatedState[i] = previousState[i].add(theta.multiply(h).multiply(yDotK[0][i]));
+ }
+ } else {
+ for (int i = 0; i < previousState.length; ++i) {
+ interpolatedState[i] = currentState[i].subtract(oneMinusThetaH.multiply(yDotK[0][i]));
+ }
+ }
- /** {@inheritDoc} */
- @Override
- protected FieldODEStateAndDerivative<T> computeInterpolatedStateAndDerivatives(final FieldEquationsMapper<T> mapper,
- final T time, final T theta,
- final T oneMinusThetaH) {
- final T[] interpolatedState = MathArrays.buildArray(theta.getField(), previousState.length);
- if ((previousState != null) && (theta.getReal() <= 0.5)) {
- for (int i = 0; i < previousState.length; ++i) {
- interpolatedState[i] = previousState[i].add(theta.multiply(h).multiply(yDotK[0][i]));
- }
- } else {
- for (int i = 0; i < previousState.length; ++i) {
- interpolatedState[i] = currentState[i].subtract(oneMinusThetaH.multiply(yDotK[0][i]));
- }
- }
-
- return new FieldODEStateAndDerivative<T>(time,
- interpolatedState,
- yDotK[0]);
- }
+ return new FieldODEStateAndDerivative<T>(time, interpolatedState, yDotK[0]);
+ }
}