Automatic Differentiation
 
Loading...
Searching...
No Matches
broadcast_array.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUNCTOR_BROADCAST_ARRAY_HPP
2#define STAN_MATH_REV_FUNCTOR_BROADCAST_ARRAY_HPP
3
8
9namespace stan {
10namespace math {
11namespace internal {
12
13template <typename T>
15 private:
16 std::reference_wrapper<T> prim_;
17
18 public:
19 template <typename TT>
20 explicit broadcast_array(TT&& prim) : prim_(std::forward<TT>(prim)) {}
21
22 T& operator[](int /*i*/) { return prim_.get(); }
23
29 template <typename Y>
30 void operator=(const Y& m) {
31 prim_.get() = sum(m);
32 }
33};
34
35} // namespace internal
36} // namespace math
37} // namespace stan
38#endif
void operator=(const Y &m)
Broadcast array can be assigned a scalar or a vector.
require_t< is_var< scalar_type_t< std::decay_t< T > > > > require_st_var
Require scalar_type satisfies is_var.
Definition is_var.hpp:176
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
Definition sum.hpp:23
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
STL namespace.