org.apache.commons.math3.ode
Class JacobianMatrices.MainStateJacobianWrapper

java.lang.Object
  extended by org.apache.commons.math3.ode.JacobianMatrices.MainStateJacobianWrapper
All Implemented Interfaces:
FirstOrderDifferentialEquations, MainStateJacobianProvider
Enclosing class:
JacobianMatrices

private static class JacobianMatrices.MainStateJacobianWrapper
extends Object
implements MainStateJacobianProvider

Wrapper class to compute jacobian matrices by finite differences for ODE which do not compute them by themselves.


Field Summary
private  double[] hY
          Steps for finite difference computation of the jacobian df/dy w.r.t.
private  FirstOrderDifferentialEquations ode
          Raw ODE without jacobians computation skill to be wrapped into a MainStateJacobianProvider.
 
Constructor Summary
JacobianMatrices.MainStateJacobianWrapper(FirstOrderDifferentialEquations ode, double[] hY)
          Wrap a FirstOrderDifferentialEquations into a MainStateJacobianProvider.
 
Method Summary
 void computeDerivatives(double t, double[] y, double[] yDot)
          Get the current time derivative of the state vector.
 void computeMainStateJacobian(double t, double[] y, double[] yDot, double[][] dFdY)
          Compute the jacobian matrix of ODE with respect to main state.
 int getDimension()
          Get the dimension of the problem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ode

private final FirstOrderDifferentialEquations ode
Raw ODE without jacobians computation skill to be wrapped into a MainStateJacobianProvider.


hY

private final double[] hY
Steps for finite difference computation of the jacobian df/dy w.r.t. state.

Constructor Detail

JacobianMatrices.MainStateJacobianWrapper

public JacobianMatrices.MainStateJacobianWrapper(FirstOrderDifferentialEquations ode,
                                                 double[] hY)
                                          throws DimensionMismatchException
Wrap a FirstOrderDifferentialEquations into a MainStateJacobianProvider.

Parameters:
ode - original ODE problem, without jacobians computation skill
hY - step sizes to compute the jacobian df/dy
Throws:
DimensionMismatchException - if there is a dimension mismatch between the steps array hY and the equation dimension
See Also:
JacobianMatrices#setMainStateSteps(double[])
Method Detail

getDimension

public int getDimension()
Get the dimension of the problem.

Specified by:
getDimension in interface FirstOrderDifferentialEquations
Returns:
dimension of the problem

computeDerivatives

public void computeDerivatives(double t,
                               double[] y,
                               double[] yDot)
                        throws MaxCountExceededException,
                               DimensionMismatchException
Get the current time derivative of the state vector.

Specified by:
computeDerivatives in interface FirstOrderDifferentialEquations
Parameters:
t - current value of the independent time variable
y - array containing the current value of the state vector
yDot - placeholder array where to put the time derivative of the state vector
Throws:
MaxCountExceededException - if the number of functions evaluations is exceeded
DimensionMismatchException - if arrays dimensions do not match equations settings

computeMainStateJacobian

public void computeMainStateJacobian(double t,
                                     double[] y,
                                     double[] yDot,
                                     double[][] dFdY)
                              throws MaxCountExceededException,
                                     DimensionMismatchException
Compute the jacobian matrix of ODE with respect to main state.

Specified by:
computeMainStateJacobian in interface MainStateJacobianProvider
Parameters:
t - current value of the independent time variable
y - array containing the current value of the main state vector
yDot - array containing the current value of the time derivative of the main state vector
dFdY - placeholder array where to put the jacobian matrix of the ODE w.r.t. the main state vector
Throws:
MaxCountExceededException - if the number of functions evaluations is exceeded
DimensionMismatchException - if arrays dimensions do not match equations settings


Copyright (c) 2003-2013 Apache Software Foundation