Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
log1p_exp.hpp
Go to the documentation of this file.
1 #ifndef __STAN__AGRAD__REV__LOG1P_EXP_HPP__
2 #define __STAN__AGRAD__REV__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

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