Stan Math Library  2.20.0
reverse mode automatic differentiation
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
stan::math::idas_system< F, Tyy, Typ, Tpar > Class Template Reference

IDAS DAE system that contains informtion on residual equation functor, sensitivity residual equation functor, as well as initial conditions. More...

#include <idas_system.hpp>

Inheritance diagram for stan::math::idas_system< F, Tyy, Typ, Tpar >:
stan::math::idas_forward_system< F, Tyy, Typ, Tpar >

Public Types

using scalar_type = typename stan::return_type< Tyy, Typ, Tpar >::type
 
using return_type = std::vector< std::vector< scalar_type > >
 

Public Member Functions

 idas_system (const F &f, const std::vector< int > &eq_id, const std::vector< Tyy > &yy0, const std::vector< Typ > &yp0, const std::vector< Tpar > &theta, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs)
 Construct IDAS DAE system from initial condition and parameters. More...
 
 ~idas_system ()
 destructor to deallocate IDAS solution memory and workspace. More...
 
N_Vector & nv_yy ()
 return reference to current N_Vector of unknown variable More...
 
N_Vector & nv_yp ()
 return reference to current N_Vector of derivative variable More...
 
N_Vector & nv_rr ()
 return reference to current N_Vector of residual workspace More...
 
N_Vector & id ()
 return reference to DAE variable IDs More...
 
const std::vector< double > & yy_val ()
 return reference to current solution vector value More...
 
const std::vector< double > & yp_val ()
 return reference to current solution derivative vector value More...
 
const std::vector< Tyy > & yy0 () const
 return reference to initial condition More...
 
const std::vector< Typ > & yp0 () const
 return reference to derivative initial condition More...
 
const std::vector< Tpar > & theta () const
 return reference to parameter More...
 
std::vector< scalar_typevars () const
 return a vector of vars for that contains the initial condition and parameters in case they are vars. More...
 
const size_t n ()
 return number of unknown variables More...
 
const size_t ns ()
 return number of sensitivity parameters More...
 
const size_t n_sys ()
 return size of DAE system for primary and sensitivity unknowns More...
 
const size_t n_par ()
 return theta size More...
 
void * mem ()
 return IDAS memory handle More...
 
const F & f ()
 return reference to DAE functor More...
 
IDAResFn residual ()
 return a closure for IDAS residual callback More...
 
void check_ic_consistency (const double &t0, const double &tol)
 

Static Public Attributes

static constexpr bool is_var_yy0 = stan::is_var<Tyy>::value
 
static constexpr bool is_var_yp0 = stan::is_var<Typ>::value
 
static constexpr bool is_var_par = stan::is_var<Tpar>::value
 
static constexpr bool need_sens = is_var_yy0 || is_var_yp0 || is_var_par
 

Protected Attributes

const F & f_
 
const std::vector< Tyy > & yy_
 
const std::vector< Typ > & yp_
 
std::vector< double > yy_val_
 
std::vector< double > yp_val_
 
const std::vector< Tpar > & theta_
 
const std::vector< double > & x_r_
 
const std::vector< int > & x_i_
 
const size_t N_
 
const size_t M_
 
const size_t ns_
 
N_Vector nv_yy_
 
N_Vector nv_yp_
 
std::vector< double > rr_val_
 
N_Vector nv_rr_
 
N_Vector id_
 
void * mem_
 
std::ostream * msgs_
 

Detailed Description

template<typename F, typename Tyy, typename Typ, typename Tpar>
class stan::math::idas_system< F, Tyy, Typ, Tpar >

IDAS DAE system that contains informtion on residual equation functor, sensitivity residual equation functor, as well as initial conditions.

This is a base type that is intended to contain common values used by forward sensitivity system.

Template Parameters
Ftype of functor for DAE residual
Tyyscalar type of initial unknown values
Typscalar type of initial unknown's derivative values
Tparscalar type of parameters

Definition at line 90 of file idas_system.hpp.

Member Typedef Documentation

◆ return_type

template<typename F , typename Tyy , typename Typ , typename Tpar >
using stan::math::idas_system< F, Tyy, Typ, Tpar >::return_type = std::vector<std::vector<scalar_type> >

Definition at line 118 of file idas_system.hpp.

◆ scalar_type

template<typename F , typename Tyy , typename Typ , typename Tpar >
using stan::math::idas_system< F, Tyy, Typ, Tpar >::scalar_type = typename stan::return_type<Tyy, Typ, Tpar>::type

Definition at line 117 of file idas_system.hpp.

Constructor & Destructor Documentation

◆ idas_system()

template<typename F , typename Tyy , typename Typ , typename Tpar >
stan::math::idas_system< F, Tyy, Typ, Tpar >::idas_system ( const F &  f,
const std::vector< int > &  eq_id,
const std::vector< Tyy > &  yy0,
const std::vector< Typ > &  yp0,
const std::vector< Tpar > &  theta,
const std::vector< double > &  x_r,
const std::vector< int > &  x_i,
std::ostream *  msgs 
)
inline

