Top Description Fields Constructors Methods
org.apache.commons.math3.ode.nonstiff

pack-priv Class GraggBulirschStoerStepInterpolator

extends AbstractStepInterpolator
Class Inheritance
Imports
java.io.IOException, .ObjectInput, .ObjectOutput, org.apache.commons.math3.ode.EquationsMapper, org.apache.commons.math3.ode.sampling.AbstractStepInterpolator, .StepInterpolator, org.apache.commons.math3.util.FastMath

This class implements an interpolator for the Gragg-Bulirsch-Stoer integrator.

This interpolator compute dense output inside the last step produced by a Gragg-Bulirsch-Stoer integrator.

This implementation is basically a reimplementation in Java of the odex fortran code by E. Hairer and G. Wanner. The redistribution policy for this code is available here, for convenience, it is reproduced below.

Copyright (c) 2004, Ernst Hairer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Since
1.2
See Also
GraggBulirschStoerIntegrator

Field Summary

Modifier and TypeField and Description
private int
currentDegree

Degree of the interpolation polynomials.

private double[]
errfac

Error coefficients for the interpolation.

private double[][]
polynomials

Interpolation polynomials.

private static final long
serialVersionUID

Serializable version identifier.

private double[]
y0Dot

Slope at the beginning of the step.

private double[]
y1

State at the end of the step.

private double[]
y1Dot

Slope at the end of the step.

private double[][]
yMidDots

Derivatives at the middle of the step.

Inherited from org.apache.commons.math3.ode.sampling.AbstractStepInterpolator:
currentStatehinterpolatedDerivativesinterpolatedPrimaryDerivativesinterpolatedPrimaryStateinterpolatedSecondaryDerivativesinterpolatedSecondaryStateinterpolatedStateinterpolatedTime

Constructor Summary

AccessConstructor and Description
public
pack-priv
GraggBulirschStoerStepInterpolator(final double[]
reference to the integrator array holding the current state
y
,
final double[]
reference to the integrator array holding the slope at the beginning of the step
y0Dot
,
final double[]
reference to the integrator array holding the state at the end of the step
y1
,
final double[]
reference to the integrator array holding the slope at the end of the step
y1Dot
,
final double[][]
reference to the integrator array holding the derivatives at the middle point of the step
yMidDots
,
final boolean
integration direction indicator
forward
,
final EquationsMapper
equations mapper for the primary equations set
primaryMapper
,
final EquationsMapper[]
equations mappers for the secondary equations sets
secondaryMappers
)

Simple constructor.

pack-priv
GraggBulirschStoerStepInterpolator(final GraggBulirschStoerStepInterpolator
interpolator to copy from. The copy is a deep copy: its arrays are separated from the original arrays of the instance
interpolator
)

Copy constructor.

Method Summary

Modifier and TypeMethod and Description
public void
computeCoefficients(final int
degree of the interpolation polynomial
mu
,
final double
current step
h
)

Compute the interpolation coefficients for dense output.

protected void
computeInterpolatedStateAndDerivatives(final double
normalized interpolation abscissa within the step (theta is zero at the previous time step and one at the current time step)
theta
,
final double
time gap between the interpolated time and the current time
oneMinusThetaH
)

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.computeInterpolatedStateAndDerivatives.

Compute the state and derivatives at the interpolated time.

protected StepInterpolator
doCopy()

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.doCopy.

Really copy the finalized instance.

public double

Returns:

estimate of the interpolation error
estimateError
(final double[]
scaling array
scale
)

Estimate interpolation error.

public void
readExternal(final ObjectInput
the stream to read data from in order to restore the object
in
)

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.readExternal.

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

private void
resetTables(final int
maximal degree to handle
maxDegree
)

Reallocate the internal tables.

public void
writeExternal(final ObjectOutput
the stream to write the object to
out
)

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.writeExternal.

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from org.apache.commons.math3.ode.sampling.AbstractStepInterpolator:
copydoFinalizefinalizeStepgetCurrentTimegetGlobalCurrentTimegetGlobalPreviousTimegetInterpolatedDerivativesgetInterpolatedSecondaryDerivativesgetInterpolatedSecondaryStategetInterpolatedStategetInterpolatedTimegetPreviousTimeisForwardreadBaseExternalreinitializesetInterpolatedTimesetSoftCurrentTimesetSoftPreviousTimeshiftstoreTimewriteBaseExternal

Field Detail

currentDegreeback to summary
private int currentDegree

