Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
erfc.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__FUNCTIONS__ERFC_HPP
2 #define STAN__AGRAD__REV__FUNCTIONS__ERFC_HPP
3 
4 #include <math.h>
5 #include <valarray>
6 #include <boost/math/special_functions/erf.hpp>
7 #include <stan/agrad/rev/var.hpp>
10 
11 namespace stan {
12  namespace agrad {
13 
14  namespace {
15  class erfc_vari : public op_v_vari {
16  public:
17  erfc_vari(vari* avi) :
18  op_v_vari(::erfc(avi->val_),avi) {
19  }
20  void chain() {
21  avi_->adj_ += adj_ * stan::math::NEG_TWO_OVER_SQRT_PI * ::exp(- avi_->val_ * avi_->val_);
22  }
23  };
24  }
25 
63  inline var erfc(const stan::agrad::var& a) {
64  return var(new erfc_vari(a.vi_));
65  }
66 
67  }
68 }
69 #endif
fvar< T > erfc(const fvar< T > &x)
Definition: erfc.hpp:17
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:40
const double NEG_TWO_OVER_SQRT_PI
Definition: constants.hpp:148
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:27
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:16

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