Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
stan::math::coupled_ode_system< F, stan::agrad::var, stan::agrad::var > Struct Template Reference

The coupled ode system for unknown intial values and unknown parameters. More...

#include <coupled_ode_system.hpp>

Public Member Functions

 coupled_ode_system (const F &f, const std::vector< stan::agrad::var > &y0, const std::vector< stan::agrad::var > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs)
 Construct a coupled ODE system with unknown initial value and known parameters, given the base ODE system functor, the initial state of the base ODE, the parameters, data, and an output stream to which to write messages. More...
 
void operator() (const std::vector< double > &y, std::vector< double > &dy_dt, double t)
 Populates the derivative vector with derivatives of the coupled ODE system state with respect to time evaluated at the specified state and specified time. More...
 
int 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::agrad::var > > 
decouple_states (const std::vector< std::vector< double > > &y)
 Return the basic ODE solutions given the specified coupled system solutions, including the partials versus the parameters encoded in the autodiff results. More...
 

Public Attributes

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

Detailed Description

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

The coupled ode system for unknown intial values and unknown parameters.

The coupled system has N + N * (N + M) states, where N is size of the base ODE state vector and M is the number of parameters.

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

The next N+M states correspond to the sensitivities of the initial conditions, then to the parameters with respect to the to the first base system equation:

\[ \frac{d x_{N + n}}{dt} = \frac{d}{dt} \frac{\partial x_1}{\partial y0_n} \]

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

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

If the original ode has a state vector of size N states and a parameter vector of size M, the coupled system has N + N * (N

Template Parameters
Fthe functor for the base ode system

Definition at line 506 of file coupled_ode_system.hpp.

Constructor & Destructor Documentation

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

Construct a coupled ODE system with unknown initial value and known parameters, given the base ODE system functor, the initial state of the base ODE, the parameters, data, and an output stream to which to write messages.

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]msgsoutput stream to which to print messages.

Definition at line 532 of file coupled_ode_system.hpp.

Member Function Documentation

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

Return the basic ODE solutions given the specified coupled system solutions, including the partials versus the parameters encoded in the autodiff results.

Parameters
ythe vector of the coupled states after solving the ode

Definition at line 665 of file coupled_ode_system.hpp.

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

Returns the initial state of the coupled system.

Because the initial state is unknown, the coupled system incorporates the initial condition offset from zero as a parameter, and hence the return of this function is a vector of zeros.

Returns
the initial condition of the coupled system. This is a vector of length size() where all elements are 0.

Definition at line 653 of file coupled_ode_system.hpp.

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

Populates the derivative vector with derivatives of the coupled ODE system state with respect to time evaluated at the specified state and specified time.

Parameters
[in]ythe current state of the coupled ode system, of size size().
[in,out]dy_dtpopulate with the derivatives of the coupled system evaluated at the specified state and time.
[in]ttime.
Exceptions
exceptionif the base system does not return a derivative vector of the same size as the state vector.

Definition at line 570 of file coupled_ode_system.hpp.

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

Returns the size of the coupled system.

Returns
size of the coupled system.

Definition at line 638 of file coupled_ode_system.hpp.

Member Data Documentation

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

Definition at line 507 of file coupled_ode_system.hpp.

template<typename F >
const int stan::math::coupled_ode_system< F, stan::agrad::var, stan::agrad::var >::M_

Definition at line 515 of file coupled_ode_system.hpp.

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

Definition at line 517 of file coupled_ode_system.hpp.

template<typename F >
const int stan::math::coupled_ode_system< F, stan::agrad::var, stan::agrad::var >::N_

Definition at line 514 of file coupled_ode_system.hpp.

template<typename F >
const int stan::math::coupled_ode_system< F, stan::agrad::var, stan::agrad::var >::size_

Definition at line 516 of file coupled_ode_system.hpp.

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

Definition at line 510 of file coupled_ode_system.hpp.

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

Definition at line 511 of file coupled_ode_system.hpp.

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

Definition at line 512 of file coupled_ode_system.hpp.

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

Definition at line 513 of file coupled_ode_system.hpp.

template<typename F >
const std::vector<stan::agrad::var>& stan::math::coupled_ode_system< F, stan::agrad::var, stan::agrad::var >::y0_

Definition at line 508 of file coupled_ode_system.hpp.

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

Definition at line 509 of file coupled_ode_system.hpp.


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

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