Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
expm1.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__FUNCTIONS__EXPM1_HPP
2 #define STAN__AGRAD__REV__FUNCTIONS__EXPM1_HPP
3 
4 #include <valarray>
5 #include <stan/agrad/rev/var.hpp>
8 #include <math.h>
9 
10 namespace stan {
11  namespace agrad {
12 
13  namespace {
14  class expm1_vari : public op_v_vari {
15  public:
16  expm1_vari(vari* avi) :
17  op_v_vari(::expm1(avi->val_),avi) {
18  }
19  void chain() {
20  avi_->adj_ += adj_ * (val_ + 1.0);
21  }
22  };
23  }
24 
54  inline var expm1(const stan::agrad::var& a) {
55  return var(new expm1_vari(a.vi_));
56  }
57 
58  }
59 }
60 #endif
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:40
fvar< T > expm1(const fvar< T > &x)
Definition: expm1.hpp:15
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:27

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