| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

inv_Phi.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_SCAL_FUN_INV_PHI_HPP
2 #define STAN_MATH_REV_SCAL_FUN_INV_PHI_HPP
3
4 #include <stan/math/rev/core.hpp>
5 #include <stan/math/prim/scal/fun/inv_Phi.hpp>
6 #include <stan/math/prim/scal/fun/constants.hpp>
7 #include <stan/math/rev/scal/fun/square.hpp>
8
9 namespace stan {
10 namespace math {
11
12 namespace {
13 class inv_Phi_vari : public op_v_vari {
14 public:
15 explicit inv_Phi_vari(vari* avi) :
16 op_v_vari(inv_Phi(avi->val_), avi) {
17 }
18 void chain() {
19 static const double NEG_HALF = -0.5;
20 avi_->adj_ += adj_
21 * SQRT_2_TIMES_SQRT_PI
22 / std::exp(NEG_HALF * val_ * val_);
23 }
24 };
25 }
26
37 inline var inv_Phi(const var& p) {
38 return var(new inv_Phi_vari(p.vi_));
39 }
40
41 }
42 }
43 #endif
core.hpp
stan::math::inv_Phi
fvar< T > inv_Phi(const fvar< T > &p)
Definition: inv_Phi.hpp:14
stan
Definition: log_sum_exp.hpp:8
square.hpp
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:30
stan::math::SQRT_2_TIMES_SQRT_PI
const double SQRT_2_TIMES_SQRT_PI
Definition: constants.hpp:156
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:42
constants.hpp
inv_Phi.hpp

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