All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
rayleigh_rng.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_PROB_RAYLEIGH_RNG_HPP
#define STAN_MATH_PRIM_SCAL_PROB_RAYLEIGH_RNG_HPP
#include <boost/random/uniform_real_distribution.hpp>
#include <boost/random/variate_generator.hpp>
#include <stan/math/prim/scal/meta/OperandsAndPartials.hpp>
#include <stan/math/prim/scal/err/check_consistent_sizes.hpp>
#include <stan/math/prim/scal/err/check_nonnegative.hpp>
#include <stan/math/prim/scal/err/check_not_nan.hpp>
#include <stan/math/prim/scal/err/check_positive.hpp>
#include <stan/math/prim/scal/fun/log1m.hpp>
#include <stan/math/prim/scal/fun/square.hpp>
#include <stan/math/prim/scal/fun/value_of.hpp>
#include <stan/math/prim/scal/meta/length.hpp>
#include <stan/math/prim/scal/meta/is_constant_struct.hpp>
#include <stan/math/prim/scal/meta/partials_return_type.hpp>
#include <stan/math/prim/scal/fun/constants.hpp>
#include <stan/math/prim/scal/meta/include_summand.hpp>
#include <stan/math/prim/scal/meta/VectorBuilder.hpp>
namespace stan {
namespace math {
template <class RNG>
inline double
rayleigh_rng(const double sigma,
RNG& rng) {
using boost::variate_generator;
using boost::random::uniform_real_distribution;
static const char* function("stan::math::rayleigh_rng");
using stan::math::check_positive;
check_positive(function, "Scale parameter", sigma);
variate_generator<RNG&, uniform_real_distribution<> >
uniform_rng(rng, uniform_real_distribution<>(0.0, 1.0));
return sigma * std::sqrt(-2.0 * std::log(uniform_rng()));
}
}
}
#endif
check_not_nan.hpp
stan::math::sqrt
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:15
check_positive.hpp
stan::math::rayleigh_rng
double rayleigh_rng(const double sigma, RNG &rng)
Definition: rayleigh_rng.hpp:27
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
square.hpp
include_summand.hpp
check_nonnegative.hpp
stan::math::check_positive
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
Definition: check_positive.hpp:68
OperandsAndPartials.hpp
stan::math::uniform_rng
double uniform_rng(const double alpha, const double beta, RNG &rng)
Definition: uniform_rng.hpp:22
VectorBuilder.hpp
log1m.hpp
partials_return_type.hpp
length.hpp
constants.hpp
is_constant_struct.hpp
value_of.hpp
check_consistent_sizes.hpp

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