Construct IDAS DAE system from initial condition and parameters.

Parameters
[in]fDAE residual functor
[in]eq_idarray for DAE's variable ID(1 for * derivative variables, 0 for algebraic variables).
[in]yy0initial condiiton
[in]yp0initial condiiton for derivatives
[in]thetaparameters of the base DAE.
[in]x_rcontinuous data vector for the DAE.
[in]x_iinteger data vector for the DAE.
[in]msgsstream to which messages are printed.

Definition at line 133 of file idas_system.hpp.

◆ ~idas_system()

template<typename F , typename Tyy , typename Typ , typename Tpar >
stan::math::idas_system< F, Tyy, Typ, Tpar >::~idas_system ( )
inline

destructor to deallocate IDAS solution memory and workspace.

Definition at line 183 of file idas_system.hpp.

Member Function Documentation

◆ check_ic_consistency()

template<typename F , typename Tyy , typename Typ , typename Tpar >
void stan::math::idas_system< F, Tyy, Typ, Tpar >::check_ic_consistency ( const double &  t0,
const double &  tol 
)
inline

Definition at line 330 of file idas_system.hpp.

◆ f()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const F& stan::math::idas_system< F, Tyy, Typ, Tpar >::f ( )
inline

return reference to DAE functor

Definition at line 305 of file idas_system.hpp.

◆ id()

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector& stan::math::idas_system< F, Tyy, Typ, Tpar >::id ( )
inline

return reference to DAE variable IDs

Returns
reference to DAE variable IDs.

Definition at line 217 of file idas_system.hpp.

◆ mem()

template<typename F , typename Tyy , typename Typ , typename Tpar >
void* stan::math::idas_system< F, Tyy, Typ, Tpar >::mem ( )
inline

return IDAS memory handle

Definition at line 300 of file idas_system.hpp.

◆ n()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::n ( )
inline

return number of unknown variables

Definition at line 280 of file idas_system.hpp.

◆ n_par()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::n_par ( )
inline

return theta size

Definition at line 295 of file idas_system.hpp.

◆ n_sys()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::n_sys ( )
inline

return size of DAE system for primary and sensitivity unknowns

Definition at line 290 of file idas_system.hpp.

◆ ns()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::ns ( )
inline

return number of sensitivity parameters

Definition at line 285 of file idas_system.hpp.

◆ nv_rr()

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector& stan::math::idas_system< F, Tyy, Typ, Tpar >::nv_rr ( )
inline

return reference to current N_Vector of residual workspace

Returns
reference to current N_Vector of residual workspace

Definition at line 210 of file idas_system.hpp.

◆ nv_yp()

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector& stan::math::idas_system< F, Tyy, Typ, Tpar >::nv_yp ( )
inline

return reference to current N_Vector of derivative variable

Returns
reference to current N_Vector of derivative variable

Definition at line 203 of file idas_system.hpp.

◆ nv_yy()

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector& stan::math::idas_system< F, Tyy, Typ, Tpar >::nv_yy ( )
inline

return reference to current N_Vector of unknown variable

Returns
reference to current N_Vector of unknown variable

Definition at line 196 of file idas_system.hpp.

◆ residual()

template<typename F , typename Tyy , typename Typ , typename Tpar >
IDAResFn stan::math::idas_system< F, Tyy, Typ, Tpar >::residual ( )
inline

return a closure for IDAS residual callback

Definition at line 310 of file idas_system.hpp.

◆ theta()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<Tpar>& stan::math::idas_system< F, Tyy, Typ, Tpar >::theta ( ) const
inline

return reference to parameter

Returns
reference to parameter

Definition at line 252 of file idas_system.hpp.

◆ vars()

template<typename F , typename Tyy , typename Typ , typename Tpar >
std::vector<scalar_type> stan::math::idas_system< F, Tyy, Typ, Tpar >::vars ( ) const
inline

return a vector of vars for that contains the initial condition and parameters in case they are vars.

The sensitivity with respect to this vector will be calculated by IDAS.

Returns
vector of vars

Definition at line 262 of file idas_system.hpp.

◆ yp0()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<Typ>& stan::math::idas_system< F, Tyy, Typ, Tpar >::yp0 ( ) const
inline

return reference to derivative initial condition

Returns
reference to derivative initial condition

Definition at line 245 of file idas_system.hpp.

◆ yp_val()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<double>& stan::math::idas_system< F, Tyy, Typ, Tpar >::yp_val ( )
inline

return reference to current solution derivative vector value

Returns
reference to current solution derivative vector value

Definition at line 231 of file idas_system.hpp.

◆ yy0()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<Tyy>& stan::math::idas_system< F, Tyy, Typ, Tpar >::yy0 ( ) const
inline

return reference to initial condition

