mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Add SYCL testing of normal dist Add CUDA testing of normal dist Add NVRTC testing of normal dist NVRTC fixes Move headers for NVRTC support Add GPU support to inverse gaussian dist Add NVRTC testing of inverse Gaussian dist Add CUDA testing of inverse gaussian dist Add SYCL testing of inverse gaussian dist Add GPU support to lognormal dist Add SYCL testing of lognormal dist Add CUDA testing of lognormal dist Add nvrtc testing of lognormal dist Add GPU support to negative binomial dist Avoid float_prior on GPU platform Add NVRTC testing of negative binomial dist Fix ambiguous use of nextafter Add CUDA testing of negative binomial dist Fix float_prior workaround Add SYCL testing of negative binomial dist Add GPU support to non_central_beta dist Add SYCL testing of nc beta dist Add CUDA testing of nc beta dist Enable generic dist handling on GPU Add GPU support to brent_find_minima Add NVRTC testing of nc beta dist Add utility header Replace non-functional macro with new function Add GPU support to non central chi squared dist Add SYCL testing of non central chi squared dist Add missing macro definition Markup generic quantile finder Add CUDA testing of non central chi squared dist Add NVRTC testing of non central chi squared dist Add GPU support to the non-central f dist Add SYCL testing of ncf Add CUDA testing of ncf dist Add NVRTC testing of ncf dist Add GPU support to students_t dist Add SYCL testing of students_t dist Add CUDA testing of students_t Add NVRTC testing of students_t dist Workaround for header cycle Add GPU support to pareto dist Add SYCL testing of pareto dist Add CUDA testing of pareto dist Add NVRTC testing of pareto dist Add missing header Add GPU support to poisson dist Add SYCL testing of poisson dist Add CUDA testing of poisson dist Add NVRTC testing of poisson dist Add forward decl for NVRTC platform Add GPU support to rayleigh dist Add CUDA testing of rayleigh dist Add SYCL testing of rayleigh dist Add NVRTC testing of rayleigh dist Add GPU support to triangular dist Add SYCL testing of triangular dist Add NVRTC testing of triangular dist Add CUDA testing of triangular dist Add GPU support to the uniform dist Add CUDA testing of uniform dist Add SYCL testing of uniform dist Add NVRTC testing of uniform dist Fix missing header Add markers to docs
111 lines
3.6 KiB
Plaintext
111 lines
3.6 KiB
Plaintext
[section:poisson_dist Poisson Distribution]
|
|
|
|
``#include <boost/math/distributions/poisson.hpp>``
|
|
|
|
namespace boost { namespace math {
|
|
|
|
template <class RealType = double,
|
|
class ``__Policy`` = ``__policy_class`` >
|
|
class poisson_distribution;
|
|
|
|
typedef poisson_distribution<> poisson;
|
|
|
|
template <class RealType, class ``__Policy``>
|
|
class poisson_distribution
|
|
{
|
|
public:
|
|
typedef RealType value_type;
|
|
typedef Policy policy_type;
|
|
|
|
BOOST_MATH_GPU_ENABLED poisson_distribution(RealType mean = 1); // Constructor.
|
|
BOOST_MATH_GPU_ENABLED RealType mean()const; // Accessor.
|
|
}
|
|
|
|
}} // namespaces boost::math
|
|
|
|
The [@http://en.wikipedia.org/wiki/Poisson_distribution Poisson distribution]
|
|
is a well-known statistical discrete distribution.
|
|
It expresses the probability of a number of events
|
|
(or failures, arrivals, occurrences ...)
|
|
occurring in a fixed period of time,
|
|
provided these events occur with a known mean rate [lambda]
|
|
(events/time), and are independent of the time since the last event.
|
|
|
|
The distribution was discovered by Sim[eacute]on-Denis Poisson (1781 to 1840).
|
|
|
|
It has the Probability Mass Function:
|
|
|
|
[equation poisson_ref1]
|
|
|
|
for k events, with an expected number of events [lambda].
|
|
|
|
The following graph illustrates how the PDF varies with the parameter [lambda]:
|
|
|
|
[graph poisson_pdf_1]
|
|
|
|
[discrete_quantile_warning Poisson]
|
|
|
|
[h4 Member Functions]
|
|
|
|
BOOST_MATH_GPU_ENABLED poisson_distribution(RealType mean = 1);
|
|
|
|
Constructs a poisson distribution with mean /mean/.
|
|
|
|
BOOST_MATH_GPU_ENABLED RealType mean()const;
|
|
|
|
Returns the /mean/ of this distribution.
|
|
|
|
[h4 Non-member Accessors]
|
|
|
|
All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
|
|
distributions are supported: __usual_accessors.
|
|
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
|
|
be run on both host and device.
|
|
|
|
The domain of the random variable is \[0, [infin]\].
|
|
|
|
In this distribution the implementation of `logpdf` is specialized
|
|
to improve numerical accuracy.
|
|
|
|
[h4 Accuracy]
|
|
|
|
The Poisson distribution is implemented in terms of the
|
|
incomplete gamma functions __gamma_p and __gamma_q
|
|
and as such should have low error rates: but refer to the documentation
|
|
of those functions for more information.
|
|
The quantile and its complement use the inverse gamma functions
|
|
and are therefore probably slightly less accurate: this is because the
|
|
inverse gamma functions are implemented using an iterative method with a
|
|
lower tolerance to avoid excessive computation.
|
|
|
|
[h4 Implementation]
|
|
|
|
In the following table [lambda] is the mean of the distribution,
|
|
/k/ is the random variable, /p/ is the probability and /q = 1-p/.
|
|
|
|
[table
|
|
[[Function][Implementation Notes]]
|
|
[[pdf][Using the relation: pdf = e[super -[lambda]] [lambda][super k] \/ k! ]]
|
|
[[logpdf][log(pdf) = -lgamma(k+1) + k*log([lambda]) - [lambda] if k > 0 and [lambda] > 0 ]]
|
|
[[cdf][Using the relation: p = [Gamma](k+1, [lambda]) \/ k! = __gamma_q(k+1, [lambda])]]
|
|
[[cdf complement][Using the relation: q = __gamma_p(k+1, [lambda]) ]]
|
|
[[quantile][Using the relation: k = __gamma_q_inva([lambda], p) - 1]]
|
|
[[quantile from the complement][Using the relation: k = __gamma_p_inva([lambda], q) - 1]]
|
|
[[mean][[lambda]]]
|
|
[[mode][ floor ([lambda]) or [floorlr[lambda]] ]]
|
|
[[skewness][1/[radic][lambda]]]
|
|
[[kurtosis][3 + 1/[lambda]]]
|
|
[[kurtosis excess][1/[lambda]]]
|
|
]
|
|
|
|
[endsect] [/section:poisson_dist Poisson]
|
|
|
|
[/ poisson.qbk
|
|
Copyright 2006 John Maddock and Paul A. Bristow.
|
|
Distributed under 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).
|
|
]
|
|
|
|
|