gstlearn  1.0.0
CCC
Law.hpp File Reference
#include "gstlearn_export.hpp"
#include "Basic/VectorNumT.hpp"

Functions

GSTLEARN_EXPORT void law_set_old_style (bool style)
 
GSTLEARN_EXPORT int law_get_random_seed (void)
 
GSTLEARN_EXPORT void law_set_random_seed (int seed)
 
GSTLEARN_EXPORT double law_uniform (double mini=0., double maxi=1.)
 
GSTLEARN_EXPORT int law_int_uniform (int mini, int maxi)
 
GSTLEARN_EXPORT double law_gaussian (double mean=0., double sigma=1.)
 
GSTLEARN_EXPORT double law_exponential (double lambda=1.)
 
GSTLEARN_EXPORT double law_gamma (double alpha, double beta=1.)
 
GSTLEARN_EXPORT int law_poisson (double parameter)
 
GSTLEARN_EXPORT double law_stable_standard_agd (double alpha, double beta)
 
GSTLEARN_EXPORT double law_stable_standard_a1gd (double beta)
 
GSTLEARN_EXPORT double law_stable_standard_abgd (double alpha)
 
GSTLEARN_EXPORT double law_stable_a (double alpha, double beta, double gamma, double delta)
 
GSTLEARN_EXPORT double law_stable_a1 (double beta, double gamma, double delta)
 
GSTLEARN_EXPORT double law_stable (double alpha, double beta, double gamma, double delta)
 
GSTLEARN_EXPORT int law_binomial (int n, double p)
 
GSTLEARN_EXPORT double law_beta1 (double parameter1, double parameter2)
 
GSTLEARN_EXPORT double law_beta2 (double parameter1, double parameter2)
 
GSTLEARN_EXPORT double law_df_gaussian (double value)
 
GSTLEARN_EXPORT double law_dnorm (double value, double mean, double std)
 
GSTLEARN_EXPORT double law_cdf_gaussian (double value)
 
GSTLEARN_EXPORT double law_invcdf_gaussian (double value)
 
GSTLEARN_EXPORT double law_gaussian_between_bounds (double binf, double bsup)
 
GSTLEARN_EXPORT double law_df_bigaussian (double *vect, double *mean, double *corr)
 
GSTLEARN_EXPORT double law_df_quadgaussian (double *vect, double *corr)
 
GSTLEARN_EXPORT double law_df_multigaussian (int nvar, double *vect, double *corr)
 
GSTLEARN_EXPORT VectorInt law_random_path (int nech)
 
GSTLEARN_EXPORT double * law_exp_sample (double *tabin, int mode, int nvar, int nechin, int nechout, int niter, int nconst, double *consts, int seed, double percent)
 

Function Documentation

◆ law_beta1()

GSTLEARN_EXPORT double law_beta1 ( double  parameter1,
double  parameter2 
)

Generate random numbers according to a beta distribution (first kind)

Returns
Beta random value (first kind)
Parameters
[in]parameter1first parameter of the beta distribution
[in]parameter2first parameter of the beta distribution

◆ law_beta2()

GSTLEARN_EXPORT double law_beta2 ( double  parameter1,
double  parameter2 
)

Generate random numbers according to a beta distribution (second kind)

Returns
Beta random value (second kind)
Parameters
[in]parameter1first parameter of the beta distribution
[in]parameter2first parameter of the beta distribution

◆ law_binomial()

GSTLEARN_EXPORT int law_binomial ( int  n,
double  p 
)

Generates a binomial value

Returns
The binomial value
Parameters
[in]nNumber of trials
[in]pEvent probability

◆ law_cdf_gaussian()

GSTLEARN_EXPORT double law_cdf_gaussian ( double  value)

Cumulated density function of a gaussian distribution

Returns
Gaussian cumulated density function
Parameters
[in]valueraw value
Remarks
Handbook P932 (26.2.17) precision <7.5 E-08

◆ law_df_bigaussian()

