clProbDist
An OpenCL library for probability distributions
Typedefs
normal.h File Reference

API of the normal distribution. More...

#include "clProbDist/clProbDist.h"
#include "clProbDist/continuous.h"

Go to the source code of this file.

Typedefs

typedef struct _clprobdistNormal clprobdistNormal
 Normal distribution object [device]. More...
 

Functions

Functions for standard normal distribution

These functions are for the normal distribution with \(\mu = 0\) and \(\sigma = 1\), and they take neither a distribution object nor a list of distribution parameters.

cl_double clprobdistStdNormalDensity (cl_double x, clprobdistStatus *err)
 Probability density function [device]. More...
 
cl_double clprobdistStdNormalCDF (cl_double x, clprobdistStatus *err)
 Cumulative density function [device]. More...
 
cl_double clprobdistStdNormalComplCDF (cl_double x, clprobdistStatus *err)
 Complementary CDF or reliability function [device]. More...
 
cl_double clprobdistStdNormalInverseCDF (cl_double u, clprobdistStatus *err)
 Inverse cumulative density function [device]. More...
 
Functions to create and destroy distribution objects
clprobdistNormalclprobdistNormalCreate (cl_double mu, cl_double sigma, size_t *bufSize, clprobdistStatus *err)
 Create a distribution object. More...
 
clprobdistStatus clprobdistNormalDestroy (clprobdistNormal *dist)
 Destroy a distribution object. More...
 
Functions for use with a distribution object
cl_double clprobdistNormalDensityWithObject (const clprobdistNormal *dist, cl_double x, clprobdistStatus *err)
 Probability density function [device]. More...
 
cl_double clprobdistNormalCDFWithObject (const clprobdistNormal *dist, cl_double x, clprobdistStatus *err)
 Cumulative density function [device]. More...
 
cl_double clprobdistNormalComplCDFWithObject (const clprobdistNormal *dist, cl_double x, clprobdistStatus *err)
 Complementary CDF or reliability function [device]. More...
 
cl_double clprobdistNormalInverseCDFWithObject (const clprobdistNormal *dist, cl_double u, clprobdistStatus *err)
 Inverse cumulative density function [device]. More...
 
cl_double clprobdistNormalMeanWithObject (const clprobdistNormal *dist, clprobdistStatus *err)
 Mean of the distribution [device]. More...
 
cl_double clprobdistNormalVarianceWithObject (const clprobdistNormal *dist, clprobdistStatus *err)
 Variance of the distribution [device]. More...
 
cl_double clprobdistNormalStdDeviationWithObject (const clprobdistNormal *dist, clprobdistStatus *err)
 Standard deviation of the distribution [device]. More...
 
cl_double clprobdistNormalGetMu (const clprobdistNormal *dist, clprobdistStatus *err)
 Return the mean. More...
 
cl_double clprobdistNormalGetSigma (const clprobdistNormal *dist, clprobdistStatus *err)
 Return the standard deviation. More...
 
Functions for use with explicit distribution parameters
cl_double clprobdistNormalDensity (cl_double mu, cl_double sigma, cl_double x, clprobdistStatus *err)
 Probability density function [device]. More...
 
cl_double clprobdistNormalCDF (cl_double mu, cl_double sigma, cl_double x, clprobdistStatus *err)
 Cumulative density function [device]. More...
 
cl_double clprobdistNormalComplCDF (cl_double mu, cl_double sigma, cl_double x, clprobdistStatus *err)
 Complementary CDF or reliability function [device]. More...
 
cl_double clprobdistNormalInverseCDF (cl_double mu, cl_double sigma, cl_double u, clprobdistStatus *err)
 Inverse cumulative density function [device]. More...
 
cl_double clprobdistNormalMean (cl_double mu, cl_double sigma, clprobdistStatus *err)
 Mean of the distribution [device]. More...
 
cl_double clprobdistNormalVariance (cl_double mu, cl_double sigma, clprobdistStatus *err)
 Variance of the distribution [device]. More...
 
cl_double clprobdistNormalStdDeviation (cl_double mu, cl_double sigma, clprobdistStatus *err)
 Standard deviation of the distribution [device]. More...
 

Detailed Description

API of the normal distribution.

Implementation of clProbDist_template.h for the normal distribution, adapted from [5] .

Typedef Documentation

typedef struct _clprobdistNormal clprobdistNormal

Normal distribution object [device].

A structure that represents a normal distribution object.

Function Documentation

cl_double clprobdistStdNormalDensity ( cl_double  x,
clprobdistStatus err 
)

Probability density function [device].

Same as clprobdistDensityWithObject(), but with explicit distribution parameters instead of distribution object.

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

See Implemented distributions for the expansion of DIST_PARAMS.

Parameters
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(f(x)\).
cl_double clprobdistStdNormalCDF ( cl_double  x,
clprobdistStatus err 
)

Cumulative density function [device].

Same as clprobdistCDFWithObject(), but with explicit distribution parameters instead of distribution object.

See Implemented distributions for the expansion of DIST_PARAMS.

