![]() |
Stan Math Library
2.15.0
reverse mode automatic differentiation
|
The coupled ODE system for unknown initial values and known parameters. More...
#include <coupled_ode_system.hpp>
Public Member Functions | |
coupled_ode_system (const F &f, const std::vector< var > &y0, const std::vector< double > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs) | |
Construct a coupled ODE system for an unknown initial state and known parameters givne the specified base system functor, base initial state, parameters, data, and an output stream for messages. More... | |
void | operator() (const std::vector< double > &z, std::vector< double > &dz_dt, double t) const |
Calculates the derivative of the coupled ode system with respect to the state y at time t. More... | |
size_t | size () const |
Returns the size of the coupled system. More... | |
std::vector< double > | initial_state () const |
Returns the initial state of the coupled system. More... | |
std::vector< std::vector< var > > | decouple_states (const std::vector< std::vector< double > > &y) const |
Return the solutions to the basic ODE system, including appropriate autodiff partial derivatives, given the specified coupled system solution. More... | |
Public Attributes | |
const F & | f_ |
const std::vector< var > & | y0_ |
const std::vector< double > | y0_dbl_ |
const std::vector< double > & | theta_dbl_ |
const std::vector< double > & | x_ |
const std::vector< int > & | x_int_ |
std::ostream * | msgs_ |
const size_t | N_ |
const size_t | M_ |
const size_t | size_ |
The coupled ODE system for unknown initial values and known parameters.
If the original ODE has states of size N, the coupled system has N + N * N states. (derivatives of each state with respect to each initial value)
The coupled system has N + N * N states, where N is the size of the state vector in the base system.
The first N states correspond to the base system's N states:
The next N states correspond to the sensitivities of the initial conditions with respect to the to the first base system equation:
The next N states correspond to the sensitivities with respect to the second base system equation, etc.
F | type of base ODE system functor |
Definition at line 252 of file coupled_ode_system.hpp.
|
inline |
Construct a coupled ODE system for an unknown initial state and known parameters givne the specified base system functor, base initial state, parameters, data, and an output stream for messages.
[in] | f | base ODE system functor. |
[in] | y0 | initial state of the base ODE. |
[in] | theta | system parameters. |
[in] | x | real data. |
[in] | x_int | integer data. |
[in,out] | msgs | output stream for messages. |
Definition at line 277 of file coupled_ode_system.hpp.
|
inline |
Return the solutions to the basic ODE system, including appropriate autodiff partial derivatives, given the specified coupled system solution.
y | the vector of the coupled states after solving the ode |
Definition at line 393 of file coupled_ode_system.hpp.
|
inline |
Returns the initial state of the coupled system.
Because the starting state is unknown, the coupled system incorporates the initial conditions as parameters. The initial conditions for the coupled part of the system are set to zero along with the rest of the initial state, because the value of the initial state has been moved into the parameters.
Definition at line 381 of file coupled_ode_system.hpp.
|
inline |
Calculates the derivative of the coupled ode system with respect to the state y at time t.
[in] | z | the current state of the coupled, shifted ode system. This is a a vector of double of length size(). |
[out] | dz_dt | a vector of length size() with the derivatives of the coupled system evaluated with state y and time t. |
[in] | t | time. |
exception | if the system functor does not return a derivative vector of the same size as the state vector. |
y is the base ODE system state
Definition at line 310 of file coupled_ode_system.hpp.
|
inline |
Returns the size of the coupled system.
Definition at line 363 of file coupled_ode_system.hpp.
const F& stan::math::coupled_ode_system< F, var, double >::f_ |
Definition at line 253 of file coupled_ode_system.hpp.
const size_t stan::math::coupled_ode_system< F, var, double >::M_ |
Definition at line 261 of file coupled_ode_system.hpp.
std::ostream* stan::math::coupled_ode_system< F, var, double >::msgs_ |
Definition at line 259 of file coupled_ode_system.hpp.
const size_t stan::math::coupled_ode_system< F, var, double >::N_ |
Definition at line 260 of file coupled_ode_system.hpp.
const size_t stan::math::coupled_ode_system< F, var, double >::size_ |
Definition at line 262 of file coupled_ode_system.hpp.
const std::vector<double>& stan::math::coupled_ode_system< F, var, double >::theta_dbl_ |
Definition at line 256 of file coupled_ode_system.hpp.
const std::vector<double>& stan::math::coupled_ode_system< F, var, double >::x_ |
Definition at line 257 of file coupled_ode_system.hpp.
const std::vector<int>& stan::math::coupled_ode_system< F, var, double >::x_int_ |
Definition at line 258 of file coupled_ode_system.hpp.
const std::vector<var>& stan::math::coupled_ode_system< F, var, double >::y0_ |
Definition at line 254 of file coupled_ode_system.hpp.
const std::vector<double> stan::math::coupled_ode_system< F, var, double >::y0_dbl_ |
Definition at line 255 of file coupled_ode_system.hpp.