Automatic Differentiation
 
Loading...
Searching...
No Matches
std_normal_log_qf.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_PROB_STD_NORMAL_LOG_QF_HPP
2#define STAN_MATH_FWD_PROB_STD_NORMAL_LOG_QF_HPP
3
11#include <cmath>
12
13namespace stan {
14namespace math {
15
16template <typename T>
18 const T xv = std_normal_log_qf(p.val_);
19 int p_sign = 1;
20 auto p_d = p.d_;
21 if (p.d_ < 0) {
22 p_sign = -1;
23 p_d *= -1;
24 }
25 return fvar<T>(
26 xv,
27 p_sign * exp(p.val_ + log(p_d) - NEG_LOG_SQRT_TWO_PI + 0.5 * square(xv)));
28}
29} // namespace math
30} // namespace stan
31#endif
fvar< T > log(const fvar< T > &x)
Definition log.hpp:15
const double NEG_LOG_SQRT_TWO_PI
The value of minus the natural logarithm of the square root of , .
fvar< T > std_normal_log_qf(const fvar< T > &p)
fvar< T > square(const fvar< T > &x)
Definition square.hpp:12
fvar< T > exp(const fvar< T > &x)
Definition exp.hpp:13
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Scalar val_
The value of this variable.
Definition fvar.hpp:49
Scalar d_
The tangent (derivative) of this variable.
Definition fvar.hpp:61
This template class represents scalars used in forward-mode automatic differentiation,...
Definition fvar.hpp:40