| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

expm1.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_SCAL_FUN_EXPM1_HPP
2 #define STAN_MATH_REV_SCAL_FUN_EXPM1_HPP
3
4 #include <math.h>
5 #include <stan/math/rev/core.hpp>
6 #include <stan/math/prim/scal/fun/constants.hpp>
7 #include <cmath>
8 #include <valarray>
9
10 #ifdef _MSC_VER
11 #include <boost/math/special_functions/expm1.hpp>
12 using boost::math::expm1;
13 #endif
14
15 namespace stan {
16 namespace math {
17
18 namespace {
19 class expm1_vari : public op_v_vari {
20 public:
21 explicit expm1_vari(vari* avi) :
22 op_v_vari(::expm1(avi->val_), avi) {
23 }
24 void chain() {
25 avi_->adj_ += adj_ * (val_ + 1.0);
26 }
27 };
28 }
29
57 inline var expm1(const stan::math::var& a) {
58 return var(new expm1_vari(a.vi_));
59 }
60
61 }
62 }
63 #endif
core.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
stan::math::expm1
var expm1(const stan::math::var &a)
The exponentiation of the specified variable minus 1 (C99).
Definition: expm1.hpp:57
stan::math::expm1
fvar< T > expm1(const fvar< T > &x)
Definition: expm1.hpp:12
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:43
constants.hpp

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