Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::internal::reduce_sum_impl< ReduceFunction, require_var_t< ReturnType >, ReturnType, Vec, Args... >::recursive_reducer Struct Reference

Detailed Description

template<typename ReduceFunction, typename ReturnType, typename Vec, typename... Args>
struct stan::math::internal::reduce_sum_impl< ReduceFunction, require_var_t< ReturnType >, ReturnType, Vec, Args... >::recursive_reducer

This struct is used by the TBB to accumulate partial sums over consecutive ranges of the input.

To distribute the workload, the TBB can split larger partial sums into smaller ones in which case the splitting copy constructor is used. It is designed to meet the Imperative form requirements of tbb::parallel_reduce.

Note
see link here for requirements.

Definition at line 51 of file reduce_sum.hpp.

#include <reduce_sum.hpp>

Public Member Functions

template<typename VecT , typename... ArgsT>
 recursive_reducer (size_t num_vars_per_term, size_t num_vars_shared_terms, double *sliced_partials, VecT &&vmapped, ArgsT &&... args)
 
 recursive_reducer (recursive_reducer &other, tbb::split)
 
void operator() (const tbb::blocked_range< size_t > &r)
 Compute, using nested autodiff, the value and Jacobian of ReduceFunction called over the range defined by r and accumulate those in member variable sum_ (for the value) and args_adjoints_ (for the Jacobian).
 
void join (const recursive_reducer &rhs)
 Join reducers.
 

Public Attributes

const size_t num_vars_per_term_
 
const size_t num_vars_shared_terms_
 
double * sliced_partials_
 
Vec vmapped_
 
std::stringstream msgs_
 
std::tuple< Args... > args_tuple_
 
scoped_args_tuple local_args_tuple_scope_
 
double sum_ {0.0}
 
Eigen::VectorXd args_adjoints_ {0}
 

The documentation for this struct was generated from the following file: