clProbDist
An OpenCL library for probability distributions
Typedefs | Functions
poisson.clh File Reference

Device-side API for the Poisson distribution. More...

#include "clProbDist.clh"
#include "gamma.clh"
#include "private/poisson.c.h"

Typedefs

typedef struct _clprobdistPoisson clprobdistPoisson
 Poisson distribution object [device]. More...
 

Functions

clprobdistStatus clprobdistPoissonCopyOverFromGlobal (_CLPROBDIST_POISSON_OBJ_MEM clprobdistPoisson *destDist, __global clprobdistPoisson *srcDist)
 Copy a distribution object into already allocated memory [device-only]. More...
 
Functions for use with a distribution object
double clprobdistPoissonProbWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, int x, clprobdistStatus *err)
 Probability mass function [device]. More...
 
double clprobdistPoissonCDFWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, int x, clprobdistStatus *err)
 Cumulative density function [device]. More...
 
double clprobdistPoissonComplCDFWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, int x, clprobdistStatus *err)
 Complementary CDF or reliability function [device]. More...
 
int clprobdistPoissonInverseCDFWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, double u, clprobdistStatus *err)
 Inverse cumulative density function [device]. More...
 
double clprobdistPoissonMeanWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, clprobdistStatus *err)
 Mean of the distribution [device]. More...
 
double clprobdistPoissonVarianceWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, clprobdistStatus *err)
 Variance of the distribution [device]. More...
 
double clprobdistPoissonStdDeviationWithObject (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, clprobdistStatus *err)
 Standard deviation of the distribution [device]. More...
 
double clprobdistPoissonGetLambda (_CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson *dist, clprobdistStatus *err)
 Return the value of the mean \(\lambda\) [device].
 
Functions for use with explicit distribution parameters
double clprobdistPoissonProb (double lambda, int x, clprobdistStatus *err)
 Probability mass function [device]. More...
 
double clprobdistPoissonCDF (double lambda, int x, clprobdistStatus *err)
 Cumulative density function [device]. More...
 
double clprobdistPoissonComplCDF (double lambda, int x, clprobdistStatus *err)
 Complementary CDF or reliability function [device]. More...
 
int clprobdistPoissonInverseCDF (double lambda, double u, clprobdistStatus *err)
 Inverse cumulative density function [device]. More...
 
double clprobdistPoissonMean (double lambda, clprobdistStatus *err)
 Mean of the distribution [device]. More...
 
double clprobdistPoissonVariance (double lambda, clprobdistStatus *err)
 Variance of the distribution [device]. More...
 
double clprobdistPoissonStdDeviation (double lambda, clprobdistStatus *err)
 Standard deviation of the distribution [device]. More...
 

Detailed Description

Device-side API for the Poisson distribution.

In the function declarations of this file, the preprocessor symbol _CLPROBDIST_POISSON_OBJ_MEM expands to the selected memory type for this distribution type.

Typedef Documentation

typedef struct _clprobdistPoisson clprobdistPoisson

Poisson distribution object [device].

A structure that represents a Poisson distribution object.

Function Documentation

double clprobdistPoissonProbWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
int  x,
clprobdistStatus err 
)

Probability mass function [device].

Return \(p(x)\), the probability of \(x\) associated with the distribution object dist.

This function is defined only for discrete distributions (see Implemented distributions).

Parameters
[in]distDistribution object.
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(p(x)\).
double clprobdistPoissonCDFWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
int  x,
clprobdistStatus err 
)

Cumulative density function [device].

Return \(F(x)\), the value at \(x=\)x of the distribution function associated with the distribution object dist.

Parameters
[in]distDistribution object.
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(F(x)\).
double clprobdistPoissonComplCDFWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
int  x,
clprobdistStatus err 
)

Complementary CDF or reliability function [device].

Return \(\bar F(x)\), the value of the complementary distribution function associated with the distribution object dist.

Parameters
[in]distDistribution object.
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(\bar F(x)\).
Warning
The complementary distribution function is defined as \(\bar F(j) = \mathbb P[X \geq j]\).
int clprobdistPoissonInverseCDFWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
double  u,
clprobdistStatus err 
)

Inverse cumulative density function [device].

Return \(F^{-1}(u)\), the value at \(u=\)u of the inverse distribution function associated with the distribution object dist. The type of the return value is cl_int for a discrete distribution of cl_double for a continuous distribution.

Parameters
[in]distDistribution object.
[in]uValue of \(u \in [0,1]\).
[out]errError status variable, or NULL.
Returns
Value of \(F^{-1}(u)\).
Examples:
DocsTutorial/example3.c, and DocsTutorial/example4_kernel.cl.
double clprobdistPoissonMeanWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
clprobdistStatus err 
)

