Automatic Differentiation
 
Loading...
Searching...
No Matches
inv_erfc.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_FUN_INV_ERFC_HPP
2#define STAN_MATH_FWD_FUN_INV_ERFC_HPP
3
10#include <cmath>
11
12namespace stan {
13namespace math {
14
15template <typename T>
16inline fvar<T> inv_erfc(const fvar<T>& x) {
17 T precomp_inv_erfc = inv_erfc(x.val());
18 return fvar<T>(precomp_inv_erfc,
19 -x.d_ * exp(LOG_SQRT_PI - LOG_TWO + square(precomp_inv_erfc)));
20}
21
22} // namespace math
23} // namespace stan
24#endif
static constexpr double LOG_TWO
The natural logarithm of 2, .
Definition constants.hpp:80
static constexpr double LOG_SQRT_PI
The natural logarithm of the square root of , .
fvar< T > inv_erfc(const fvar< T > &x)
Definition inv_erfc.hpp:16
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 ...
Definition fvar.hpp:9
Scalar val() const
Return the value of this variable.
Definition fvar.hpp:56
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