Stan Math Library  2.11.0
reverse mode automatic differentiation
Public Member Functions | Public Attributes | List of all members
stan::math::coupled_ode_system< F, double, stan::math::var > Struct Template Reference

The coupled ODE system for known initial values and unknown parameters. More...

#include <coupled_ode_system.hpp>

Public Member Functions

 coupled_ode_system (const F &f, const std::vector< double > &y0, const std::vector< stan::math::var > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs)
 Construct a coupled ODE system with the specified base ODE system, base initial state, parameters, data, and a message stream. More...
 
void operator() (const std::vector< double > &z, std::vector< double > &dz_dt, double t)
 Assign the derivative vector with the system derivatives at the specified state and time. 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)
 Returns the base ODE system state corresponding to the specified coupled system state. More...
 

Public Attributes

const F & f_
 
const std::vector< double > & y0_dbl_
 
const std::vector< stan::math::var > & theta_
 
std::vector< double > theta_dbl_
 
const std::vector< double > & x_
 
const std::vector< int > & x_int_
 
const size_t N_
 
const size_t M_
 
const size_t size_
 
std::ostream * msgs_
 

Detailed Description

template<typename F>
struct stan::math::coupled_ode_system< F, double, stan::math::var >

The coupled ODE system for known initial values and unknown parameters.

If the base ODE state is size N and there are M parameters, the coupled system has N + N * M states.

The first N states correspond to the base system's N states: $ \frac{d x_n}{dt} $

The next M states correspond to the sensitivities of the parameters with respect to the first base system equation:

\[ \frac{d x_{N+m}}{dt} = \frac{d}{dt} \frac{\partial x_1}{\partial \theta_m} \]

The final M states correspond to the sensitivities with respect to the second base system equation, etc.

Template Parameters
Ftype of functor for the base ode system.

Definition at line 63 of file coupled_ode_system.hpp.

Constructor & Destructor Documentation

template<typename F >
stan::math::coupled_ode_system< F, double, stan::math::var >::coupled_ode_system ( const F &  f,
const std::vector< double > &  y0,
const std::vector< stan::math::var > &  theta,
const std::vector< double > &  x,
const std::vector< int > &  x_int,
std::ostream *  msgs 
)
inline

Construct a coupled ODE system with the specified base ODE system, base initial state, parameters, data, and a message stream.

Parameters
[in]fthe base ODE system functor.
[in]y0the initial state of the base ode.
[in]thetaparameters of the base ode.
[in]xreal data.
[in]x_intinteger data.
[in,out]msgsstream to which messages are printed.

Definition at line 87 of file coupled_ode_system.hpp.

Member Function Documentation

template<typename F >
std::vector<std::vector<stan::math::var> > stan::math::coupled_ode_system< F, double, stan::math::var >::decouple_states ( const std::vector< std::vector< double > > &  y)
inline

Returns the base ODE system state corresponding to the specified coupled system state.

Parameters
ycoupled states after solving the ode

Definition at line 212 of file coupled_ode_system.hpp.

template<typename F >
std::vector<double> stan::math::coupled_ode_system< F, double, stan::math::var >::initial_state ( )
inline

Returns the initial state of the coupled system.

Because the initial values are known, the initial state of the coupled system is the same as the initial state of the base ODE system.

This initial state returned is of size size() where the first N (base ODE system size) parameters are the initial conditions of the base ode system and the rest of the initial condition elements are 0.

Returns
the initial condition of the coupled system.

Definition at line 198 of file coupled_ode_system.hpp.

template<typename F >
void stan::math::coupled_ode_system< F, double, stan::math::var >::operator() ( const std::vector< double > &  z,
std::vector< double > &  dz_dt,
double  t 
)
inline

Assign the derivative vector with the system derivatives at the specified state and time.

The input state must be of size size(), and the output produced will be of the same size.

Parameters
[in]zstate of the coupled ode system.
[out]dz_dtpopulated with the derivatives of the coupled system at the specified state and time.
[in]ttime.
Exceptions
exceptionif the system function does not return the same number of derivatives as the state vector size.

y is the base ODE system state

Definition at line 124 of file coupled_ode_system.hpp.

template<typename F >
size_t stan::math::coupled_ode_system< F, double, stan::math::var >::size ( ) const
inline

Returns the size of the coupled system.

Returns
size of the coupled system.

Definition at line 181 of file coupled_ode_system.hpp.

Member Data Documentation

template<typename F >
const F& stan::math::coupled_ode_system< F, double, stan::math::var >::f_

Definition at line 64 of file coupled_ode_system.hpp.

template<typename F >
const size_t stan::math::coupled_ode_system< F, double, stan::math::var >::M_

Definition at line 71 of file coupled_ode_system.hpp.

template<typename F >
std::ostream* stan::math::coupled_ode_system< F, double, stan::math::var >::msgs_

Definition at line 73 of file coupled_ode_system.hpp.

template<typename F >
const size_t stan::math::coupled_ode_system< F, double, stan::math::var >::N_

Definition at line 70 of file coupled_ode_system.hpp.

template<typename F >
const size_t stan::math::coupled_ode_system< F, double, stan::math::var >::size_

Definition at line 72 of file coupled_ode_system.hpp.

template<typename F >
const std::vector<stan::math::var>& stan::math::coupled_ode_system< F, double, stan::math::var >::theta_

Definition at line 66 of file coupled_ode_system.hpp.

template<typename F >
std::vector<double> stan::math::coupled_ode_system< F, double, stan::math::var >::theta_dbl_

Definition at line 67 of file coupled_ode_system.hpp.

template<typename F >
const std::vector<double>& stan::math::coupled_ode_system< F, double, stan::math::var >::x_

Definition at line 68 of file coupled_ode_system.hpp.

template<typename F >
const std::vector<int>& stan::math::coupled_ode_system< F, double, stan::math::var >::x_int_

Definition at line 69 of file coupled_ode_system.hpp.

template<typename F >
const std::vector<double>& stan::math::coupled_ode_system< F, double, stan::math::var >::y0_dbl_

Definition at line 65 of file coupled_ode_system.hpp.


The documentation for this struct was generated from the following file:

     [ Stan Home Page ] © 2011–2016, Stan Development Team.