GSTLEARN_EXPORT double law_df_bigaussian ( double *  vect,
double *  mean,
double *  corr 
)

Density function of a bigaussian distribution

Returns
Gaussian density function
Parameters
[in]vectArray of values (Dimension = 2)
[in]meanArray of means (Dimension = 2)
[in]corrCorrelation matrix (Dimension: 2*2)

◆ law_df_gaussian()

GSTLEARN_EXPORT double law_df_gaussian ( double  value)

Density function of a gaussian distribution

Returns
Gaussian density function
Parameters
[in]valueraw value

◆ law_df_multigaussian()

GSTLEARN_EXPORT double law_df_multigaussian ( int  nvar,
double *  vect,
double *  corr 
)

Density function of a multigaussian distribution

Returns
Gaussian density function
Parameters
[in]nvarNumber of variables
[in]vectArray of values (Dimension = nvar)
[in]corrCorrelation matrix (Dimension: nvar*nvar)

◆ law_df_quadgaussian()

GSTLEARN_EXPORT double law_df_quadgaussian ( double *  vect,
double *  corr 
)

Density function of a quadrigaussian distribution

Returns
Gaussian density function
Parameters
[in]vectArray of values (Dimension = nvar)
[in]corrCorrelation matrix (Dimension: nvar*nvar)

◆ law_dnorm()

GSTLEARN_EXPORT double law_dnorm ( double  value,
double  mean,
double  std 
)

Density function of a (non-normalized) gaussian distribution

Returns
Gaussian density function
Parameters
[in]valueRaw value
[in]meanMean value
[in]stdStandard deviation

◆ law_exp_sample()

GSTLEARN_EXPORT double* law_exp_sample ( double *  tabin,
int  mode,
int  nvar,
int  nechin,
int  nechout,
int  niter,
int  nconst,
double *  consts,
int  seed,
double  percent 
)

Sample a multivariate empirical distribution

Returns
Address to the newly created array
Parameters
[in]tabinInput array
[in]modeDescribes the way 'tabin' and 'tabout' are filled 1: by column; 2: by row
[in]nvarNumber of variables (input and output)
[in]nechinNumber of samples in the input array
[in]nechoutNumber of created samples
[in]niterMaximum number of iterations
[in]nconstNumber of constraints
[in]constsArray of constraints (optional) (Dimension: nconst * (nvar+1)) This array is entered by line
[in]seedValue for the seed generator
[in]percentDimension of the convolution kernel expressed as a percentage of the dispersion st. dev. Should be between 0 and 100
Remarks
The input array must be isotopic (otherwise, an error is issued)
The resulting array if dimensionned to nvar * nechout
The created (and returned) array must be freed by the calling
function
Consider nvar1 = nvar + 1
Sample temp[1:nvar1] is authorized for Constraint 'iconst' if:
Sum_ivar1^{1:nvar1) consts[iconst,ivar1) * temp[ivar1] > 0

◆ law_exponential()

GSTLEARN_EXPORT double law_exponential ( double  lambda)

Generate random numbers according to exponential distribution

Returns
Exponential random value
Parameters
[in]lambdaParameter of exponential distribution

◆ law_gamma()

GSTLEARN_EXPORT double law_gamma ( double  alpha,
double  beta 
)

Generate random numbers according to a gamma distribution

Returns
Gamma random value
Parameters
[in]alphaparameter of the gamma distribution
[in]betaSecond parameter of the Gamma distribution

◆ law_gaussian()

GSTLEARN_EXPORT double law_gaussian ( double  mean,
double  sigma 
)

Generate random numbers according to a gaussian distribution

Returns
Gaussian random value
Parameters
[in]meanMean of the Normal Distribution
[in]sigmaStandard deviation of the Normal Distribution

◆ law_gaussian_between_bounds()

GSTLEARN_EXPORT double law_gaussian_between_bounds ( double  binf,
double  bsup 
)

Generates a gaussian value which lies in an interval

Returns
The gaussian value
Parameters
[in]binflower bound of the interval
[in]bsupupper bound of the interval

