Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ reduce_sum()

template<typename ReduceFunction , typename Vec , typename = require_vector_like_t<Vec>, typename... Args>
auto stan::math::reduce_sum ( Vec &&  vmapped,
int  grainsize,
std::ostream *  msgs,
Args &&...  args 
)
inline

Call an instance of the function ReduceFunction on every element of an input sequence and sum these terms.

This defers to reduce_sum_impl for the appropriate implementation

ReduceFunction must define an operator() with the same signature as: T f(Vec&& vmapped_subset, int start, int end, std::ostream* msgs, Args&&... args)

ReduceFunction must be default constructible without any arguments

grainsize must be greater than or equal to 1

Template Parameters
ReduceFunctionType of reducer function
ReturnTypeAn arithmetic type
VecType of sliced argument
ArgsTypes of shared arguments
Parameters
vmappedVector containing one element per term of sum
grainsizeSuggested grainsize for tbb
[in,out]msgsThe print stream for warning messages
argsShared arguments used in every sum term
Returns
Sum of terms

Definition at line 200 of file reduce_sum.hpp.