| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
uniform_rng.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_PROB_UNIFORM_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_UNIFORM_RNG_HPP
3
4 #include <boost/random/uniform_real_distribution.hpp>
5 #include <boost/random/variate_generator.hpp>
6 #include <stan/math/prim/scal/meta/OperandsAndPartials.hpp>
7 #include <stan/math/prim/scal/err/check_consistent_sizes.hpp>
8 #include <stan/math/prim/scal/err/check_finite.hpp>
9 #include <stan/math/prim/scal/err/check_greater.hpp>
10 #include <stan/math/prim/scal/err/check_not_nan.hpp>
11 #include <stan/math/prim/scal/fun/constants.hpp>
12 #include <stan/math/prim/scal/fun/value_of.hpp>
13 #include <stan/math/prim/scal/meta/VectorBuilder.hpp>
14 #include <stan/math/prim/scal/meta/include_summand.hpp>
15
16 namespace stan {
17
18 namespace math {
19
20 template <class RNG>
21 inline double
22 uniform_rng(const double alpha,
23 const double beta,
24 RNG& rng) {
25 using boost::variate_generator;
26 using boost::random::uniform_real_distribution;
27
28 static const char* function("stan::math::uniform_rng");
29
30 using stan::math::check_finite;
31 using stan::math::check_greater;
32
33 check_finite(function, "Lower bound parameter", alpha);
34 check_finite(function, "Upper bound parameter", beta);
35 check_greater(function, "Upper bound parameter", beta, alpha);
36
37 variate_generator<RNG&, uniform_real_distribution<> >
38 uniform_rng(rng, uniform_real_distribution<>(alpha, beta));
39 return uniform_rng();
40 }
41 }
42 }
43 #endif
check_not_nan.hpp
include_summand.hpp
check_greater.hpp
OperandsAndPartials.hpp
stan::math::uniform_rng
double uniform_rng(const double alpha, const double beta, RNG &rng)
Definition: uniform_rng.hpp:22
VectorBuilder.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:62
constants.hpp
check_finite.hpp
value_of.hpp
check_consistent_sizes.hpp
stan::math::check_greater
bool check_greater(const char *function, const char *name, const T_y &y, const T_low &low)
Return true if y is strictly greater than low.
Definition: check_greater.hpp:84

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