Stan Math Library: stan/math/rev/core/set_zero_all_adjoints.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

set_zero_all_adjoints.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_SET_ZERO_ALL_ADJOINTS_HPP
2 #define STAN_MATH_REV_CORE_SET_ZERO_ALL_ADJOINTS_HPP
3
4 #include <stan/math/rev/core/vari.hpp>
5 #include <stan/math/rev/core/chainable_alloc.hpp>
6 #include <stan/math/rev/core/chainablestack.hpp>
7
8 namespace stan {
9 namespace math {
10
14 static void set_zero_all_adjoints() {
15 for (size_t i = 0; i < ChainableStack::var_stack_.size(); ++i)
16 ChainableStack::var_stack_[i]->set_zero_adjoint();
17 for (size_t i = 0; i < ChainableStack::var_nochain_stack_.size(); ++i)
18 ChainableStack::var_nochain_stack_[i]->set_zero_adjoint();
19 }
20
21 }
22 }
23 #endif
vari.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::set_zero_all_adjoints
static void set_zero_all_adjoints()
Reset all adjoint values in the stack to zero.
Definition: set_zero_all_adjoints.hpp:14
stan::math::AutodiffStackStorage::var_nochain_stack_
static std::vector< ChainableT * > var_nochain_stack_
Definition: autodiffstackstorage.hpp:14
chainable_alloc.hpp
chainablestack.hpp
stan::math::AutodiffStackStorage::var_stack_
static std::vector< ChainableT * > var_stack_
Definition: autodiffstackstorage.hpp:13

[ Stan Home Page ] © 2011–2016, Stan Development Team.