1 #ifndef STAN_MATH_FWD_SCAL_FUN_INV_LOGIT_HPP
2 #define STAN_MATH_FWD_SCAL_FUN_INV_LOGIT_HPP
3 
4 #include <stan/math/fwd/core.hpp>
5 
6 #include <stan/math/prim/scal/fun/inv_logit.hpp>
7 
8 namespace stan {
9 namespace math {
10 
11 /**
12  * Returns the inverse logit function applied to the argument.
13  *
14  * @tparam T scalar type of forward-mode autodiff variable
15  * argument.
16  * @param x argument
17  * @return inverse logit of argument
18  */
19 template <typename T>
inv_logit(const fvar<T> & x)20 inline fvar<T> inv_logit(const fvar<T>& x) {
21   using std::exp;
22   using std::pow;
23   return fvar<T>(inv_logit(x.val_),
24                  x.d_ * inv_logit(x.val_) * (1 - inv_logit(x.val_)));
25 }
26 }  // namespace math
27 }  // namespace stan
28 #endif
29