| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
stan::math::coupled_ode_system< F, stan::math::var, double > Struct Template Reference

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 > &z, std::vector< double > &dz_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_

## Detailed Description

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

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.

Template Parameters

  F | type of base ODE system functor

Definition at line 262 of file coupled_ode_system.hpp.

## Constructor & Destructor Documentation

template<typename F >

stan::math::coupled_ode_system< F, stan::math::var, double >::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
| ) |  |
| 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.

Parameters

  [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 287 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, stan::math::var, double >::decouple_states | ( | const std::vector< std::vector< double > > & | y | ) |
| inline

Return the solutions to the basic ODE system, including appropriate autodiff partial derivatives, given the specified coupled system solution.

Parameters

  y | the vector of the coupled states after solving the ode

Definition at line 410 of file coupled_ode_system.hpp.

template<typename F >

std::vector<double> stan::math::coupled_ode_system< F, stan::math::var, double >::initial_state | ( |  | ) |
| 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.

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

Definition at line 398 of file coupled_ode_system.hpp.

template<typename F >

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

Calculates the derivative of the coupled ode system with respect to the state y at time t.

Parameters

  [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.

Exceptions

  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 323 of file coupled_ode_system.hpp.

template<typename F >

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

Returns the size of the coupled system.

Returns
  size of the coupled system.

Definition at line 380 of file coupled_ode_system.hpp.

## Member Data Documentation

template<typename F >

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

Definition at line 263 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 271 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 269 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 270 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 272 of file coupled_ode_system.hpp.

template<typename F >

const std::vector<double>& stan::math::coupled_ode_system< F, stan::math::var, double >::theta_dbl_

Definition at line 266 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 267 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 268 of file coupled_ode_system.hpp.

template<typename F >

const std::vector<stan::math::var>& stan::math::coupled_ode_system< F, stan::math::var, double >::y0_

Definition at line 264 of file coupled_ode_system.hpp.

template<typename F >

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

Definition at line 265 of file coupled_ode_system.hpp.

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

- stan/math/rev/arr/functor/coupled_ode_system.hpp

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