| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

lb_free.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LB_FREE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LB_FREE_HPP
3
4 #include <stan/math/prim/scal/fun/identity_free.hpp>
5 #include <stan/math/prim/scal/err/check_greater_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
29 template <typename T, typename TL>
30 inline
31 typename boost::math::tools::promote_args<T, TL>::type
32 lb_free(const T y, const TL lb) {
33 using std::log;
34 if (lb == -std::numeric_limits<double>::infinity())
35 return identity_free(y);
36 stan::math::check_greater_or_equal("stan::math::lb_free",
37 "Lower bounded variable", y, lb);
38 return log(y - lb);
39 }
40
41 }
42
43 }
44
45 #endif
stan::math::check_greater_or_equal
bool check_greater_or_equal(const char *function, const char *name, const T_y &y, const T_low &low)
Return true if y is greater or equal than low.
Definition: check_greater_or_equal.hpp:84
stan
Definition: log_sum_exp.hpp:8
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
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::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_greater_or_equal.hpp

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