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

public Class NordsieckStepInterpolator

extends AbstractStepInterpolator
Class Inheritance
Imports
java.io.IOException, .ObjectInput, .ObjectOutput, java.util.Arrays, org.apache.commons.math3.exception.MaxCountExceededException, org.apache.commons.math3.linear.Array2DRowRealMatrix, org.apache.commons.math3.ode.EquationsMapper, org.apache.commons.math3.util.FastMath

This class implements an interpolator for integrators using Nordsieck representation.

This interpolator computes dense output around the current point. The interpolation equation is based on Taylor series formulas.

Since
2.0
See Also
org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator, org.apache.commons.math3.ode.nonstiff.AdamsMoultonIntegrator

Field Summary

Modifier and TypeField and Description
private Array2DRowRealMatrix
nordsieck

Nordsieck vector.

private double
referenceTime

Reference time for all arrays.

private double[]
scaled

First scaled derivative.

private double
scalingH

Step size used in the first scaled derivative and Nordsieck vector.

private static final long
serialVersionUID

Serializable version identifier

protected double[]
stateVariation

State variation.

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

Constructor Summary

AccessConstructor and Description
public
NordsieckStepInterpolator()

Simple constructor.

public
NordsieckStepInterpolator(final NordsieckStepInterpolator
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
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:

state vector at time getInterpolatedTime
getInterpolatedStateVariation
()

Get the state vector variation from current to interpolated state.

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.

public void
reinitialize(final double[]
reference to the integrator array holding the state at the end of the step
y
,
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
)

Overrides org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.reinitialize.

Reinitialize the instance.

public void
reinitialize(final double
time at which all arrays are defined
time
,
final double
step size used in the scaled and Nordsieck arrays
stepSize
,
final double[]
reference to the integrator array holding the first scaled derivative
scaledDerivative
,
final Array2DRowRealMatrix
reference to the integrator matrix holding the Nordsieck vector
nordsieckVector
)

Reinitialize the instance.

public void
rescale(final double
new step size to use in the scaled and Nordsieck arrays
stepSize
)

Rescale the instance.

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:
copydoFinalizefinalizeStepgetCurrentTimegetGlobalCurrentTimegetGlobalPreviousTimegetInterpolatedDerivativesgetInterpolatedSecondaryDerivativesgetInterpolatedSecondaryStategetInterpolatedStategetInterpolatedTimegetPreviousTimeisForwardreadBaseExternalsetInterpolatedTimesetSoftCurrentTimesetSoftPreviousTimeshiftstoreTimewriteBaseExternal

Field Detail

nordsieckback to summary
private Array2DRowRealMatrix nordsieck

Nordsieck vector.

referenceTimeback to summary
private double referenceTime

Reference time for all arrays.

Sometimes, the reference time is the same as previousTime, sometimes it is the same as currentTime, so we use a separate field to avoid any confusion.

scaledback to summary
private double[] scaled

First scaled derivative.

scalingHback to summary
private double scalingH

Step size used in the first scaled derivative and Nordsieck vector.

serialVersionUIDback to summary
private static final long serialVersionUID

Serializable version identifier

stateVariationback to summary
protected double[] stateVariation

State variation.

Constructor Detail

NordsieckStepInterpolatorback to summary
public NordsieckStepInterpolator()

Simple constructor. This constructor builds an instance that is not usable yet, the 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.

NordsieckStepInterpolatorback to summary
public NordsieckStepInterpolator(final NordsieckStepInterpolator interpolator)

Copy constructor.

Parameters
interpolator:NordsieckStepInterpolator

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

Method Detail

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
getInterpolatedStateVariationback to summary
public double[] getInterpolatedStateVariation() throws MaxCountExceededException

Get the state vector variation from current to interpolated state.

This method is aimed at computing y(tinterpolation) -y(tcurrent) accurately by avoiding the cancellation errors that would occur if the subtraction were performed explicitly.

The returned vector is a reference to a reused array, so it should not be modified and it should be copied if it needs to be preserved across several calls.

Returns:double[]

state vector at time getInterpolatedTime

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded
See Also
getInterpolatedDerivatives()
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.

reinitializeback to summary
public void reinitialize(final double[] y, final boolean forward, final EquationsMapper primaryMapper, final EquationsMapper[] secondaryMappers)

Overrides org.apache.commons.math3.ode.sampling.AbstractStepInterpolator.reinitialize.

Reinitialize the instance.

Beware that all arrays must be references to integrator arrays, in order to ensure proper update without copy.

Parameters
y:double[]

reference to the integrator array holding the state at the end 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

Annotations
@Override
reinitializeback to summary
public void reinitialize(final double time, final double stepSize, final double[] scaledDerivative, final Array2DRowRealMatrix nordsieckVector)

Reinitialize the instance.

Beware that all arrays must be references to integrator arrays, in order to ensure proper update without copy.

Parameters
time:double

time at which all arrays are defined

stepSize:double

step size used in the scaled and Nordsieck arrays

scaledDerivative:double[]

reference to the integrator array holding the first scaled derivative

nordsieckVector:Array2DRowRealMatrix

reference to the integrator matrix holding the Nordsieck vector

rescaleback to summary
public void rescale(final double stepSize)

Rescale the instance.

Since the scaled and Nordsieck arrays are shared with the caller, this method has the side effect of rescaling this arrays in the caller too.

Parameters
stepSize:double

new step size to use in the scaled and Nordsieck arrays

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