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

◆ reduce_sum_static()

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

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

If STAN_THREADS is not defined, do all the work with one ReduceFunction call.

Template Parameters
ReduceFunctionType of reducer function
ReturnTypeAn arithmetic type
VecType of sliced argument
ArgsTypes of shared arguments
Parameters
vmappedSliced arguments used only in some sum terms
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 45 of file reduce_sum_static.hpp.