| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
ub_free.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_UB_FREE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_UB_FREE_HPP
3
4 #include <stan/math/prim/scal/fun/identity_free.hpp>
5 #include <stan/math/prim/scal/err/check_less_or_equal.hpp>
6 #include <boost/math/tools/promotion.hpp>
7 #include <cmath>
8 #include <limits>
9
10 namespace stan {
11
12 namespace math {
13
36 template <typename T, typename TU>
37 inline
38 typename boost::math::tools::promote_args<T, TU>::type
39 ub_free(const T y, const TU ub) {
40 using std::log;
41 if (ub == std::numeric_limits<double>::infinity())
42 return identity_free(y);
43 stan::math::check_less_or_equal("stan::math::ub_free",
44 "Upper bounded variable", y, ub);
45 return log(ub - y);
46 }
47
48
49 }
50
51 }
52
53 #endif
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
check_less_or_equal.hpp
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
identity_free.hpp
stan::math::identity_free
T identity_free(const T y)
Returns the result of applying the inverse of the identity constraint transform to the input...
Definition: identity_free.hpp:21
stan::math::check_less_or_equal
bool check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high)
Return true if y is less or equal to high.
Definition: check_less_or_equal.hpp:81

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