Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
rev
core
print_stack.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_REV_CORE_PRINT_STACK_HPP
2
#define STAN_MATH_REV_CORE_PRINT_STACK_HPP
3
4
#include <
stan/math/rev/core/chainablestack.hpp
>
5
#include <
stan/math/rev/core/vari.hpp
>
6
#include <ostream>
7
8
namespace
stan
{
9
namespace
math {
10
20
inline
void
print_stack
(std::ostream& o) {
21
o <<
"STACK, size="
<<
ChainableStack::instance_
->
var_stack_
.size()
22
<< std::endl;
23
// TODO(carpenter): this shouldn't need to be cast any more
24
for
(
size_t
i = 0; i <
ChainableStack::instance_
->
var_stack_
.size(); ++i)
25
o << i <<
" "
<<
ChainableStack::instance_
->var_stack_[i] <<
" "
26
<< (static_cast<vari*>(
ChainableStack::instance_
->var_stack_[i]))->val_
27
<<
" : "
28
<< (static_cast<vari*>(
ChainableStack::instance_
->var_stack_[i]))->adj_
29
<< std::endl;
30
}
31
32
}
// namespace math
33
}
// namespace stan
34
#endif
vari.hpp
stan
Definition:
log_sum_exp.hpp:8
stan::math::AutodiffStackSingleton::AutodiffStackStorage::var_stack_
std::vector< ChainableT * > var_stack_
Definition:
autodiffstackstorage.hpp:104
stan::math::AutodiffStackSingleton::instance_
static STAN_THREADS_DEF AutodiffStackStorage * instance_
Definition:
autodiffstackstorage.hpp:118
stan::math::print_stack
void print_stack(std::ostream &o)
Prints the auto-dif variable stack.
Definition:
print_stack.hpp:20
chainablestack.hpp
[
Stan Home Page
]
© 2011–2018, Stan Development Team.