3 #include <fastad_bits/reverse/core/constant.hpp>
8 #define PPL_DATA_SHAPE_UNSUPPORTED \
9 "Unsupported shape for Data. "
10 #define PPL_DATAVIEW_SHAPE_UNSUPPORTED \
11 "Unsupported shape for DataView. "
26 template <
class ValueType
30 static_assert(util::is_shape_v<ShapeType>,
34 template <
class ValueType>
43 static constexpr
bool has_param =
false;
56 constexpr
size_t size()
const {
return 1; }
57 constexpr
size_t rows()
const {
return 1; }
58 constexpr
size_t cols()
const {
return 1; }
61 template <
class PtrPackType>
62 auto ad(
const PtrPackType&)
const
63 {
return ad::constant(*var_); }
65 template <
class PtrType>
68 static_cast<void>(begin);
69 if constexpr (std::is_convertible_v<PtrType, value_t*>) {
81 template <
class ValueType>
87 using var_t = Eigen::Map<const Eigen::Matrix<value_t, Eigen::Dynamic, 1>>;
90 static constexpr
bool has_param =
false;
100 size_t size()
const {
return var_.size(); }
101 size_t rows()
const {
return var_.rows(); }
102 constexpr
size_t cols()
const {
return 1; }
105 template <
class PtrPackType>
106 auto ad(
const PtrPackType&)
const
107 {
return ad::constant_view(var_.data(),
size()); }
109 template <
class PtrType>
112 static_cast<void>(begin);
113 if constexpr (std::is_convertible_v<PtrType, value_t*>) {
125 template <
class ValueType>
131 using var_t = Eigen::Map<const Eigen::Matrix<value_t, Eigen::Dynamic, Eigen::Dynamic>>;
134 static constexpr
bool has_param =
false;
138 size_t cols) noexcept
145 size_t size()
const {
return var_.size(); }
146 size_t rows()
const {
return var_.rows(); }
147 size_t cols()
const {
return var_.cols(); }
150 template <
class PtrPackType>
151 auto ad(
const PtrPackType&)
const
152 {
return ad::constant_view(var_.data(),
rows(),
cols()); }
154 template <
class PtrType>
157 static_cast<void>(begin);
158 if constexpr (std::is_convertible_v<PtrType, value_t*>) {
185 template <
class ValueType
189 static_assert(util::is_shape_v<ShapeType>,
194 template <
class ValueType>
209 auto&
get() {
return value_; }
216 template <
class ValueType>
229 { this->
bind(vec_.data()); }
231 auto&
get() {
return vec_; }
234 using vec_t = Eigen::Matrix<value_t, Eigen::Dynamic, 1>;
239 template <
class ValueType>
252 { this->
bind(mat_.data()); }
254 auto&
get() {
return mat_; }
257 using mat_t = Eigen::Matrix<value_t, Eigen::Dynamic, Eigen::Dynamic>;
263 #undef PPL_DATA_SHAPE_UNSUPPORTED
264 #undef PPL_DATAVIEW_SHAPE_UNSUPPORTED