◆ law_get_random_seed()

GSTLEARN_EXPORT int law_get_random_seed ( void  )

read the seed for the random number generator

Returns
The current value of the seed (integer)

◆ law_int_uniform()

GSTLEARN_EXPORT int law_int_uniform ( int  mini,
int  maxi 
)

Draw an integer random number according to a uniform distribution

Returns
Integer Uniform random value within an interval
Parameters
[in]miniminimum value
[in]maximaximum value

◆ law_invcdf_gaussian()

GSTLEARN_EXPORT double law_invcdf_gaussian ( double  value)

Inverse cumulated density function of a gaussian distribution

Returns
Inverse of gaussian cumulated density function
Parameters
[in]valuecumulative density

◆ law_poisson()

GSTLEARN_EXPORT int law_poisson ( double  parameter)

Generate random number according to a poisson distribution

Returns
Poisson random value
Parameters
[in]parameterparameter of the Poisson distribution
Remarks
Method Ahrens-Dieter (1973)

◆ law_random_path()

GSTLEARN_EXPORT VectorInt law_random_path ( int  nech)

Define a random path

Parameters
[in]nech: Number of samples

◆ law_set_old_style()

GSTLEARN_EXPORT void law_set_old_style ( bool  style)

Set the type of Usage for Random Number Generation

Parameters
styletrue for using Old Style; false for using New Style

◆ law_set_random_seed()

GSTLEARN_EXPORT void law_set_random_seed ( int  seed)

Sets the seed for the random number generator

Parameters
[in]seedthe new value given to the seed

◆ law_stable()

GSTLEARN_EXPORT double law_stable ( double  alpha,
double  beta,
double  gamma,
double  delta 
)

Generate random numbers according to a stable distribution

Returns
Stable value with unit parameters
Parameters
[in]alphavalue of the alpha parameter
[in]betavalue of the beta parameter
[in]gammavalue of the gamma parameter
[in]deltavalue of the delta parameter

◆ law_stable_a()

GSTLEARN_EXPORT double law_stable_a ( double  alpha,
double  beta,
double  gamma,
double  delta 
)

Generate random numbers according to a stable distribution (alpha != 1)

Returns
Stable value with unit parameters
Parameters
[in]alphavalue of the alpha parameter
[in]betavalue of the beta parameter
[in]gammavalue of the gamma parameter
[in]deltavalue of the delta parameter

◆ law_stable_a1()

GSTLEARN_EXPORT double law_stable_a1 ( double  beta,
double  gamma,
double  delta 
)

Generate random numbers according to a stable distribution (alpha=1)

Returns
Stable value with unit parameters
Parameters
[in]betavalue of the beta parameter
[in]gammavalue of the gamma parameter
[in]deltavalue of the delta parameter

◆ law_stable_standard_a1gd()

GSTLEARN_EXPORT double law_stable_standard_a1gd ( double  beta)

Generate random numbers according to a standard stable distribution (alpha=1)

Returns
Stable value with standard parameters (alpha=gamma=1,delta=0)
Parameters
[in]betavalue of the beta parameter

◆ law_stable_standard_abgd()

GSTLEARN_EXPORT double law_stable_standard_abgd ( double  alpha)

Generate random numbers according to a standard stable distribution

Returns
Stable value with std. parameters (beta=gamma=1,delta=0,alpha!=1)
Parameters
[in]alphavalue of the alpha parameter

◆ law_stable_standard_agd()

GSTLEARN_EXPORT double law_stable_standard_agd ( double  alpha,
double  beta 
)

Generate random numbers according to a standard stable distribution

Returns
Stable value with standard parameters (gamma=1,delta=0,alpha!=1)
Parameters
[in]alphavalue of the alpha parameter
[in]betavalue of the beta parameter

◆ law_uniform()

GSTLEARN_EXPORT double law_uniform ( double  mini,
double  maxi 
)

Draw a random number according to a uniform distribution

Returns
Uniform random value within an interval
Parameters
[in]miniminimum value
[in]maximaximum value