CiFEr
Data Structures | Typedefs | Functions
normal_negative.h File Reference

Normal negative sampler. More...

Go to the source code of this file.

Data Structures

struct  cfe_normal_negative
 

Typedefs

typedef struct cfe_normal_negative cfe_normal_negative
 

Functions

void cfe_normal_negative_init (cfe_normal_negative *s, mpf_t sigma, size_t n)
 
void cfe_normal_negative_free (cfe_normal_negative *s)
 
void cfe_normal_negative_sample (mpz_t res, cfe_normal_negative *s)
 
void cfe_normal_negative_sample_vec (cfe_vec *res, cfe_normal_negative *s)
 
void cfe_normal_negative_sample_mat (cfe_mat *res, cfe_normal_negative *s)
 

Detailed Description

Normal negative sampler.

Typedef Documentation

◆ cfe_normal_negative

Samples random values from the possible outputs of normal (Gaussian) probability distribution centered on 0 and accepts or denies each sample with probability defined by the distribution.

Function Documentation

◆ cfe_normal_negative_init()

void cfe_normal_negative_init ( cfe_normal_negative s,
mpf_t  sigma,
size_t  n 
)

Initializes an instance of cfe_normal_negative sampler. It assumes mean = 0.

Parameters
sA pointer to an uninitialized struct representing the sampler
sigmaStandard deviation
nPrecision parameter

◆ cfe_normal_negative_free()

void cfe_normal_negative_free ( cfe_normal_negative s)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
sA pointer to an instance of the sampler (initialized cfe_normal_negative struct)

◆ cfe_normal_negative_sample()

void cfe_normal_negative_sample ( mpz_t  res,
cfe_normal_negative s 
)

Samples the discrete distribution.

Parameters
resThe random number (result value will be stored here)
sA pointer to an instance of the sampler (initialized cfe_normal_negative struct)

◆ cfe_normal_negative_sample_vec()

void cfe_normal_negative_sample_vec ( cfe_vec res,
cfe_normal_negative s 
)

Sets the elements of the vector to random numbers with the normal_negative sampler.

◆ cfe_normal_negative_sample_mat()

void cfe_normal_negative_sample_mat ( cfe_mat res,
cfe_normal_negative s 
)

Sets the elements of a matrix to random numbers with the normal_negative sampler.