Class ComplexODEConverter

  • public class ComplexODEConverter
    extends Object
    This class converts complex Ordinary Differential Equations into real ones.

    This class is a wrapper around a ComplexOrdinaryDifferentialEquation which allow to use a ODEIntegrator 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 to computeDerivatives 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       = some integrator...;
       ComplexOrdinaryDifferentialEquation complexEquations = ...set up the complex problem...;
       ComplexODEState                     initialState     = ...set up initial state...;
       ComplexODEConverter                 converter        = new ComplexODEConverter();
       ComplexODEStateAndDerivative        finalstate       =

    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 using ExpandableODE as usual for regular real equations.

    See Also:
    ComplexOrdinaryDifferentialEquation, OrdinaryDifferentialEquation
    • Constructor Detail

      • ComplexODEConverter

        public ComplexODEConverter()
        Empty constructor.

        This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.

    • Method Detail

      • convertSecondaryEquations

        public SecondaryODE convertSecondaryEquations​(ComplexSecondaryODE equations)
        Convert a secondary equations set.
        equations - equations to convert
        converted equations
      • convertState

        public ODEState convertState​(ComplexODEState state)
        Convert a complex state (typically the initial state).
        state - state to convert
        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).
        state - state to convert
        converted state