![]() |
Stan Math Library
2.8.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< stan::math::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 > &y, std::vector< double > &dy_dt, double t) |
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 () |
Returns the initial state of the coupled system. More... | |
std::vector< std::vector < stan::math::var > > | decouple_states (const std::vector< std::vector< double > > &y) |
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 < stan::math::var > & | y0_ |
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 274 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 299 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 420 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 408 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] | y | the current state of the coupled ode system. This is a a vector of double of length size(). |
[out] | dy_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. |
Definition at line 332 of file coupled_ode_system.hpp.
|
inline |
Returns the size of the coupled system.
Definition at line 390 of file coupled_ode_system.hpp.
const F& stan::math::coupled_ode_system< F, stan::math::var, double >::f_ |
Definition at line 275 of file coupled_ode_system.hpp.
const size_t stan::math::coupled_ode_system< F, stan::math::var, double >::M_ |
Definition at line 283 of file coupled_ode_system.hpp.
std::ostream* stan::math::coupled_ode_system< F, stan::math::var, double >::msgs_ |
Definition at line 281 of file coupled_ode_system.hpp.
const size_t stan::math::coupled_ode_system< F, stan::math::var, double >::N_ |
Definition at line 282 of file coupled_ode_system.hpp.
const size_t stan::math::coupled_ode_system< F, stan::math::var, double >::size_ |
Definition at line 284 of file coupled_ode_system.hpp.
const std::vector<double>& stan::math::coupled_ode_system< F, stan::math::var, double >::theta_dbl_ |
Definition at line 278 of file coupled_ode_system.hpp.
const std::vector<double>& stan::math::coupled_ode_system< F, stan::math::var, double >::x_ |
Definition at line 279 of file coupled_ode_system.hpp.
const std::vector<int>& stan::math::coupled_ode_system< F, stan::math::var, double >::x_int_ |
Definition at line 280 of file coupled_ode_system.hpp.
const std::vector<stan::math::var>& stan::math::coupled_ode_system< F, stan::math::var, double >::y0_ |
Definition at line 276 of file coupled_ode_system.hpp.
std::vector<double> stan::math::coupled_ode_system< F, stan::math::var, double >::y0_dbl_ |
Definition at line 277 of file coupled_ode_system.hpp.