Stan
1.3
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Pages
src
stan
agrad
rev
Phi_approx.hpp
Go to the documentation of this file.
1
#ifndef __STAN__AGRAD__REV__PHI_APPROX_HPP__
2
#define __STAN__AGRAD__REV__PHI_APPROX_HPP__
3
4
#include <
stan/agrad/rev/var.hpp
>
5
#include <
stan/agrad/rev/precomp_v_vari.hpp
>
6
#include <
stan/math/functions/inv_logit.hpp
>
7
8
namespace
stan {
9
namespace
agrad {
10
19
inline
var
Phi_approx
(
const
stan::agrad::var
& a) {
20
// return inv_logit(0.07056 * pow(a,3.0) + 1.5976 * a);
21
22
double
av = a.
vi_
->
val_
;
23
double
av_squared = av * av;
24
double
av_cubed = av * av_squared;
25
double
f =
stan::math::inv_logit
(0.07056 * av_cubed + 1.5976 * av);
26
double
da = f * (1 - f) * (3.0 * 0.07056 * av_squared + 1.5976);
27
return
var
(
new
precomp_v_vari
(f,a.
vi_
,da));
28
}
29
30
}
31
}
32
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.