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

◆ operator()()

template<typename ReduceFunction , typename Enable , typename ReturnType , typename Vec , typename... Args>
return_type_t< Vec, Args... > stan::math::internal::reduce_sum_impl< ReduceFunction, Enable, ReturnType, Vec, Args >::operator() ( Vec &&  vmapped,
bool  auto_partitioning,
int  grainsize,
std::ostream *  msgs,
Args &&...  args 
) const
inline

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

This specialization is not parallelized and works for any autodiff types.

An instance, f, of ReduceFunction should have the signature: T f(Vec&& vmapped_subset, int start, int end, std::ostream* msgs, Args&&... args)

ReduceFunction must be default constructible without any arguments

Each call to ReduceFunction is responsible for computing the start through end terms (inclusive) of the overall sum. All args are passed from this function through to the ReduceFunction instances. However, only the start through end (inclusive) elements of the vmapped argument are passed to the ReduceFunction instances (as the vmapped_subset argument).

If auto partitioning is true, do the calculation with one ReduceFunction call. If false, break work into pieces strictly smaller than grainsize.

grainsize must be greater than or equal to 1

Parameters
vmappedVector containing one element per term of sum
auto_partitioningWork partitioning style (ignored)
grainsizeSuggested grainsize for tbb
[in,out]msgsThe print stream for warning messages
argsShared arguments used in every sum term
Returns
Summation of all terms

Definition at line 62 of file reduce_sum.hpp.