7 #ifndef SSMPACK_DISTRIBUTION_PARAMETRIC_CONDITIONAL_HPP
8 #define SSMPACK_DISTRIBUTION_PARAMETRIC_CONDITIONAL_HPP
11 #include <type_traits>
16 namespace distribution {
33 template <
typename TPDF,
typename TParamMap>
46 : pdf_(std::move(pdf)), map_(std::move(map)) {}
52 template <
typename... Args>
53 auto random(
const Args &... args) -> decltype(std::declval<TPDF>().
random()) {
54 pdf_.parameterize(map_(args...));
64 template <
typename... Args>
66 const Args &... args) {
67 pdf_.parameterize(map_(args...));
68 return pdf_.likelihood(rv);
72 const TPDF &
getPDF()
const {
return pdf_;}
91 template <
class TPDF,
class TParamMap>
100 #endif // SSMPACK_DISTRIBUTION_PARAMETRIC_CONDITIONAL_HPP
Conditional distribution function.
const TPDF & getPDF() const
Returns a reference to .
auto random(const Args &...args) -> decltype(std::declval< TPDF >().random())
Sample from distribution.
Conditional(TPDF pdf, TParamMap map)
Constructors returns a conditional distribution object.
Conditional< TPDF, TParamMap > makeConditional(TPDF pdf, TParamMap map)
Convenient builder that returns a conditional distribution object.
double likelihood(const decltype(std::declval< TPDF >().random())&rv, const Args &...args)
Calculate the likelihood of a random variable.
const TParamMap & getParamMap() const
Returns a reference to .