Allocates and initializes constants for the normal distribution with specified parameters

Syntax

svrng_distribution_t svrng_new_normal_distribution_float( float mean, float stddev )

svrng_distribution_t svrng_new_normal_distribution_double( double mean, double stddev )

svrng_distribution_t svrng_update_normal_distribution_float( svrng_distribution_t distr, float mean, float stddev )

svrng_distribution_t svrng_update_normal_distribution_double( svrng_distribution_t distr, double mean, double stddev )

Input Parameters

mean

Mean value of the normal distribution.

stddev

Standard deviation of the normal distribution

distr

Pointer to the distribution to be updated

Description

The svrng_new_normal_distribution_[float|double] functions allocate memory for a normal distribution of either 32- or 64-bit floating pont numbers with the specified mean and positive, real stddev using the ICDF method. The function pre-computes and broadcasts loop-invariant constants required for vector generation. The svrng_update_normal_distribution_[float|double] functions give the same result, but by modifying existing distributions instead of allocating memory for new distributions.

Status flags set

Name

Description

SVRNG_STATUS_ERROR_MEMORY_ALLOC

Memory allocation failure

SVRNG_STATUS_ERROR_BAD_PARAM2

Bad parameter: stddev

SVRNG_STATUS_ERROR_BAD_DISTR

Bad distribution (NULL pointer)

Return Values

A pointer to the distribution created or updated by the function, or NULL on error.

有关编译器优化的更完整信息,请参阅优化通知