| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

gumbel_rng.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_PROB_GUMBEL_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_GUMBEL_RNG_HPP
3
4 #include <stan/math/prim/scal/err/check_consistent_sizes.hpp>
5 #include <stan/math/prim/scal/err/check_finite.hpp>
6 #include <stan/math/prim/scal/err/check_not_nan.hpp>
7 #include <stan/math/prim/scal/err/check_positive.hpp>
8 #include <stan/math/prim/scal/meta/length.hpp>
9 #include <stan/math/prim/scal/meta/VectorView.hpp>
10 #include <stan/math/prim/scal/meta/VectorBuilder.hpp>
11 #include <stan/math/prim/scal/meta/return_type.hpp>
12 #include <stan/math/prim/scal/fun/constants.hpp>
13 #include <stan/math/prim/scal/meta/include_summand.hpp>
14 #include <stan/math/prim/scal/fun/value_of.hpp>
15 #include <boost/random/uniform_01.hpp>
16 #include <boost/random/variate_generator.hpp>
17
18 namespace stan {
19 namespace math {
20
21 template <class RNG>
22 inline double
23 gumbel_rng(const double mu,
24 const double beta,
25 RNG& rng) {
26 using boost::variate_generator;
27 using boost::uniform_01;
28
29 static const char* function("gumbel_rng");
30
31 check_finite(function, "Location parameter", mu);
32 check_positive(function, "Scale parameter", beta);
33
34 variate_generator<RNG&, uniform_01<> >
35 uniform01_rng(rng, uniform_01<>());
36 return mu - beta * std::log(-std::log(uniform01_rng()));
37 }
38
39 }
40 }
41 #endif
check_not_nan.hpp
check_positive.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:14
return_type.hpp
stan::math::gumbel_rng
double gumbel_rng(const double mu, const double beta, RNG &rng)
Definition: gumbel_rng.hpp:23
include_summand.hpp
VectorView.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:66
VectorBuilder.hpp
length.hpp
stan::math::check_finite
bool check_finite(const char *function, const char *name, const T_y &y)
Return true if y is finite.
Definition: check_finite.hpp:60
constants.hpp
check_finite.hpp
value_of.hpp
check_consistent_sizes.hpp

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