Stan Math Library: stan/math/rev/scal/fun/erfc.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

erfc.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_SCAL_FUN_ERFC_HPP
2 #define STAN_MATH_REV_SCAL_FUN_ERFC_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/erf.hpp>
12 using boost::math::erfc;
13 #endif
14
15 namespace stan {
16 namespace math {
17
18 namespace {
19 class erfc_vari : public op_v_vari {
20 public:
21 explicit erfc_vari(vari* avi) :
22 op_v_vari(::erfc(avi->val_), avi) {
23 }
24 void chain() {
25 avi_->adj_ += adj_ * stan::math::NEG_TWO_OVER_SQRT_PI
26 * std::exp(- avi_->val_ * avi_->val_);
27 }
28 };
29 }
30
68 inline var erfc(const var& a) {
69 return var(new erfc_vari(a.vi_));
70 }
71
72 }
73 }
74 #endif
core.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::erfc
var erfc(const var &a)
The complementary error function for variables (C99).
Definition: erfc.hpp:68
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:43
stan::math::NEG_TWO_OVER_SQRT_PI
const double NEG_TWO_OVER_SQRT_PI
Definition: constants.hpp:163
constants.hpp
stan::math::erfc
fvar< T > erfc(const fvar< T > &x)
Definition: erfc.hpp:14

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