File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22#define STAN_MATH_FWD_FUN_FFT_HPP
33
44#include < stan/math/prim/fun/Eigen.hpp>
5- #include < stan/math/prim/fun/fft.hpp>
6- #include < stan/math/prim/fun/to_ref.hpp>
7- #include < stan/math/prim/meta.hpp>
85#include < stan/math/fwd/core.hpp>
9- #include < stan/math/fwd/fun/value_of.hpp>
106#include < stan/math/fwd/meta.hpp>
7+ #include < stan/math/fwd/fun/value_of.hpp>
8+ #include < stan/math/prim/meta.hpp>
9+ #include < stan/math/prim/fun/fft.hpp>
10+ #include < stan/math/prim/fun/to_ref.hpp>
1111#include < complex>
1212
1313namespace stan {
Original file line number Diff line number Diff line change 22#define STAN_MATH_FWD_FUNCTOR_HPP
33
44#include < stan/math/fwd/functor/apply_scalar_unary.hpp>
5+ #include < stan/math/fwd/functor/broadcast_array.hpp>
56#include < stan/math/fwd/functor/gradient.hpp>
67#include < stan/math/fwd/functor/finite_diff.hpp>
78#include < stan/math/fwd/functor/hessian.hpp>
Original file line number Diff line number Diff line change 1+ #ifndef STAN_MATH_FWD_META_BROADCAST_ARRAY_HPP
2+ #define STAN_MATH_FWD_META_BROADCAST_ARRAY_HPP
3+
4+ #include < stan/math/prim/fun/Eigen.hpp>
5+ #include < stan/math/fwd/fun/sum.hpp>
6+ #include < stan/math/prim/meta.hpp>
7+
8+ namespace stan {
9+ namespace math {
10+ namespace internal {
11+
12+ template <typename T>
13+ class broadcast_array <T, require_st_fvar<T>> {
14+ private:
15+ std::reference_wrapper<T> prim_;
16+
17+ public:
18+ template <typename TT>
19+ explicit broadcast_array (TT&& prim) : prim_(std::forward<TT>(prim)) {}
20+
21+ T& operator [](int /* i*/ ) { return prim_.get (); }
22+
23+ /* * \ingroup type_trait
24+ * Broadcast array can be assigned a scalar or a vector. If assigned a scalar,
25+ * it will be used directly. If assigned a vector, the argument will be summed
26+ * first.
27+ */
28+ template <typename Y>
29+ void operator =(const Y& m) {
30+ prim_.get () = sum (m);
31+ }
32+ };
33+
34+ }
35+ }
36+ }
37+ #endif
Original file line number Diff line number Diff line change 44#include < stan/math/prim/fun/Eigen.hpp>
55#include < stan/math/prim/meta.hpp>
66#include < stan/math/prim/fun/size.hpp>
7+ #include < stan/math/fwd/functor/broadcast_array.hpp>
78#include < stan/math/fwd/core/fvar.hpp>
89#include < stan/math/fwd/meta.hpp>
910#include < stan/math/fwd/fun/sum.hpp>
1011#include < stan/math/prim/fun/as_column_vector_or_scalar.hpp>
1112#include < stan/math/prim/fun/elt_multiply.hpp>
1213#include < stan/math/prim/functor/apply.hpp>
1314#include < stan/math/prim/functor/for_each.hpp>
14- #include < stan/math/prim/functor/broadcast_array.hpp>
1515#include < stan/math/prim/functor/operands_and_partials.hpp>
1616#include < vector>
1717
Original file line number Diff line number Diff line change 22#define STAN_MATH_PRIM_META_BROADCAST_ARRAY_HPP
33
44#include < stan/math/prim/meta/is_eigen.hpp>
5+ #include < stan/math/prim/meta/is_var_or_arithmetic.hpp>
56#include < stan/math/prim/meta/promote_scalar_type.hpp>
67#include < stan/math/prim/meta/ref_type.hpp>
78#include < stan/math/prim/fun/Eigen.hpp>
@@ -13,8 +14,11 @@ namespace stan {
1314namespace math {
1415namespace internal {
1516
17+ template <typename T, typename Enable = void >
18+ class broadcast_array ;
19+
1620template <typename T>
17- class broadcast_array {
21+ class broadcast_array <T, require_t <is_var_or_arithmetic<T>>> {
1822 private:
1923 std::reference_wrapper<T> prim_;
2024
Original file line number Diff line number Diff line change 55#include < stan/math/rev/core/var.hpp>
66#include < stan/math/rev/core/typedefs.hpp>
77#include < stan/math/rev/functor/operands_and_partials.hpp>
8- #include < stan/math/prim/functor/partials_propagator.hpp>
98#include < stan/math/prim/functor/for_each.hpp>
109#include < vector>
1110#include < tuple>
@@ -15,6 +14,9 @@ namespace math {
1514
1615namespace internal {
1716
17+ template <typename ReturnType, typename Enable, typename ... Ops>
18+ class partials_propagator ;
19+
1820/* * \ingroup type_trait
1921 * \callergraph
2022 * This class builds partial derivatives with respect to a set of
You can’t perform that action at this time.
0 commit comments