Stan Math Library  2.15.0
reverse mode automatic differentiation
lub_free.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LUB_FREE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LUB_FREE_HPP
3 
8 #include <limits>
9 
10 namespace stan {
11  namespace math {
12 
43  template <typename T, typename TL, typename TU>
44  inline
45  typename boost::math::tools::promote_args<T, TL, TU>::type
46  lub_free(const T y, TL lb, TU ub) {
47  check_bounded<T, TL, TU>
48  ("lub_free",
49  "Bounded variable",
50  y, lb, ub);
51  if (lb == -std::numeric_limits<double>::infinity())
52  return ub_free(y, ub);
53  if (ub == std::numeric_limits<double>::infinity())
54  return lb_free(y, lb);
55  return logit((y - lb) / (ub - lb));
56  }
57 
58  }
59 }
60 #endif
boost::math::tools::promote_args< T, TL, TU >::type lub_free(const T y, TL lb, TU ub)
Return the unconstrained scalar that transforms to the specified lower- and upper-bounded scalar give...
Definition: lub_free.hpp:46
boost::math::tools::promote_args< T, TU >::type ub_free(const T y, const TU ub)
Return the free scalar that corresponds to the specified upper-bounded value with respect to the spec...
Definition: ub_free.hpp:38
boost::math::tools::promote_args< T, TL >::type lb_free(const T y, const TL lb)
Return the unconstrained value that produces the specified lower-bound constrained value...
Definition: lb_free.hpp:31
fvar< T > logit(const fvar< T > &x)
Definition: logit.hpp:16

     [ Stan Home Page ] © 2011–2016, Stan Development Team.