Automatic Differentiation
 
Loading...
Searching...
No Matches
prob_free.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_CONSTRAINT_PROB_FREE_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_PROB_FREE_HPP
3
7
8namespace stan {
9namespace math {
10
26template <typename T>
27inline auto prob_free(T&& y) {
28 auto&& y_ref = to_ref(std::forward<T>(y));
29 check_bounded<plain_type_t<T>, double, double>(
30 "prob_free", "Probability variable", y_ref, 0, 1);
31 return logit(std::forward<decltype(y_ref)>(y_ref));
32}
33
34} // namespace math
35} // namespace stan
36#endif
fvar< T > logit(const fvar< T > &x)
Definition logit.hpp:14
auto prob_free(T &&y)
Return the free scalar that when transformed to a probability produces the specified scalar.
Definition prob_free.hpp:27
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Definition to_ref.hpp:18
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...