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

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

lb_constrain.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LB_CONSTRAIN_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LB_CONSTRAIN_HPP
3
4 #include <boost/math/tools/promotion.hpp>
5 #include <stan/math/prim/scal/fun/identity_constrain.hpp>
6 #include <cmath>
7 #include <limits>
8
9 namespace stan {
10
11 namespace math {
12 // LOWER BOUND
13
33 template <typename T, typename TL>
34 inline
35 T lb_constrain(const T x, const TL lb) {
36 using std::exp;
37 if (lb == -std::numeric_limits<double>::infinity())
38 return identity_constrain(x);
39 return exp(x) + lb;
40 }
41
58 template <typename T, typename TL>
59 inline
60 typename boost::math::tools::promote_args<T, TL>::type
61 lb_constrain(const T x, const TL lb, T& lp) {
62 using std::exp;
63 if (lb == -std::numeric_limits<double>::infinity())
64 return identity_constrain(x, lp);
65 lp += x;
66 return exp(x) + lb;
67 }
68
69
70 }
71
72 }
73
74 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::lb_constrain
T lb_constrain(const T x, const TL lb)
Return the lower-bounded value for the specified unconstrained input and specified lower bound...
Definition: lb_constrain.hpp:35
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
identity_constrain.hpp
stan::math::identity_constrain
T identity_constrain(T x)
Returns the result of applying the identity constraint transform to the input.
Definition: identity_constrain.hpp:22

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