| 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
normal_rng.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_PROB_NORMAL_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_NORMAL_RNG_HPP
3
4 #include <boost/random/normal_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_not_nan.hpp>
10 #include <stan/math/prim/scal/err/check_positive.hpp>
11 #include <stan/math/prim/scal/fun/constants.hpp>
12 #include <stan/math/prim/scal/fun/value_of.hpp>
13
14 namespace stan {
15
16 namespace math {
17
18 template <class RNG>
19 inline double
20 normal_rng(const double mu,
21 const double sigma,
22 RNG& rng) {
23 using boost::variate_generator;
24 using boost::normal_distribution;
25 using stan::math::check_positive;
26 using stan::math::check_finite;
27 using stan::math::check_not_nan;
28
29 static const char* function("stan::math::normal_rng");
30
31 check_finite(function, "Location parameter", mu);
32 check_not_nan(function, "Location parameter", mu);
33 check_positive(function, "Scale parameter", sigma);
34 check_not_nan(function, "Scale parameter", sigma);
35
36 variate_generator<RNG&, normal_distribution<> >
37 norm_rng(rng, normal_distribution<>(mu, sigma));
38 return norm_rng();
39 }
40 }
41 }
42 #endif
check_not_nan.hpp
stan::math::check_not_nan
bool check_not_nan(const char *function, const char *name, const T_y &y)
Return true if y is not NaN.
Definition: check_not_nan.hpp:63
check_positive.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::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
stan::math::normal_rng
double normal_rng(const double mu, const double sigma, RNG &rng)
Definition: normal_rng.hpp:20
check_consistent_sizes.hpp

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