autoppl
v0.8
A C++ template library for probabilistic programming
|
Go to the documentation of this file.
4 #define PPL_VAR_DIST_CONT_DISC_MATCH \
5 "A continuous variable can only be assigned to a continuous distribution. " \
6 "A discrete variable can only be assigned to a discrete distribution. "
17 template <
class VarType
24 static_assert(util::is_dist_assignable_v<var_t>);
25 static_assert(util::is_dist_expr_v<dist_t>);
37 const dist_t& dist) noexcept
47 template <
class BarEqNodeFunc>
51 eq_f(
static_cast<this_t&
>(*
this));
54 template <
class BarEqNodeFunc>
58 eq_f(
static_cast<const this_t&
>(*
this));
63 return dist_.pdf(var_);
68 return dist_.log_pdf(var_);
71 template <
class PtrPackType>
74 if constexpr (util::is_param_v<var_t>) {
75 return dist_.ad_log_pdf(var_, pack) +
78 return dist_.ad_log_pdf(var_, pack);
82 template <
class PtrPackType>
83 void bind(
const PtrPackType& pack)
85 if constexpr (var_t::has_param) {
92 var_.activate_refcnt();
93 dist_.activate_refcnt();
VarType var_t
Definition: bar_eq.hpp:21
BarEqNode(const var_t &var, const dist_t &dist) noexcept
Definition: bar_eq.hpp:36
auto pdf()
Definition: bar_eq.hpp:61
Definition: model_expr_traits.hpp:19
auto ad_log_pdf(const PtrPackType &pack) const
Definition: bar_eq.hpp:72
Definition: var_traits.hpp:40
Definition: dist_expr_traits.hpp:40
auto log_pdf()
Definition: bar_eq.hpp:66
typename util::dist_expr_traits< dist_t >::dist_value_t dist_value_t
Definition: bar_eq.hpp:34
void traverse(BarEqNodeFunc &&eq_f)
Definition: bar_eq.hpp:48
DistType dist_t
Definition: bar_eq.hpp:22
void bind(const PtrPackType &pack)
Definition: bar_eq.hpp:83
typename DistExprType::dist_value_t dist_value_t
Definition: dist_expr_traits.hpp:42
Definition: bar_eq.hpp:20
const var_t & get_variable() const
Definition: bar_eq.hpp:97
void traverse(BarEqNodeFunc &&eq_f) const
Definition: bar_eq.hpp:55
dist_t & get_distribution()
Definition: bar_eq.hpp:98
Definition: bounded.hpp:11
#define PPL_VAR_DIST_CONT_DISC_MATCH
Definition: bar_eq.hpp:4
const dist_t & get_distribution() const
Definition: bar_eq.hpp:99
var_t & get_variable()
Definition: bar_eq.hpp:96
void activate_refcnt() const
Definition: bar_eq.hpp:91