All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
ub_free.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_UB_FREE_HPP
#define STAN_MATH_PRIM_SCAL_FUN_UB_FREE_HPP
#include <stan/math/prim/scal/fun/identity_free.hpp>
#include <stan/math/prim/scal/err/check_less_or_equal.hpp>
#include <boost/math/tools/promotion.hpp>
#include <cmath>
#include <limits>
namespace stan {
namespace math {
template <typename T, typename TU>
inline
typename boost::math::tools::promote_args<T, TU>::type
ub_free(const T y, const TU ub) {
using std::log;
if (ub == std::numeric_limits<double>::infinity())
return identity_free(y);
stan::math::check_less_or_equal("stan::math::ub_free",
"Upper bounded variable", y, ub);
return log(ub - y);
}
}
}
#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.