All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
prob_constrain.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_PROB_CONSTRAIN_HPP
#define STAN_MATH_PRIM_SCAL_FUN_PROB_CONSTRAIN_HPP
#include <stan/math/prim/scal/fun/inv_logit.hpp>
#include <stan/math/prim/scal/fun/log1m.hpp>
#include <cmath>
namespace stan {
namespace math {
template <typename T>
inline
T prob_constrain(const T x) {
using stan::math::inv_logit;
return inv_logit(x);
}
template <typename T>
inline
T prob_constrain(const T x, T& lp) {
using stan::math::inv_logit;
using stan::math::log1m;
using std::log;
T inv_logit_x = inv_logit(x);
lp += log(inv_logit_x) + log1m(inv_logit_x);
return inv_logit_x;
}
}
}
#endif
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
stan::math::inv_logit
fvar< T > inv_logit(const fvar< T > &x)
Definition: inv_logit.hpp:15
log1m.hpp
inv_logit.hpp
stan::math::prob_constrain
T prob_constrain(const T x)
Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free sca...
Definition: prob_constrain.hpp:27
stan::math::log1m
fvar< T > log1m(const fvar< T > &x)
Definition: log1m.hpp:16

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