Parameters
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(F(x)\).
cl_double clprobdistStdNormalComplCDF ( cl_double  x,
clprobdistStatus err 
)

Complementary CDF or reliability function [device].

Same as clprobdistComplCDFWithObject(), but with explicit distribution parameters instead of distribution object.

See Implemented distributions for the expansion of DIST_PARAMS.

Parameters
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(\bar F(x)\).
cl_double clprobdistStdNormalInverseCDF ( cl_double  u,
clprobdistStatus err 
)

Inverse cumulative density function [device].

Same as clprobdistInverseCDFWithObject(), but with explicit distribution parameters instead of distribution object.

See Implemented distributions for the expansion of DIST_PARAMS.

Parameters
[in]uValue of \(u \in [0,1]\).
[out]errError status variable, or NULL.
Returns
Value of \(F^{-1}(u)\).
clprobdistNormal* clprobdistNormalCreate ( cl_double  mu,
cl_double  sigma,
size_t *  bufSize,
clprobdistStatus err 
)

Create a distribution object.

Create a new normal distribution object. Since this function allocates memory for the new distribution object; clprobdistDestroy() must be called to release the allocated memory.

Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[out]bufSizeSize in bytes of the created distribution object, or NULL.
[out]errError status variable, or NULL.
Returns
New distribution object.
clprobdistStatus clprobdistNormalDestroy ( clprobdistNormal dist)

Destroy a distribution object.

Release the resources associated to a distribution object.

Parameters
[in,out]distDistribution object.
Returns
Error status.
cl_double clprobdistNormalDensityWithObject ( const clprobdistNormal dist,
cl_double  x,
clprobdistStatus err 
)

Probability density function [device].

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

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

Parameters
[in]distDistribution object.
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(f(x)\).
cl_double clprobdistNormalCDFWithObject ( const clprobdistNormal dist,
cl_double  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)\).
cl_double clprobdistNormalComplCDFWithObject ( const clprobdistNormal dist,
cl_double  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)\).
cl_double clprobdistNormalInverseCDFWithObject ( const clprobdistNormal dist,
cl_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)\).
cl_double clprobdistNormalMeanWithObject ( const clprobdistNormal 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.
cl_double clprobdistNormalVarianceWithObject ( const clprobdistNormal 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.
cl_double clprobdistNormalStdDeviationWithObject ( const clprobdistNormal 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.
cl_double clprobdistNormalGetMu ( const clprobdistNormal dist,
clprobdistStatus err 
)

Return the mean.

Parameters
[in]distDistribution object.
[out]errError status variable, or NULL.
Returns
Mean \(\mu\).
cl_double clprobdistNormalGetSigma ( const clprobdistNormal dist,
clprobdistStatus err 
)

Return the standard deviation.

Parameters
[in]distDistribution object.
[out]errError status variable, or NULL.
Returns
Standard deviation \(\sigma\).
cl_double clprobdistNormalDensity ( cl_double  mu,
cl_double  sigma,
cl_double  x,
clprobdistStatus err 
)

Probability density function [device].

See also
clprobdistNormalDensityWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(f(x)\).
cl_double clprobdistNormalCDF ( cl_double  mu,
cl_double  sigma,
cl_double  x,
clprobdistStatus err 
)

Cumulative density function [device].

See also
clprobdistNormalCDFWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(F(x)\).
cl_double clprobdistNormalComplCDF ( cl_double  mu,
cl_double  sigma,
cl_double  x,
clprobdistStatus err 
)

Complementary CDF or reliability function [device].

See also
clprobdistNormalComplCDFWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[in]xValue of \(x\).
[out]errError status variable, or NULL.
Returns
Value of \(\bar F(x)\).
cl_double clprobdistNormalInverseCDF ( cl_double  mu,
cl_double  sigma,
cl_double  u,
clprobdistStatus err 
)

Inverse cumulative density function [device].

See also
clprobdistNormalInverseCDFWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[in]uValue of \(u \in [0,1]\).
[out]errError status variable, or NULL.
Returns
Value of \(F^{-1}(u)\).
cl_double clprobdistNormalMean ( cl_double  mu,
cl_double  sigma,
clprobdistStatus err 
)

Mean of the distribution [device].

See also
clprobdistNormalMeanWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[out]errError status variable, or NULL.
Returns
Mean of the distribution.
cl_double clprobdistNormalVariance ( cl_double  mu,
cl_double  sigma,
clprobdistStatus err 
)

Variance of the distribution [device].

See also
clprobdistNormalVarianceWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[out]errError status variable, or NULL.
Returns
Variance of the distribution.
cl_double clprobdistNormalStdDeviation ( cl_double  mu,
cl_double  sigma,
clprobdistStatus err 
)

Standard deviation of the distribution [device].

See also
clprobdistNormalStdDeviationWithObject()
Parameters
[in]muValue of the mean \(\mu\).
[in]sigmaValue of the standard deviation \(\sigma\).
[out]errError status variable, or NULL.
Returns
Standard deviation of the distribution.