Stan Math Library  2.11.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 
12  namespace math {
13 
44  template <typename T, typename TL, typename TU>
45  inline
46  typename boost::math::tools::promote_args<T, TL, TU>::type
47  lub_free(const T y, TL lb, TU ub) {
48  using stan::math::logit;
49  stan::math::check_bounded<T, TL, TU>
50  ("stan::math::lub_free",
51  "Bounded variable",
52  y, lb, ub);
53  if (lb == -std::numeric_limits<double>::infinity())
54  return ub_free(y, ub);
55  if (ub == std::numeric_limits<double>::infinity())
56  return lb_free(y, lb);
57  return logit((y - lb) / (ub - lb));
58  }
59 
60  }
61 
62 }
63 
64 #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:47
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:39
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:32
fvar< T > logit(const fvar< T > &x)
Definition: logit.hpp:17

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