/
usr
/
include
/
boost
/
math
/
distributions
/
/usr/include/boost/math/distributions
mkdir
upload
Name
Size
Mode
Actions
detail/
-
0755
rm
arcsine.hpp
18797
0644
edit
dl
rm
bernoulli.hpp
12143
0644
edit
dl
rm
beta.hpp
18807
0644
edit
dl
rm
binomial.hpp
28654
0644
edit
dl
rm
cauchy.hpp
12310
0644
edit
dl
rm
chi_squared.hpp
12242
0644
edit
dl
rm
complement.hpp
5978
0644
edit
dl
rm
empirical_cumulative_distribution_function.hpp
1886
0644
edit
dl
rm
exponential.hpp
8944
0644
edit
dl
rm
extreme_value.hpp
10491
0644
edit
dl
rm
find_location.hpp
6713
0644
edit
dl
rm
find_scale.hpp
9674
0644
edit
dl
rm
fisher_f.hpp
14391
0644
edit
dl
rm
fwd.hpp
5461
0644
edit
dl
rm
gamma.hpp
10660
0644
edit
dl
rm
geometric.hpp
21156
0644
edit
dl
rm
hyperexponential.hpp
21887
0644
edit
dl
rm
hypergeometric.hpp
12220
0644
edit
dl
rm
inverse_chi_squared.hpp
15202
0644
edit
dl
rm
inverse_gamma.hpp
15389
0644
edit
dl
rm
inverse_gaussian.hpp
19760
0644
edit
dl
rm
laplace.hpp
10580
0644
edit
dl
rm
logistic.hpp
11273
0644
edit
dl
rm
lognormal.hpp
11714
0644
edit
dl
rm
negative_binomial.hpp
26139
0644
edit
dl
rm
non_central_beta.hpp
35837
0644
edit
dl
rm
non_central_chi_squared.hpp
40704
0644
edit
dl
rm
non_central_f.hpp
15848
0644
edit
dl
rm
non_central_t.hpp
47973
0644
edit
dl
rm
normal.hpp
10768
0644
edit
dl
rm
pareto.hpp
15516
0644
edit
dl
rm
poisson.hpp
20267
0644
edit
dl
rm
rayleigh.hpp
10344
0644
edit
dl
rm
skew_normal.hpp
25646
0644
edit
dl
rm
students_t.hpp
18476
0644
edit
dl
rm
triangular.hpp
18407
0644
edit
dl
rm
uniform.hpp
12963
0644
edit
dl
rm
weibull.hpp
12081
0644
edit
dl
rm
Edit:
/usr/include/boost/math/distributions/find_location.hpp
(6713B)
// Copyright John Maddock 2007. // Copyright Paul A. Bristow 2007. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_STATS_FIND_LOCATION_HPP #define BOOST_STATS_FIND_LOCATION_HPP #include <boost/math/distributions/fwd.hpp> // for all distribution signatures. #include <boost/math/distributions/complement.hpp> #include <boost/math/policies/policy.hpp> #include <boost/math/tools/traits.hpp> #include <boost/static_assert.hpp> #include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/policies/error_handling.hpp> // using boost::math::policies::policy; // using boost::math::complement; // will be needed by users who want complement, // but NOT placed here to avoid putting it in global scope. namespace boost { namespace math { // Function to find location of random variable z // to give probability p (given scale) // Applies to normal, lognormal, extreme value, Cauchy, (and symmetrical triangular), // enforced by BOOST_STATIC_ASSERT below. template <class Dist, class Policy> inline typename Dist::value_type find_location( // For example, normal mean. typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p. // For example, a nominal minimum acceptable z, so that p * 100 % are > z typename Dist::value_type p, // probability value desired at x, say 0.95 for 95% > z. typename Dist::value_type scale, // scale parameter, for example, normal standard deviation. const Policy& pol ) { #if !defined(BOOST_NO_SFINAE) && !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) // Will fail to compile here if try to use with a distribution without scale & location, // for example pareto, and many others. These tests are disabled by the pp-logic // above if the compiler doesn't support the SFINAE tricks used in the traits class. BOOST_STATIC_ASSERT(::boost::math::tools::is_distribution<Dist>::value); BOOST_STATIC_ASSERT(::boost::math::tools::is_scaled_distribution<Dist>::value); #endif static const char* function = "boost::math::find_location<Dist, Policy>&, %1%)"; if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1)) { return policies::raise_domain_error<typename Dist::value_type>( function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, pol); } if(!(boost::math::isfinite)(z)) { return policies::raise_domain_error<typename Dist::value_type>( function, "z parameter was %1%, but must be finite!", z, pol); } if(!(boost::math::isfinite)(scale)) { return policies::raise_domain_error<typename Dist::value_type>( function, "scale parameter was %1%, but must be finite!", scale, pol); } //cout << "z " << z << ", p " << p << ", quantile(Dist(), p) " // << quantile(Dist(), p) << ", quan * scale " << quantile(Dist(), p) * scale << endl; return z - (quantile(Dist(), p) * scale); } // find_location template <class Dist> inline // with default policy. typename Dist::value_type find_location( // For example, normal mean. typename Dist::value_type z, // location of random variable z to give probability, P(X > z) == p. // For example, a nominal minimum acceptable z, so that p * 100 % are > z typename Dist::value_type p, // probability value desired at x, say 0.95 for 95% > z. typename Dist::value_type scale) // scale parameter, for example, normal standard deviation. { // Forward to find_location with default policy. return (find_location<Dist>(z, p, scale, policies::policy<>())); } // find_location // So the user can start from the complement q = (1 - p) of the probability p, // for example, l = find_location<normal>(complement(z, q, sd)); template <class Dist, class Real1, class Real2, class Real3> inline typename Dist::value_type find_location( // Default policy. complemented3_type<Real1, Real2, Real3> const& c) { static const char* function = "boost::math::find_location<Dist, Policy>&, %1%)"; typename Dist::value_type p = c.param1; if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1)) { return policies::raise_domain_error<typename Dist::value_type>( function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, policies::policy<>()); } typename Dist::value_type z = c.dist; if(!(boost::math::isfinite)(z)) { return policies::raise_domain_error<typename Dist::value_type>( function, "z parameter was %1%, but must be finite!", z, policies::policy<>()); } typename Dist::value_type scale = c.param2; if(!(boost::math::isfinite)(scale)) { return policies::raise_domain_error<typename Dist::value_type>( function, "scale parameter was %1%, but must be finite!", scale, policies::policy<>()); } // cout << "z " << c.dist << ", quantile (Dist(), " << c.param1 << ") * scale " << c.param2 << endl; return z - quantile(Dist(), p) * scale; } // find_location complement template <class Dist, class Real1, class Real2, class Real3, class Real4> inline typename Dist::value_type find_location( // Explicit policy. complemented4_type<Real1, Real2, Real3, Real4> const& c) { static const char* function = "boost::math::find_location<Dist, Policy>&, %1%)"; typename Dist::value_type p = c.param1; if(!(boost::math::isfinite)(p) || (p < 0) || (p > 1)) { return policies::raise_domain_error<typename Dist::value_type>( function, "Probability parameter was %1%, but must be >= 0 and <= 1!", p, c.param3); } typename Dist::value_type z = c.dist; if(!(boost::math::isfinite)(z)) { return policies::raise_domain_error<typename Dist::value_type>( function, "z parameter was %1%, but must be finite!", z, c.param3); } typename Dist::value_type scale = c.param2; if(!(boost::math::isfinite)(scale)) { return policies::raise_domain_error<typename Dist::value_type>( function, "scale parameter was %1%, but must be finite!", scale, c.param3); } // cout << "z " << c.dist << ", quantile (Dist(), " << c.param1 << ") * scale " << c.param2 << endl; return z - quantile(Dist(), p) * scale; } // find_location complement } // namespace boost } // namespace math #endif // BOOST_STATS_FIND_LOCATION_HPP
Save
cmd:
run