![]() |
Stan Math Library
2.20.0
reverse mode automatic differentiation
|
Observer for the coupled states. More...
#include <coupled_ode_observer.hpp>
Public Types | |
typedef stan::return_type< T1, T2, T_t0, T_ts >::type | return_t |
typedef operands_and_partials< std::vector< T1 >, std::vector< T2 >, T_t0, T_ts > | ops_partials_t |
Public Member Functions | |
coupled_ode_observer (const F &f, const std::vector< T1 > &y0, const std::vector< T2 > &theta, const T_t0 &t0, const std::vector< T_ts > &ts, const std::vector< double > &x, const std::vector< int > &x_int, std::ostream *msgs, std::vector< std::vector< return_t >> &y) | |
Construct a coupled ODE observer for the specified coupled vector. More... | |
void | operator() (const std::vector< double > &coupled_state, double t) |
Callback function for ODE solvers to record values. More... | |
Public Attributes | |
const F & | f_ |
const std::vector< T1 > & | y0_ |
const T_t0 & | t0_ |
const std::vector< T_ts > & | ts_ |
const std::vector< T2 > & | theta_ |
const std::vector< double > & | x_ |
const std::vector< int > & | x_int_ |
std::ostream * | msgs_ |
std::vector< std::vector< return_t > > & | y_ |
const std::size_t | N_ |
const std::size_t | M_ |
const std::size_t | index_offset_theta_ |
int | next_ts_index_ |
Observer for the coupled states.
Holds a reference to an externally defined vector of vectors passed in at construction time which holds the final result on the AD stack. Thus, whenever any of the inputs is varying, then the output will be varying as well. The sensitivities of the initials and the parameters are taken from the coupled state in the order as defined by the coupled_ode_system. The sensitivities at each time-point is simply the ODE RHS evaluated at that time point.
The output of this class is for all time-points in the ts vector which does not contain the initial time-point by the convention used in stan-math.
Definition at line 30 of file coupled_ode_observer.hpp.
typedef operands_and_partials<std::vector<T1>, std::vector<T2>, T_t0, T_ts> stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::ops_partials_t |
Definition at line 34 of file coupled_ode_observer.hpp.
typedef stan::return_type<T1, T2, T_t0, T_ts>::type stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::return_t |
Definition at line 31 of file coupled_ode_observer.hpp.
|
inline |
Construct a coupled ODE observer for the specified coupled vector.
F | type of ODE system function. |
T1 | type of scalars for initial values. |
T2 | type of scalars for parameters. |
T_t0 | type of scalar of initial time point. |
T_ts | type of time-points where ODE solution is returned. |
[in] | f | functor for the base ordinary differential equation. |
[in] | y0 | initial state. |
[in] | theta | parameter vector for the ODE. |
[in] | t0 | initial time. |
[in] | ts | times of the desired solutions, in strictly increasing order, all greater than the initial time. |
[in] | x | continuous data vector for the ODE. |
[in] | x_int | integer data vector for the ODE. |
[out] | msgs | the print stream for warning messages. |
[out] | y | reference to a vector of vector of the final return |
Definition at line 70 of file coupled_ode_observer.hpp.
|
inline |
Callback function for ODE solvers to record values.
The coupled state returned from the solver is added directly to the AD tree.
The coupled state follows the convention as defined in the coupled_ode_system. In brief, the coupled state consists of {f, df/dy0, df/dtheta}. Here df/dy0 and df/dtheta are only present if their respective sensitivites have been requested.
coupled_state | solution at the specified time. |
t | time of solution. The time must correspond to the element ts[next_ts_index_] |
Definition at line 103 of file coupled_ode_observer.hpp.
const F& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::f_ |
Definition at line 36 of file coupled_ode_observer.hpp.
const std::size_t stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::index_offset_theta_ |
Definition at line 47 of file coupled_ode_observer.hpp.
const std::size_t stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::M_ |
Definition at line 46 of file coupled_ode_observer.hpp.
std::ostream* stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::msgs_ |
Definition at line 43 of file coupled_ode_observer.hpp.
const std::size_t stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::N_ |
Definition at line 45 of file coupled_ode_observer.hpp.
int stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::next_ts_index_ |
Definition at line 48 of file coupled_ode_observer.hpp.
const T_t0& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::t0_ |
Definition at line 38 of file coupled_ode_observer.hpp.
const std::vector<T2>& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::theta_ |
Definition at line 40 of file coupled_ode_observer.hpp.
const std::vector<T_ts>& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::ts_ |
Definition at line 39 of file coupled_ode_observer.hpp.
const std::vector<double>& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::x_ |
Definition at line 41 of file coupled_ode_observer.hpp.
const std::vector<int>& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::x_int_ |
Definition at line 42 of file coupled_ode_observer.hpp.
const std::vector<T1>& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::y0_ |
Definition at line 37 of file coupled_ode_observer.hpp.
std::vector<std::vector<return_t> >& stan::math::coupled_ode_observer< F, T1, T2, T_t0, T_ts >::y_ |
Definition at line 44 of file coupled_ode_observer.hpp.