Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
log1p_exp.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__FUNCTIONS__LOG1P_EXP_HPP
2 #define STAN__AGRAD__REV__FUNCTIONS__LOG1P_EXP_HPP
3 
4 #include <stan/agrad/rev/var.hpp>
8 
9 namespace stan {
10  namespace agrad {
11 
12  namespace {
13  class log1p_exp_v_vari : public op_v_vari {
14  public:
15  log1p_exp_v_vari(vari* avi) :
16  op_v_vari(stan::math::log1p_exp(avi->val_),
17  avi) {
18  }
19  void chain() {
20  avi_->adj_ += adj_ * calculate_chain(avi_->val_, val_);
21  }
22  };
23  }
24 
29  inline var log1p_exp(const stan::agrad::var& a) {
30  return var(new log1p_exp_v_vari(a.vi_));
31  }
32 
33  }
34 }
35 #endif
fvar< T > log1p_exp(const fvar< T > &x)
Definition: log1p_exp.hpp:15
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:40
double calculate_chain(const double &x, const double &val)
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:27

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