]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/example/policy_ref_snip5.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / math / example / policy_ref_snip5.cpp
CommitLineData
7c673cae
FG
1// Copyright John Maddock 2007.
2// Copyright Paul A. Bristow 2010.
3// Use, modification and distribution are subject to the
4// Boost Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7// Note that this file contains quickbook mark-up as well as code
8// and comments, don't change any of the special comment mark-ups!
9
10//[policy_ref_snip5
11
12#include <boost/math/distributions/negative_binomial.hpp>
13using boost::math::negative_binomial_distribution;
14
15using namespace boost::math::policies;
16
17typedef negative_binomial_distribution<
18 double,
19 policy<discrete_quantile<real> >
20 > dist_type;
21
22// Lower 5% quantile:
23double x = quantile(dist_type(20, 0.3), 0.05);
24// Upper 95% quantile:
25double y = quantile(complement(dist_type(20, 0.3), 0.05));
26
27//] //[/policy_ref_snip5]
28
29#include <iostream>
30using std::cout; using std::endl;
31
32int main()
33{
34 cout << "quantile(dist_type(20, 0.3), 0.05) = " << x
35 << "\nquantile(complement(dist_type(20, 0.3), 0.05) = " << y << endl;
36}
37
38/*
39
40Output:
41 quantile(dist_type(20, 0.3), 0.05) = 27.3898
42 quantile(complement(dist_type(20, 0.3), 0.05) = 68.1584
43
44 */
45