![]() |
Stan Math Library
5.1.0
Automatic Differentiation
|
|
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
| vmapped | Vector containing one element per term of sum | |
| auto_partitioning | Work partitioning style (ignored) | |
| grainsize | Suggested grainsize for tbb | |
| [in,out] | msgs | The print stream for warning messages |
| args | Shared arguments used in every sum term |
Definition at line 62 of file reduce_sum.hpp.