Returns
reference to initial condition

Definition at line 238 of file idas_system.hpp.

◆ yy_val()

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<double>& stan::math::idas_system< F, Tyy, Typ, Tpar >::yy_val ( )
inline

return reference to current solution vector value

Returns
reference to current solution vector value

Definition at line 224 of file idas_system.hpp.

Member Data Documentation

◆ f_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const F& stan::math::idas_system< F, Tyy, Typ, Tpar >::f_
protected

Definition at line 92 of file idas_system.hpp.

◆ id_

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector stan::math::idas_system< F, Tyy, Typ, Tpar >::id_
protected

Definition at line 107 of file idas_system.hpp.

◆ is_var_par

template<typename F , typename Tyy , typename Typ , typename Tpar >
constexpr bool stan::math::idas_system< F, Tyy, Typ, Tpar >::is_var_par = stan::is_var<Tpar>::value
static

Definition at line 114 of file idas_system.hpp.

◆ is_var_yp0

template<typename F , typename Tyy , typename Typ , typename Tpar >
constexpr bool stan::math::idas_system< F, Tyy, Typ, Tpar >::is_var_yp0 = stan::is_var<Typ>::value
static

Definition at line 113 of file idas_system.hpp.

◆ is_var_yy0

template<typename F , typename Tyy , typename Typ , typename Tpar >
constexpr bool stan::math::idas_system< F, Tyy, Typ, Tpar >::is_var_yy0 = stan::is_var<Tyy>::value
static

Definition at line 112 of file idas_system.hpp.

◆ M_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::M_
protected

Definition at line 101 of file idas_system.hpp.

◆ mem_

template<typename F , typename Tyy , typename Typ , typename Tpar >
void* stan::math::idas_system< F, Tyy, Typ, Tpar >::mem_
protected

Definition at line 108 of file idas_system.hpp.

◆ msgs_

template<typename F , typename Tyy , typename Typ , typename Tpar >
std::ostream* stan::math::idas_system< F, Tyy, Typ, Tpar >::msgs_
protected

Definition at line 109 of file idas_system.hpp.

◆ N_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::N_
protected

Definition at line 100 of file idas_system.hpp.

◆ need_sens

template<typename F , typename Tyy , typename Typ , typename Tpar >
constexpr bool stan::math::idas_system< F, Tyy, Typ, Tpar >::need_sens = is_var_yy0 || is_var_yp0 || is_var_par
static

Definition at line 115 of file idas_system.hpp.

◆ ns_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const size_t stan::math::idas_system< F, Tyy, Typ, Tpar >::ns_
protected

Definition at line 102 of file idas_system.hpp.

◆ nv_rr_

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector stan::math::idas_system< F, Tyy, Typ, Tpar >::nv_rr_
protected

Definition at line 106 of file idas_system.hpp.

◆ nv_yp_

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector stan::math::idas_system< F, Tyy, Typ, Tpar >::nv_yp_
protected

Definition at line 104 of file idas_system.hpp.

◆ nv_yy_

template<typename F , typename Tyy , typename Typ , typename Tpar >
N_Vector stan::math::idas_system< F, Tyy, Typ, Tpar >::nv_yy_
protected

Definition at line 103 of file idas_system.hpp.

◆ rr_val_

template<typename F , typename Tyy , typename Typ , typename Tpar >
std::vector<double> stan::math::idas_system< F, Tyy, Typ, Tpar >::rr_val_
protected

Definition at line 105 of file idas_system.hpp.

◆ theta_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<Tpar>& stan::math::idas_system< F, Tyy, Typ, Tpar >::theta_
protected

Definition at line 97 of file idas_system.hpp.

◆ x_i_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<int>& stan::math::idas_system< F, Tyy, Typ, Tpar >::x_i_
protected

Definition at line 99 of file idas_system.hpp.

◆ x_r_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<double>& stan::math::idas_system< F, Tyy, Typ, Tpar >::x_r_
protected

Definition at line 98 of file idas_system.hpp.

◆ yp_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<Typ>& stan::math::idas_system< F, Tyy, Typ, Tpar >::yp_
protected

Definition at line 94 of file idas_system.hpp.

◆ yp_val_

template<typename F , typename Tyy , typename Typ , typename Tpar >
std::vector<double> stan::math::idas_system< F, Tyy, Typ, Tpar >::yp_val_
protected

Definition at line 96 of file idas_system.hpp.

◆ yy_

template<typename F , typename Tyy , typename Typ , typename Tpar >
const std::vector<Tyy>& stan::math::idas_system< F, Tyy, Typ, Tpar >::yy_
protected

Definition at line 93 of file idas_system.hpp.

◆ yy_val_

template<typename F , typename Tyy , typename Typ , typename Tpar >
std::vector<double> stan::math::idas_system< F, Tyy, Typ, Tpar >::yy_val_
protected

Definition at line 95 of file idas_system.hpp.


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

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