Automatic Differentiation
 
Loading...
Searching...
No Matches
broadcast_array.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_BROADCAST_ARRAY_HPP
2#define STAN_MATH_PRIM_META_BROADCAST_ARRAY_HPP
3
9#include <stdexcept>
10
11namespace stan {
12namespace math {
13namespace internal {
14
15template <typename T>
17 private:
19
20 public:
21 explicit broadcast_array(T& prim) : prim_(prim) {}
22
23 T& operator[](int /*i*/) { return prim_; }
24
30 template <typename Y>
31 void operator=(const Y& m) {
32 prim_ = sum(m);
33 }
34};
35
36template <typename T, typename S, typename Enable = void>
38 public:
43 T& operator[](int /*i*/);
44
48 template <typename Y>
49 void operator=(const Y& /*A*/);
50 template <typename Y>
51 void add_write_event(Y&& /* event */);
52};
53
54template <typename ViewElt, typename T>
56 enum { R = T::RowsAtCompileTime, C = T::ColsAtCompileTime };
58
59 public:
64 ViewElt& operator[](int /*i*/);
68 ViewElt& operator()(int /*i*/);
72 void operator=(const T_arg& /*A*/);
76 void operator+=(T_arg /*A*/);
80 void operator-=(T_arg /*A*/);
84 T& row(int /*i*/);
88 T& col(int /*i*/);
89};
90} // namespace internal
91} // namespace math
92} // namespace stan
93#endif
require_t< is_eigen< std::decay_t< T > > > require_eigen_t
Require type satisfies is_eigen.
Definition is_eigen.hpp:110
ViewElt & operator()(int)
Not implemented so cannot be called.
void operator=(const Y &)
Not implemented so cannot be called.
ViewElt & operator[](int)
Not implemented so cannot be called.
void operator=(const T_arg &)
Not implemented so cannot be called.
void operator=(const Y &m)
Broadcast array can be assigned a scalar or a vector.
T & operator[](int)
Not implemented so cannot be called.
typename promote_scalar_type< std::decay_t< T >, std::decay_t< S > >::type promote_scalar_t
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 ...