Stan Math Library: stan/math/prim/scal/fun/lub_free.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/scal/err/check_bounded.hpp>
5 #include <stan/math/prim/scal/fun/logit.hpp>
6 #include <stan/math/prim/scal/fun/lb_free.hpp>
7 #include <stan/math/prim/scal/fun/ub_free.hpp>
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
stan
Definition: log_sum_exp.hpp:8
lb_free.hpp
stan::math::lub_free
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
stan::math::ub_free
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
stan::math::lb_free
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
check_bounded.hpp
ub_free.hpp
stan::math::logit
fvar< T > logit(const fvar< T > &x)
Definition: logit.hpp:17
logit.hpp

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