Stan Math Library  2.20.0
reverse mode automatic differentiation
Public Member Functions | List of all members
stan::math::cvodes_integrator< Lmm > Class Template Reference

Integrator interface for CVODES' ODE solvers (Adams & BDF methods). More...

#include <cvodes_integrator.hpp>

Public Member Functions

 cvodes_integrator ()
 
template<typename F , typename T_initial , typename T_param , typename T_t0 , typename T_ts >
std::vector< std::vector< typename stan::return_type< T_initial, T_param, T_t0, T_ts >::type > > integrate (const F &f, const std::vector< T_initial > &y0, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< T_param > &theta, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs, double relative_tolerance, double absolute_tolerance, long int max_num_steps)
 Return the solutions for the specified system of ordinary differential equations given the specified initial state, initial times, times of desired solution, and parameters and data, writing error and warning messages to the specified stream. More...
 

Detailed Description

template<int Lmm>
class stan::math::cvodes_integrator< Lmm >

Integrator interface for CVODES' ODE solvers (Adams & BDF methods).

Template Parameters
LmmID of ODE solver (1: ADAMS, 2: BDF)

Definition at line 30 of file cvodes_integrator.hpp.

Constructor & Destructor Documentation

◆ cvodes_integrator()

template<int Lmm>
stan::math::cvodes_integrator< Lmm >::cvodes_integrator ( )
inline

Definition at line 32 of file cvodes_integrator.hpp.

Member Function Documentation

◆ integrate()

template<int Lmm>
template<typename F , typename T_initial , typename T_param , typename T_t0 , typename T_ts >
std::vector<std::vector< typename stan::return_type<T_initial, T_param, T_t0, T_ts>::type> > stan::math::cvodes_integrator< Lmm >::integrate ( const F &  f,
const std::vector< T_initial > &  y0,
const T_t0 &  t0,
const std::vector< T_ts > &  ts,
const std::vector< T_param > &  theta,
const std::vector< double > &  x,
const std::vector< int > &  x_int,
std::ostream *  msgs,
double  relative_tolerance,
double  absolute_tolerance,
long int  max_num_steps 
)
inline

Return the solutions for the specified system of ordinary differential equations given the specified initial state, initial times, times of desired solution, and parameters and data, writing error and warning messages to the specified stream.

This function is templated to allow the initials to be either data or autodiff variables and the parameters to be data or autodiff variables. The autodiff-based implementation for reverse-mode are defined in namespace stan::math and may be invoked via argument-dependent lookup by including their headers.

The solver used is based on the backward differentiation formula which is an implicit numerical integration scheme appropiate for stiff ODE systems.

Template Parameters
Ftype of ODE system function.
T_initialtype of scalars for initial values.
T_paramtype of scalars for parameters.
T_t0type of scalar of initial time point.
T_tstype of time-points where ODE solution is returned.
Parameters
[in]ffunctor for the base ordinary differential equation.
[in]y0initial state.
[in]t0initial time.
[in]tstimes of the desired solutions, in strictly increasing order, all greater than the initial time.
[in]thetaparameter vector for the ODE.
[in]xcontinuous data vector for the ODE.
[in]x_intinteger data vector for the ODE.
[in,out]msgsthe print stream for warning messages.
[in]relative_tolerancerelative tolerance passed to CVODE.
[in]absolute_toleranceabsolute tolerance passed to CVODE.
[in]max_num_stepsmaximal number of admissable steps between time-points
Returns
a vector of states, each state being a vector of the same size as the state variable, corresponding to a time in ts.

Definition at line 77 of file cvodes_integrator.hpp.


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

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