Automatic Differentiation
 
Loading...
Searching...
No Matches
Phi_approx.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_PHI_APPROX_HPP
2#define STAN_MATH_PRIM_FUN_PHI_APPROX_HPP
3
7#include <cmath>
8
9namespace stan {
10namespace math {
11
23inline double Phi_approx(double x) {
24 using std::pow;
25 return inv_logit(0.07056 * pow(x, 3.0) + 1.5976 * x);
26}
27
35inline double Phi_approx(int x) { return Phi_approx(static_cast<double>(x)); }
36
49 template <typename T>
50 static inline auto fun(const T& x) {
51 return Phi_approx(x);
52 }
53};
54
65template <
66 typename T,
69inline auto Phi_approx(const T& x) {
71}
72
73} // namespace math
74} // namespace stan
75
76#endif
require_all_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< Types > >... > require_all_not_nonscalar_prim_or_rev_kernel_expression_t
Require none of the types satisfy is_nonscalar_prim_or_rev_kernel_expression.
require_not_t< is_var_matrix< std::decay_t< T > > > require_not_var_matrix_t
Require type does not satisfy is_var_matrix.
auto pow(const T1 &x1, const T2 &x2)
Definition pow.hpp:32
fvar< T > Phi_approx(const fvar< T > &x)
Return an approximation of the unit normal cumulative distribution function (CDF).
fvar< T > inv_logit(const fvar< T > &x)
Returns the inverse logit function applied to the argument.
Definition inv_logit.hpp:20
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
static auto fun(const T &x)
Return the approximate value of the Phi() function applied to the argument.
Structure to wrap Phi_approx() so it can be vectorized.
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...