Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
erfc.hpp
Go to the documentation of this file.
1 #ifndef __STAN__AGRAD__REV__ERFC_HPP__
2 #define __STAN__AGRAD__REV__ERFC_HPP__
3 
4 #include <valarray>
5 #include <boost/math/special_functions/erf.hpp>
6 #include <stan/agrad/rev/var.hpp>
9 
10 namespace stan {
11  namespace agrad {
12 
13  namespace {
14  class erfc_vari : public op_v_vari {
15  public:
16  erfc_vari(vari* avi) :
17  op_v_vari(boost::math::erfc(avi->val_),avi) {
18  }
19  void chain() {
20  avi_->adj_ += adj_ * stan::math::NEG_TWO_OVER_SQRT_PI * std::exp(- avi_->val_ * avi_->val_);
21  }
22  };
23  }
24 
37  inline var erfc(const stan::agrad::var& a) {
38  return var(new erfc_vari(a.vi_));
39  }
40 
41  }
42 }
43 #endif

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