org.apache.commons.math.ode.jacobians

## Class FirstOrderIntegratorWithJacobians

- java.lang.Object
- - org.apache.commons.math.ode.jacobians.FirstOrderIntegratorWithJacobians

- Deprecated.
  as of 2.2 the complete package is deprecated, it will be replaced in 3.0 by a completely rewritten implementation

      @Deprecated
      public class FirstOrderIntegratorWithJacobians
      extends Object

  This class enhances a first order integrator for differential equations to compute also partial derivatives of the solution with respect to initial state and parameters.

  In order to compute both the state and its derivatives, the ODE problem is extended with jacobians of the raw ODE and the variational equations are added to form a new compound problem of higher dimension. If the original ODE problem has dimension n and there are p parameters, the compound problem will have dimension n × (1 + n + p).

  Since:
    2.1
  Version:
    $Revision: 1073158 $ $Date: 2011-02-21 22:46:52 +0100 (lun. 21 févr. 2011) $
  See Also:
    `ParameterizedODE`, `ODEWithJacobians`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private static class` | `FirstOrderIntegratorWithJacobians.EventHandlerWrapper` Deprecated. Wrapper for event handlers.
    `private class` | `FirstOrderIntegratorWithJacobians.FiniteDifferencesWrapper` Deprecated. Wrapper class to compute jacobians by finite differences for ODE which do not compute them themselves.
    `private class` | `FirstOrderIntegratorWithJacobians.MappingWrapper` Deprecated. Wrapper class used to map state and jacobians into compound state.
    `private static class` | `FirstOrderIntegratorWithJacobians.StepHandlerWrapper` Deprecated. Wrapper for step handlers.
    `private static class` | `FirstOrderIntegratorWithJacobians.StepInterpolatorWrapper` Deprecated. Wrapper for step interpolators.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `evaluations` Deprecated. Number of evaluations already performed.
    `private FirstOrderIntegrator` | `integrator` Deprecated. Underlying integrator for compound problem.
    `private int` | `maxEvaluations` Deprecated. Maximal number of evaluations allowed.
    `private ODEWithJacobians` | `ode` Deprecated. Raw equations to integrate.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FirstOrderIntegratorWithJacobians(FirstOrderIntegrator integrator, ODEWithJacobians ode)` Deprecated. Build an enhanced integrator using ODE builtin jacobian computation features.
    `FirstOrderIntegratorWithJacobians(FirstOrderIntegrator integrator, ParameterizedODE ode, double[] p, double[] hY, double[] hP)` Deprecated. Build an enhanced integrator using internal differentiation to compute jacobians.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addEventHandler(EventHandlerWithJacobians handler, double maxCheckInterval, double convergence, int maxIterationCount)` Deprecated. Add an event handler to the integrator.
    `void` | `addStepHandler(StepHandlerWithJacobians handler)` Deprecated. Add a step handler to this integrator.
    `private void` | `checkDimension(int expected, Object array)` Deprecated. Check array dimensions.
    `void` | `clearEventHandlers()` Deprecated. Remove all the event handlers that have been added to the integrator.
    `void` | `clearStepHandlers()` Deprecated. Remove all the step handlers that have been added to the integrator.
    `private static void` | `dispatchCompoundState(double[] z, double[] y, double[][] dydy0, double[][] dydp)` Deprecated. Dispatch a compound state array into state and jacobians arrays.
    `double` | `getCurrentSignedStepsize()` Deprecated. Get the current signed value of the integration stepsize.
    `double` | `getCurrentStepStart()` Deprecated. Get the current value of the step start time ti.
    `int` | `getEvaluations()` Deprecated. Get the number of evaluations of the differential equations function.
    `Collection<EventHandlerWithJacobians>` | `getEventHandlers()` Deprecated. Get all the event handlers that have been added to the integrator.
    `int` | `getMaxEvaluations()` Deprecated. Get the maximal number of functions evaluations.
    `Collection<StepHandlerWithJacobians>` | `getStepHandlers()` Deprecated. Get all the step handlers that have been added to the integrator.
    `double` | `integrate(double t0, double[] y0, double[][] dY0dP, double t, double[] y, double[][] dYdY0, double[][] dYdP)` Deprecated. Integrate the differential equations and the variational equations up to the given time.
    `void` | `setMaxEvaluations(int maxEvaluations)` Deprecated. Set the maximal number of differential equations function evaluations.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### integrator

          private final FirstOrderIntegrator integrator

      Deprecated.
      Underlying integrator for compound problem.

    - #### ode

          private final ODEWithJacobians ode

      Deprecated.
      Raw equations to integrate.

    - #### maxEvaluations

          private int maxEvaluations

      Deprecated.
      Maximal number of evaluations allowed.

    - #### evaluations

          private int evaluations

      Deprecated.
      Number of evaluations already performed.

  - ### Constructor Detail

    - #### FirstOrderIntegratorWithJacobians

          public FirstOrderIntegratorWithJacobians(FirstOrderIntegrator integrator,
                                           ParameterizedODE ode,
                                           double[] p,
                                           double[] hY,
                                           double[] hP)

      Deprecated.
      Build an enhanced integrator using internal differentiation to compute jacobians.
      Parameters:
        `integrator` - underlying integrator to solve the compound problem
        `ode` - original problem (f in the equation y' = f(t, y))
        `p` - parameters array (may be null if `getParametersDimension()` from original problem is zero)
        `hY` - step sizes to use for computing the jacobian df/dy, must have the same dimension as the original problem
        `hP` - step sizes to use for computing the jacobian df/dp, must have the same dimension as the original problem parameters dimension
      See Also:
        `FirstOrderIntegratorWithJacobians(FirstOrderIntegrator, ODEWithJacobians)`

    - #### FirstOrderIntegratorWithJacobians

          public FirstOrderIntegratorWithJacobians(FirstOrderIntegrator integrator,
                                           ODEWithJacobians ode)

      Deprecated.
      Build an enhanced integrator using ODE builtin jacobian computation features.
      Parameters:
        `integrator` - underlying integrator to solve the compound problem
        `ode` - original problem, which can compute the jacobians by itself
      See Also:
        `FirstOrderIntegratorWithJacobians(FirstOrderIntegrator, ParameterizedODE, double[], double[], double[])`

  - ### Method Detail

    - #### addStepHandler

          public void addStepHandler(StepHandlerWithJacobians handler)

      Deprecated.
      Add a step handler to this integrator.

      The handler will be called by the integrator for each accepted step.

      Parameters:
        `handler` - handler for the accepted steps
      See Also:
        `getStepHandlers()`, `clearStepHandlers()`

    - #### getStepHandlers

          public Collection<StepHandlerWithJacobians> getStepHandlers()

      Deprecated.
      Get all the step handlers that have been added to the integrator.
      Returns:
        an unmodifiable collection of the added events handlers
      See Also:
        `addStepHandler(StepHandlerWithJacobians)`, `clearStepHandlers()`

    - #### clearStepHandlers

          public void clearStepHandlers()

      Deprecated.
      Remove all the step handlers that have been added to the integrator.
      See Also:
        `addStepHandler(StepHandlerWithJacobians)`, `getStepHandlers()`

    - #### addEventHandler

          public void addEventHandler(EventHandlerWithJacobians handler,
                             double maxCheckInterval,
                             double convergence,
                             int maxIterationCount)

      Deprecated.
      Add an event handler to the integrator.
      Parameters:
        `handler` - event handler
        `maxCheckInterval` - maximal time interval between switching function checks (this interval prevents missing sign changes in case the integration steps becomes very large)
        `convergence` - convergence threshold in the event time search
        `maxIterationCount` - upper limit of the iteration count in the event time search
      See Also:
        `getEventHandlers()`, `clearEventHandlers()`

    - #### getEventHandlers

          public Collection<EventHandlerWithJacobians> getEventHandlers()

      Deprecated.
      Get all the event handlers that have been added to the integrator.
      Returns:
        an unmodifiable collection of the added events handlers
      See Also:
        `addEventHandler(EventHandlerWithJacobians, double, double, int)`, `clearEventHandlers()`

    - #### clearEventHandlers

          public void clearEventHandlers()

      Deprecated.
      Remove all the event handlers that have been added to the integrator.
      See Also:
        `addEventHandler(EventHandlerWithJacobians, double, double, int)`, `getEventHandlers()`

    - #### integrate

          public double integrate(double t0,
                         double[] y0,
                         double[][] dY0dP,
                         double t,
                         double[] y,
                         double[][] dYdY0,
                         double[][] dYdP)
                           throws DerivativeException,
                                  IntegratorException

      Deprecated.
      Integrate the differential equations and the variational equations up to the given time.

      This method solves an Initial Value Problem (IVP) and also computes the derivatives of the solution with respect to initial state and parameters. This can be used as a basis to solve Boundary Value Problems (BVP).

      Since this method stores some internal state variables made available in its public interface during integration (`getCurrentSignedStepsize()`), it is not thread-safe.

      Parameters:
        `t0` - initial time
        `y0` - initial value of the state vector at t0
        `dY0dP` - initial value of the state vector derivative with respect to the parameters at t0
        `t` - target time for the integration (can be set to a value smaller than `t0` for backward integration)
        `y` - placeholder where to put the state vector at each successful step (and hence at the end of integration), can be the same object as y0
        `dYdY0` - placeholder where to put the state vector derivative with respect to the initial state (dy[i]/dy0[j] is in element array dYdY0[i][j]) at each successful step (and hence at the end of integration)
        `dYdP` - placeholder where to put the state vector derivative with respect to the parameters (dy[i]/dp[j] is in element array dYdP[i][j]) at each successful step (and hence at the end of integration)
      Returns:
        stop time, will be the same as target time if integration reached its target, but may be different if some event handler stops it at some point.
      Throws:
        `IntegratorException` - if the integrator cannot perform integration
        `DerivativeException` - this exception is propagated to the caller if the underlying user function triggers one

    - #### dispatchCompoundState

          private static void dispatchCompoundState(double[] z,
                                   double[] y,
                                   double[][] dydy0,
                                   double[][] dydp)

      Deprecated.
      Dispatch a compound state array into state and jacobians arrays.
      Parameters:
        `z` - compound state
        `y` - raw state array to fill
        `dydy0` - jacobian array to fill
        `dydp` - jacobian array to fill

    - #### getCurrentStepStart

          public double getCurrentStepStart()

      Deprecated.
      Get the current value of the step start time ti.

      This method can be called during integration (typically by the object implementing the `differential equations` problem) if the value of the current step that is attempted is needed.

      The result is undefined if the method is called outside of calls to `integrate`.

      Returns:
        current value of the step start time ti

    - #### getCurrentSignedStepsize

          public double getCurrentSignedStepsize()

      Deprecated.
      Get the current signed value of the integration stepsize.

      This method can be called during integration (typically by the object implementing the `differential equations` problem) if the signed value of the current stepsize that is tried is needed.

      The result is undefined if the method is called outside of calls to `integrate`.

      Returns:
        current signed value of the stepsize

    - #### setMaxEvaluations

          public void setMaxEvaluations(int maxEvaluations)

      Deprecated.
      Set the maximal number of differential equations function evaluations.

      The purpose of this method is to avoid infinite loops which can occur for example when stringent error constraints are set or when lots of discrete events are triggered, thus leading to many rejected steps.

      Parameters:
        `maxEvaluations` - maximal number of function evaluations (negative values are silently converted to maximal integer value, thus representing almost unlimited evaluations)

    - #### getMaxEvaluations

          public int getMaxEvaluations()

      Deprecated.
      Get the maximal number of functions evaluations.
      Returns:
        maximal number of functions evaluations

    - #### getEvaluations

          public int getEvaluations()

      Deprecated.
      Get the number of evaluations of the differential equations function.

      The number of evaluations corresponds to the last call to the `integrate` method. It is 0 if the method has not been called yet.

      Returns:
        number of evaluations of the differential equations function

    - #### checkDimension

          private void checkDimension(int expected,
                            Object array)
                               throws IllegalArgumentException

      Deprecated.
      Check array dimensions.
      Parameters:
        `expected` - expected dimension
        `array` - (may be null if expected is 0)
      Throws:
        `IllegalArgumentException` - if the array dimension does not match the expected one

Copyright (c) 2003-2013 Apache Software Foundation