1#ifndef STAN_MATH_REV_FUN_SUM_HPP
2#define STAN_MATH_REV_FUN_SUM_HPP
26template <
typename Alloc>
27inline var sum(
const std::vector<var, Alloc>& m) {
33 arena_m.adj() += vi.adj();
47template <
typename T, require_rev_matrix_t<T>* =
nullptr>
51 x_arena.adj().array() += vi.adj();
T as_array_or_scalar(T &&v)
Returns specified input value.
var_value< plain_type_t< T > > make_callback_var(T &&value, F &&functor)
Creates a new var initialized with a callback_vari with a given value and reverse-pass callback funct...
arena_t< T > to_arena(const T &a)
Converts given argument into a type that either has any dynamic allocation on AD stack or schedules i...
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
typename internal::arena_type_impl< std::decay_t< T > >::type arena_t
Determines a type that can be used in place of T that does any dynamic allocations on the AD stack.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...