All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
lb_constrain.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_LB_CONSTRAIN_HPP
#define STAN_MATH_PRIM_SCAL_FUN_LB_CONSTRAIN_HPP
#include <boost/math/tools/promotion.hpp>
#include <stan/math/prim/scal/fun/identity_constrain.hpp>
#include <cmath>
#include <limits>
namespace stan {
namespace math {
// LOWER BOUND
template <typename T, typename TL>
inline
T lb_constrain(const T x, const TL lb) {
using std::exp;
if (lb == -std::numeric_limits<double>::infinity())
return identity_constrain(x);
return exp(x) + lb;
}
template <typename T, typename TL>
inline
typename boost::math::tools::promote_args<T, TL>::type
lb_constrain(const T x, const TL lb, T& lp) {
using std::exp;
if (lb == -std::numeric_limits<double>::infinity())
return identity_constrain(x, lp);
lp += x;
return exp(x) + lb;
}
}
}
#endif
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–2015, Stan Development Team.