Stan Math Library
2.14.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::var_stack_
.size() << std::endl;
22
// TODO(carpenter): this shouldn't need to be cast any more
23
for
(
size_t
i = 0; i <
ChainableStack::var_stack_
.size(); ++i)
24
o << i
25
<<
" "
<<
ChainableStack::var_stack_
[i]
26
<<
" "
<< (static_cast<vari*>(
ChainableStack::var_stack_
[i]))->val_
27
<<
" : "
<< (static_cast<vari*>(
ChainableStack::var_stack_
[i]))->adj_
28
<< std::endl;
29
}
30
31
}
32
}
33
#endif
vari.hpp
stan
Definition:
log_sum_exp.hpp:8
stan::math::print_stack
void print_stack(std::ostream &o)
Prints the auto-dif variable stack.
Definition:
print_stack.hpp:20
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.