Class ComplexODEConverter
- java.lang.Object
-
- org.hipparchus.ode.ComplexODEConverter
-
public class ComplexODEConverter extends Object
This class convertscomplex Ordinary Differential Equations
intoreal ones
.This class is a wrapper around a
ComplexOrdinaryDifferentialEquation
which allow to use aODEIntegrator
to integrate it.The transformation is done by changing the n dimension state vector to a 2n dimension vector, where the even components are real parts and odd components are imaginary parts.
One should be aware that the data is duplicated during the transformation process and that for each call to
computeDerivatives
, this wrapper does copy 4n scalars : 2n before the call tocomputeDerivatives
in order to dispatch the y state vector, and 2n after the call to gather zDot. Since the underlying problem by itself perhaps also needs to copy data and dispatch the arrays into domain objects, this has an impact on both memory and CPU usage. The only way to avoid this duplication is to perform the transformation at the problem level, i.e. to implement the problem as a first order one and then avoid using this class.The proper way to use the converter is as follows:
ODEIntegrator integrator = ...build some integrator...; ComplexOrdinaryDifferentialEquation complexEquations = ...set up the complex problem...; ComplexODEState initialState = ...set up initial state...; ComplexODEConverter converter = new ComplexODEConverter(); ComplexODEStateAndDerivative finalstate = converter.convertStateAndDerivative(integrator.integrate(converter.convertEquations(complexEquations), converter.convertState(initialState), t);
If there are
complex secondary equations
, they must be converted too and both the converted primary equations and converted secondary equations must be combined together usingExpandableODE
as usual for regular real equations.- Since:
- 1.4
- See Also:
ComplexOrdinaryDifferentialEquation
,OrdinaryDifferentialEquation
-
-
Constructor Summary
Constructors Constructor Description ComplexODEConverter()
Empty constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrdinaryDifferentialEquation
convertEquations(ComplexOrdinaryDifferentialEquation equations)
Convert an equations set.SecondaryODE
convertSecondaryEquations(ComplexSecondaryODE equations)
Convert a secondary equations set.ODEState
convertState(ComplexODEState state)
Convert a complex state (typically the initial state).ComplexODEStateAndDerivative
convertState(ODEStateAndDerivative state)
Convert a real state and derivatives (typically the final state or some intermediate state for step handling or event handling).
-
-
-
Method Detail
-
convertEquations
public OrdinaryDifferentialEquation convertEquations(ComplexOrdinaryDifferentialEquation equations)
Convert an equations set.- Parameters:
equations
- equations to convert- Returns:
- converted equations
-
convertSecondaryEquations
public SecondaryODE convertSecondaryEquations(ComplexSecondaryODE equations)
Convert a secondary equations set.- Parameters:
equations
- equations to convert- Returns:
- converted equations
-
convertState
public ODEState convertState(ComplexODEState state)
Convert a complex state (typically the initial state).- Parameters:
state
- state to convert- Returns:
- converted state
-
convertState
public ComplexODEStateAndDerivative convertState(ODEStateAndDerivative state)
Convert a real state and derivatives (typically the final state or some intermediate state for step handling or event handling).- Parameters:
state
- state to convert- Returns:
- converted state
-
-