autoppl
v0.8
A C++ template library for probabilistic programming
|
Go to the documentation of this file.
2 #include <fastad_bits/util/shape_traits.hpp>
3 #include <fastad_bits/reverse/core/var_view.hpp>
13 template <
class ValueType
21 using view_t = ad::util::shape_to_raw_view_t<value_t, shape_t>;
43 template <
class CurrPtrPack,
class PtrPack>
47 return ad::VarView<value_t, shape_t>(
48 curr_pack.uc_val, curr_pack.uc_adj, rows_uc(), cols_uc());
51 template <
class CurrPtrPack,
class PtrPack>
53 const PtrPack&)
const {
54 return ad::constant(0.);
57 template <
class GenType,
class ContDist>
58 void init(GenType& gen, ContDist& dist) {
59 static_cast<void>(gen);
60 static_cast<void>(dist);
61 if constexpr (util::is_disc_v<value_t>) {
62 if constexpr (std::is_same_v<shape_t, scl>) {
68 if constexpr (std::is_same_v<shape_t, scl>) {
71 uc_val_ = var_t::NullaryExpr(rows_uc(), cols_uc(), [&]() {
return dist(gen); });
84 constexpr
size_t size_c()
const {
return size_uc(); }
85 constexpr
size_t rows_c()
const {
return rows_uc(); }
86 constexpr
size_t cols_c()
const {
return cols_uc(); }
95 template <
class CurrPtrPack,
class PtrPack>
96 void bind(
const CurrPtrPack& curr_pack,
98 {
util::bind(uc_val_, curr_pack.uc_val, rows_uc(), cols_uc()); }
auto & get(T &&x)
Definition: value.hpp:52
Definition: unconstrained.hpp:11
void bind(T &x, ValPtrType begin, size_t rows=1, size_t cols=1)
Definition: value.hpp:61
constexpr size_t cols(const T &x)
Definition: value.hpp:42
constexpr size_t size(const T &x)
Definition: value.hpp:22
typename details::var< V, T >::type var_t
Definition: shape_traits.hpp:132
Definition: bounded.hpp:11
constexpr size_t rows(const T &x)
Definition: value.hpp:32
constexpr auto make_val(size_t rows=1, size_t cols=1)
Definition: value.hpp:9