Stan Math Library  2.9.0
reverse mode automatic differentiation
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 
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
void print_stack(std::ostream &o)
Prints the auto-dif variable stack.
Definition: print_stack.hpp:20
static std::vector< ChainableT * > var_stack_

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