Stan Math Library: stan/math/prim/scal/prob/pareto_rng.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

pareto_rng.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_PROB_PARETO_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_PARETO_RNG_HPP
3
4 #include <boost/random/exponential_distribution.hpp>
5 #include <boost/random/variate_generator.hpp>
6 #include <stan/math/prim/scal/err/check_consistent_sizes.hpp>
7 #include <stan/math/prim/scal/err/check_greater_or_equal.hpp>
8 #include <stan/math/prim/scal/err/check_nonnegative.hpp>
9 #include <stan/math/prim/scal/err/check_not_nan.hpp>
10 #include <stan/math/prim/scal/err/check_positive_finite.hpp>
11 #include <stan/math/prim/scal/fun/constants.hpp>
12 #include <stan/math/prim/scal/fun/multiply_log.hpp>
13 #include <stan/math/prim/scal/fun/value_of.hpp>
14
15
16 namespace stan {
17 namespace math {
18
19 template <class RNG>
20 inline double
21 pareto_rng(const double y_min,
22 const double alpha,
23 RNG& rng) {
24 using boost::variate_generator;
25 using boost::exponential_distribution;
26
27 static const char* function("stan::math::pareto_rng");
28
29 using stan::math::check_positive_finite;
30
31 check_positive_finite(function, "Scale parameter", y_min);
32 check_positive_finite(function, "Shape parameter", alpha);
33
34 variate_generator<RNG&, exponential_distribution<> >
35 exp_rng(rng, exponential_distribution<>(alpha));
36 return y_min * std::exp(exp_rng());
37 }
38 }
39 }
40 #endif
check_not_nan.hpp
check_positive_finite.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::pareto_rng
double pareto_rng(const double y_min, const double alpha, RNG &rng)
Definition: pareto_rng.hpp:21
multiply_log.hpp
check_nonnegative.hpp
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
constants.hpp
check_greater_or_equal.hpp
value_of.hpp
check_consistent_sizes.hpp
stan::math::check_positive_finite
bool check_positive_finite(const char *function, const char *name, const T_y &y)
Return true if y is positive and finite.
Definition: check_positive_finite.hpp:28

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