2 #include <fastad_bits/reverse/core/expr_base.hpp>
3 #include <fastad_bits/reverse/core/value_adj_view.hpp>
4 #include <fastad_bits/util/type_traits.hpp>
5 #include <fastad_bits/util/size_pack.hpp>
6 #include <fastad_bits/util/value.hpp>
12 template <
class UCType,
class LowerType,
class CType>
14 const LowerType&
lower,
18 using c_t = std::decay_t<CType>;
19 if constexpr (std::is_arithmetic_v<uc_t> &&
20 std::is_arithmetic_v<c_t>) {
21 c = std::exp(uc) +
lower;
23 if constexpr (std::is_arithmetic_v<LowerType>) {
24 c = (uc.array().exp() +
lower).matrix();
26 c = (uc.array().exp() +
lower.array()).matrix();
31 template <
class ExprType
34 core::ValueAdjView<typename util::expr_traits<ExprType>::value_t,
35 typename util::expr_traits<ExprType>::shape_t>,
36 core::ExprBase<LowerInvTransformNode<ExprType, LowerType>>
39 using expr_t = ExprType;
40 using expr_value_t =
typename util::expr_traits<expr_t>::value_t;
41 using expr_shape_t =
typename util::shape_traits<expr_t>::shape_t;
42 using lower_t = LowerType;
44 static_assert(util::is_scl_v<lower_t> ||
46 typename util::shape_traits<expr_t>::shape_t,
47 typename util::shape_traits<lower_t>::shape_t
52 using typename value_adj_view_t::value_t;
53 using typename value_adj_view_t::shape_t;
55 using typename value_adj_view_t::ptr_pack_t;
71 auto&&
lower = lower_.feval();
74 auto&& uc_val = expr_.feval();
77 *v_val_ = *v_val_ % refcnt_;
88 if constexpr (util::is_scl_v<lower_t>) {
89 lower_.beval(
sum(a_adj));
93 expr_.beval(a_adj * (a_val - a_lower));
98 begin = expr_.bind_cache(begin);
99 begin = lower_.bind_cache(begin);
100 auto val = begin.val;
101 begin.val = this->data();
102 begin = this->
bind(begin);
110 expr_.bind_cache_size() +
111 lower_.bind_cache_size();
115 return {0,this->
size()};
122 size_t const refcnt_;