Class

NumCosmoMathRNG

Description [src]

class NumCosmoMath.RNG : GObject.Object
{
  /* No available fields */
}

Encapsulated GNU Scientific Library (GSL) random number generator with support for multhreading.

This object encapsulates the GNU Scientific Library (GSL) pseudo random number generator (PRNG). Its main purpose is to add support for saving and loading state and multhreading. For more information about the GSL routines see both links: random number generation and random number distributions.

Ancestors

Constructors

ncm_rng_new

Creates a new NcmRNG using the algorithm algo. See the list of algorithms here. If algo is NULL the default algorithm and seed are used. See this link for more details.

ncm_rng_seeded_new

Creates a new NcmRNG using the algorithm algo. See the list of algorithms here. If algo is NULL the default algorithm is used. See this link for more details.

Functions

ncm_rng_clear

Decreases the reference count of rng by one and sets rng to NULL.

ncm_rng_pool_get

Gets the NcmRNG named name from the pool. If it doesn’t exists, it creates one, add it to the pool and returns it.

Instance methods

ncm_rng_beta_gen

This function returns a random number drawn from the beta distribution with shape parameters a and b. The shape parameters must be positive.

ncm_rng_bivariate_gaussian_gen

This function returns a random number drawn from the Bivariate Gaussian distribution, with standard deviations sigma_x and sigma_y and correlation coefficient rho. The correlation coefficient must be in the range $-1 \leq \rho \leq 1$.

ncm_rng_check_seed

Check if the seed was already used by any NcmRNG.

ncm_rng_chisq_gen

This function returns a random number drawn from the Chi-square Distribution, with $\nu$ degrees of freedom.

ncm_rng_choose

This function fills the array dest with k elements from the array src. The elements are chosen randomly using the algorithm (choose with replecement) in gsl_ran_choose().

ncm_rng_discrete_gen

This function returns a random number drawn from the discrete distribution. The weights must created using ncm_rng_discrete_new().

ncm_rng_exponential_gen

This function returns a random number drawn from the exponential distribution with scale parameter (mean) mu.

ncm_rng_exppow_gen

This function returns a random number drawn from the exponential power distribution with scale parameter a and exponent b.

ncm_rng_free

Decreases the reference count of rng by one.

ncm_rng_gamma_gen

This function returns a random number drawn from the gamma distribution with shape parameter a and scale parameter b.

ncm_rng_gaussian_gen

This function returns a random number drawn from the Gaussian distribution, with mean mu and standard deviation sigma.

ncm_rng_gaussian_tail_gen

This function returns a random number drawn from the upper tail of the Gaussian distribution with standard deviation sigma. The value returned is larger than the lower limit a, which must be positive.

ncm_rng_gen_ulong

This function returns a random unsigned integer from the uniform distribution.

ncm_rng_get_algo

Gets the name of the algorithm.

ncm_rng_get_seed

This functions returns the seed used to initialize the PRNG.

ncm_rng_get_state

Gets the state of the algorithm in Base64. It can be a very large string depending on the underlining state.

ncm_rng_laplace_gen

This function returns a random number drawn from the Laplace distribution with width a.

ncm_rng_lock

Locks rng.

ncm_rng_multinomial

This function fills the array n with K elements using a multinomial distribution defined by the array p.

ncm_rng_poisson_gen

This function returns a random number drawn from the Poisson distribution, with frequency mu.

ncm_rng_rayleigh_gen

This function returns a random number drawn from the Rayleigh distribution with scale parameter sigma.

ncm_rng_ref

Increases the reference count of rng by one.

ncm_rng_sample

This function fills the array dest with k elements from the array src. The elements are chosen randomly using the algorithm (sample with replecement) in gsl_ran_sample().

ncm_rng_set_algo

Sets the PRNG algorithm.

ncm_rng_set_random_seed

Sets the algorithm seed using a PRNG seeded by /dev/urandom (Unix/Linux) or current time, when the first is not available (see #g_rand_new). If allow_colisions is FALSE this function will set the first unused seed generated.

ncm_rng_set_seed

Sets the PRNG algorithm seed.

ncm_rng_set_state

Sets the PRNG algorithm state.

ncm_rng_ugaussian_gen

This function returns a random number drwan from the Gaussian distribution, with mean zero and standard deviation one. Equivalent as above but with mean = 0 and sigma = 1.

ncm_rng_uniform01_gen

This function returns a random number drawn from the uniform distribution between zero and one $[0,1)$.

ncm_rng_uniform01_pos_gen

This function returns a random number drawn from the uniform distribution between zero and one $(0,1)$.

ncm_rng_uniform_gen

This functions returns a random number drawn from the uniform distribution between the values xl and xu.

ncm_rng_uniform_int_gen

This function returns a random number drawn from the uniform distribution between zero and n.

ncm_rng_unlock

Unlocks rng.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

NumCosmoMath.RNG:algorithm

The name of the pseudo random number algorithm to be used from GNU Scientific Library (GSL). A list of the available algorithms can be find here.

NumCosmoMath.RNG:seed

Pseudo random number algorithm seed.

NumCosmoMath.RNG:state

Pseudo random number algorithm state.

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct NumCosmoMathRNGClass {
  /* no available fields */
}

No description available.