1#ifndef STAN_MATH_PRIM_FUN_INV_LOGIT_HPP
2#define STAN_MATH_PRIM_FUN_INV_LOGIT_HPP
51template <
typename T, require_arithmetic_t<T>* =
nullptr>
54 double exp_a = std::exp(a);
58 return exp_a / (1.0 + exp_a);
60 return inv(1.0 + std::exp(-a));
72 static inline auto fun(T&& x) {
84template <
typename Container, require_ad_container_t<Container>* =
nullptr,
85 require_all_not_nonscalar_prim_or_rev_kernel_expression_t<
86 Container>* =
nullptr,
87 require_not_rev_matrix_t<Container>* =
nullptr>
90 std::forward<Container>(x));
103template <
typename Container,
106 Container>* =
nullptr>
109 std::forward<Container>(x),
110 [](
auto&& v) {
return v.array().logistic(); });
require_t< container_type_check_base< is_container, base_type_t, TypeCheck, Check... > > require_container_bt
Require type satisfies is_container.
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.
auto inv_logit(T &&x)
Returns the inverse logit function applied to the argument.
const double LOG_EPSILON
The natural logarithm of machine precision , .
fvar< T > inv(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
Structure to wrap inv_logit() so that it can be vectorized.