Stan Math Library  2.20.0
reverse mode automatic differentiation
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 
8 #include <boost/math/tools/promotion.hpp>
9 #include <cmath>
10 
11 namespace stan {
12 namespace math {
13 
29 template <typename T, typename L>
30 inline typename boost::math::tools::promote_args<T, L>::type lb_free(
31  const T& y, const L& lb) {
32  using std::log;
33  if (lb == NEGATIVE_INFTY)
34  return identity_free(y);
35  check_greater_or_equal("lb_free", "Lower bounded variable", y, lb);
36  return log(y - lb);
37 }
38 
39 } // namespace math
40 } // namespace stan
41 #endif
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:12
boost::math::tools::promote_args< T, L >::type lb_free(const T &y, const L &lb)
Return the unconstrained value that produces the specified lower-bound constrained value...
Definition: lb_free.hpp:30
void check_greater_or_equal(const char *function, const char *name, const T_y &y, const T_low &low)
Check if y is greater or equal than low.
T identity_free(const T &y)
Returns the result of applying the inverse of the identity constraint transform to the input...
const double NEGATIVE_INFTY
Negative infinity.
Definition: constants.hpp:53

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