1#ifndef STAN_MATH_REV_CORE_AUTODIFFSTACKSTORAGE_HPP
2#define STAN_MATH_REV_CORE_AUTODIFFSTACKSTORAGE_HPP
18#define STAN_THREADS_DEF __thread
20#define STAN_THREADS_DEF thread_local
24#define STAN_THREADS_DEF
88template <
typename ChainableT,
typename ChainableAllocT>
132 std::vector<ChainableT *> &stack, ChainableT *vi) {
133 if (
likely(stack.size() != stack.capacity())) {
153 if (!is_initialized) {
154 is_initialized =
true;
159 is_initialized =
true;
169template <
typename ChainableT,
typename ChainableAllocT>
172 ChainableAllocT>::AutodiffStackStorage
An instance of this class provides a memory pool through which blocks of raw memory may be allocated ...
#define STAN_STRONG_INLINE
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
void push_var_nochain_stack(ChainableT *vi)
std::vector< ChainableAllocT * > var_alloc_stack_
std::vector< size_t > nested_var_alloc_stack_starts_
void push_var_stack(ChainableT *vi)
std::vector< ChainableT * > var_stack_
static void grow_and_push(std::vector< ChainableT * > &stack, ChainableT *vi)
std::vector< ChainableT * > var_nochain_stack_
std::vector< size_t > nested_var_nochain_stack_sizes_
std::vector< size_t > nested_var_stack_sizes_
static void push(std::vector< ChainableT * > &stack, ChainableT *vi)
Once we create memory in stack we do not release it till the end of the program.
AutodiffStackStorage & operator=(const AutodiffStackStorage &)=delete
AutodiffStackSingleton(AutodiffStackSingleton_t const &)=delete
~AutodiffStackSingleton()
AutodiffStackSingleton & operator=(const AutodiffStackSingleton_t &)=delete
static thread_local AutodiffStackStorage * instance_
This struct always provides access to the autodiff stack using the singleton pattern.