Degree of the interpolation polynomials.

errfacback to summary
private double[] errfac

Error coefficients for the interpolation.

polynomialsback to summary
private double[][] polynomials

Interpolation polynomials.

serialVersionUIDback to summary
private static final long serialVersionUID

Serializable version identifier.

y0Dotback to summary
private double[] y0Dot

Slope at the beginning of the step.

y1back to summary
private double[] y1

State at the end of the step.

y1Dotback to summary
private double[] y1Dot

Slope at the end of the step.

yMidDotsback to summary
private double[][] yMidDots

Derivatives at the middle of the step. element 0 is state at midpoint, element 1 is first derivative ...

Constructor Detail

GraggBulirschStoerStepInterpolatorback to summary
public GraggBulirschStoerStepInterpolator()

Simple constructor. This constructor should not be used directly, it is only intended for the serialization process.

GraggBulirschStoerStepInterpolatorback to summary
pack-priv GraggBulirschStoerStepInterpolator(final double[] y, final double[] y0Dot, final double[] y1, final double[] y1Dot, final double[][] yMidDots, final boolean forward, final EquationsMapper primaryMapper, final EquationsMapper[] secondaryMappers)

Simple constructor.

Parameters
y:double[]

reference to the integrator array holding the current state

y0Dot:double[]

reference to the integrator array holding the slope at the beginning of the step

y1:double[]

reference to the integrator array holding the state at the end of the step

y1Dot:double[]

reference to the integrator array holding the slope at the end of the step

yMidDots:double[][]

reference to the integrator array holding the derivatives at the middle point of the step

forward:boolean

integration direction indicator

primaryMapper:EquationsMapper

equations mapper for the primary equations set

secondaryMappers:EquationsMapper[]

equations mappers for the secondary equations sets

GraggBulirschStoerStepInterpolatorback to summary
pack-priv GraggBulirschStoerStepInterpolator(final GraggBulirschStoerStepInterpolator interpolator)

Copy constructor.

Parameters
interpolator:GraggBulirschStoerStepInterpolator

interpolator to copy from. The copy is a deep copy: its arrays are separated from the original arrays of the instance

Method Detail

computeCoefficientsback to summary
public void computeCoefficients(final int mu, final double h)

Compute the interpolation coefficients for dense output.

Parameters
mu:int

degree of the interpolation polynomial

h:double

current step

computeInterpolatedStateAndDerivativesback to summary
protected void computeInterpolatedStateAndDerivatives(final double theta, final double oneMinusThetaH)

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.computeInterpolatedStateAndDerivatives.

Doc from org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.computeInterpolatedStateAndDerivatives.

Compute the state and derivatives at the interpolated time. This is the main processing method that should be implemented by the derived classes to perform the interpolation.

Parameters
theta:double

normalized interpolation abscissa within the step (theta is zero at the previous time step and one at the current time step)

oneMinusThetaH:double

time gap between the interpolated time and the current time

Annotations
@Override
doCopyback to summary
protected StepInterpolator doCopy()

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.doCopy.

Doc from org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.doCopy.

Really copy the finalized instance.

This method is called by copy() after the step has been finalized. It must perform a deep copy to have an new instance completely independent for the original instance.

Returns:StepInterpolator

a copy of the finalized instance

Annotations
@Override
estimateErrorback to summary
public double estimateError(final double[] scale)

Estimate interpolation error.

Parameters
scale:double[]

scaling array

Returns:double

estimate of the interpolation error

readExternalback to summary
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.readExternal.

Implements java.io.Externalizable.readExternal.

Doc from org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters
in:ObjectInput

Doc from java.io.Externalizable.readExternal.

the stream to read data from in order to restore the object

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Externalizable.readExternal.

if I/O errors occur

ClassNotFoundException:

Doc from java.io.Externalizable.readExternal.

If the class for an object being restored cannot be found.

resetTablesback to summary
private void resetTables(final int maxDegree)

Reallocate the internal tables. Reallocate the internal tables in order to be able to handle interpolation polynomials up to the given degree

Parameters
maxDegree:int

maximal degree to handle

writeExternalback to summary
public void writeExternal(final ObjectOutput out) throws IOException

Implements abstract org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.writeExternal.

Implements java.io.Externalizable.writeExternal.

Doc from org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

Doc from java.io.Externalizable.writeExternal.

the stream to write the object to

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Externalizable.writeExternal.

Includes any I/O exceptions that may occur