Package org.apache.commons.math3.ode
Class JacobianMatrices.MainStateJacobianWrapper
java.lang.Object
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
FieldsModifier and TypeFieldDescriptionprivate final double[]Steps for finite difference computation of the jacobian df/dy w.r.t.private final FirstOrderDifferentialEquationsRaw ODE without jacobians computation skill to be wrapped into a MainStateJacobianProvider. -
Constructor Summary
ConstructorsConstructorDescriptionMainStateJacobianWrapper(FirstOrderDifferentialEquations ode, double[] hY) Wrap aFirstOrderDifferentialEquationsinto aMainStateJacobianProvider. -
Method Summary
Modifier and TypeMethodDescriptionvoidcomputeDerivatives(double t, double[] y, double[] yDot) Get the current time derivative of the state vector.voidcomputeMainStateJacobian(double t, double[] y, double[] yDot, double[][] dFdY) Compute the jacobian matrix of ODE with respect to main state.intGet the dimension of the problem.
-
Field Details
-
ode
Raw ODE without jacobians computation skill to be wrapped into a MainStateJacobianProvider. -
hY
private final double[] hYSteps for finite difference computation of the jacobian df/dy w.r.t. state.
-
-
Constructor Details
-
MainStateJacobianWrapper
MainStateJacobianWrapper(FirstOrderDifferentialEquations ode, double[] hY) throws DimensionMismatchException Wrap aFirstOrderDifferentialEquationsinto aMainStateJacobianProvider.- Parameters:
ode- original ODE problem, without jacobians computation skillhY- step sizes to compute the jacobian df/dy- Throws:
DimensionMismatchException- if there is a dimension mismatch between the steps arrayhYand the equation dimension
-
-
Method Details
-
getDimension
public int getDimension()Get the dimension of the problem.- Specified by:
getDimensionin interfaceFirstOrderDifferentialEquations- 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:
computeDerivativesin interfaceFirstOrderDifferentialEquations- Parameters:
t- current value of the independent time variabley- array containing the current value of the state vectoryDot- placeholder array where to put the time derivative of the state vector- Throws:
MaxCountExceededException- if the number of functions evaluations is exceededDimensionMismatchException- 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:
computeMainStateJacobianin interfaceMainStateJacobianProvider- Parameters:
t- current value of the independent time variabley- array containing the current value of the main state vectoryDot- array containing the current value of the time derivative of the main state vectordFdY- 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 exceededDimensionMismatchException- if arrays dimensions do not match equations settings
-