Mean of the distribution [device].

Return the mean of the distribution associated with the distribution object dist.

Parameters
[in]distDistribution object.
[out]errError status variable, or NULL.
Returns
Mean of the distribution.
Examples:
DocsTutorial/example3.c, and DocsTutorial/example4_kernel.cl.
double clprobdistPoissonVarianceWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
clprobdistStatus err 
)

Variance of the distribution [device].

Return the variance of the distribution associated with the distribution object dist.

Parameters
[in]distDistribution object.
[out]errError status variable, or NULL.
Returns
Variance of the distribution.
double clprobdistPoissonStdDeviationWithObject ( _CLPROBDIST_POISSON_OBJ_MEM const clprobdistPoisson dist,
clprobdistStatus err 
)

Standard deviation of the distribution [device].

Return the standard deviation of the distribution associated with the distribution object dist.

Parameters
[in]distDistribution object.
[out]errError status variable, or NULL.
Returns
Standard deviation of the distribution.
double clprobdistPoissonProb ( double  lambda,
int  x,
clprobdistStatus err 
)

Probability mass function [device].

See also
clprobdistPoissonProbWithObject()
Parameters
[in]lambdaValue of the mean \(\lambda\).
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(f(x)\).
double clprobdistPoissonCDF ( double  lambda,
int  x,
clprobdistStatus err 
)

Cumulative density function [device].

See also
clprobdistPoissonCDFWithObject()
Parameters
[in]lambdaValue of the mean \(\lambda\).
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(F(x)\).
double clprobdistPoissonComplCDF ( double  lambda,
int  x,
clprobdistStatus err 
)

Complementary CDF or reliability function [device].

See also
clprobdistPoissonComplCDFWithObject()
Warning
The complementary distribution function is defined as \(\bar F(j) = \mathbb P[X \geq j]\).
Parameters
[in]lambdaValue of the mean \(\lambda\).
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(\bar F(x)\).
int clprobdistPoissonInverseCDF ( double  lambda,
double  u,
clprobdistStatus err 
)

Inverse cumulative density function [device].

See also
clprobdistPoissonInverseCDFWithObject()
Parameters
[in]lambdaValue of the mean \(\lambda\).
[in]uValue of \(u \in [0,1]\).
[out]errError status variable, or NULL.
Returns
Value of \(F^{-1}(u)\).
Examples:
DocsTutorial/example2.c.
double clprobdistPoissonMean ( double  lambda,
clprobdistStatus err 
)

Mean of the distribution [device].

See also
clprobdistPoissonMeanWithObject()
Parameters
[in]lambdaValue of the mean \(\lambda\).
[out]errError status variable, or NULL.
Returns
Mean of the distribution.
Examples:
DocsTutorial/example2.c.
double clprobdistPoissonVariance ( double  lambda,
clprobdistStatus err 
)

Variance of the distribution [device].

See also
clprobdistPoissonVarianceWithObject()
Parameters
[in]lambdaValue of the mean \(\lambda\).
[out]errError status variable, or NULL.
Returns
Variance of the distribution.
double clprobdistPoissonStdDeviation ( double  lambda,
clprobdistStatus err 
)

Standard deviation of the distribution [device].

See also
clprobdistPoissonStdDeviationWithObject()
Parameters
[in]lambdaValue of the mean \(\lambda\).
[out]errError status variable, or NULL.
Returns
Standard deviation of the distribution.
clprobdistStatus clprobdistPoissonCopyOverFromGlobal ( _CLPROBDIST_POISSON_OBJ_MEM clprobdistPoisson destDist,
__global clprobdistPoisson srcDist 
)

Copy a distribution object into already allocated memory [device-only].

Copy the distribution object srcDist located in global memory into the buffer destDist located in local or private memory. This function does not allocate memory for the distribution object, it assumes that this has already been done.

When the distribution API is configured to use distribution objects stored in global memory (the default), there is no need to copy distribution objects across memory types, since the kernel already receives them in global memory (see Device memory types). The same applies to constant memory. In such cases, this function is not defined.

Parameters
[out]destDistDestination buffer into which to copy (its content will be overwritten). The qualifier _CLPROBDIST_<DIST>_OBJ_MEM, where <DIST> is the uppercase distribution name, is replaced with the OpenCL keywords __private or __local, respectively.
[in]srcDistDistribution object to be copied.
Returns
Error status
Warning
This function is available only on the device.
This function is available only on the device, and only when CLPROBDIST_POISSON_OBJ_MEM is set to CLPROBDIST_MEM_TYPE_LOCAL.