UQTk: Uncertainty Quantification Toolkit 3.1.5
probability.h File Reference

Header for probability and random number generation- related tools. More...

#include "Array1D.h"
#include "Array2D.h"
#include "dsfmt_add.h"
#include "KCenterClustering.h"
#include "figtree_internal.h"

Go to the source code of this file.

Macros

#define DSFMT_DO_NOT_USE_OLD_NAMES
 

Functions

double erff (const double x)
 An implementation of error function using incomplete gamma function.
 
double inverf (double y0)
 Inverse error function, input scaled to [-1,1].
 
double invnormcdf (double y)
 Inverse of the CDF of the normal random variable, uses inverf.
 
double normcdf (double y)
 Normal random variable CDF.
 
double normcdfc (double y)
 Complementary function for normcdf.
 
void generate_uniform (double *rvar, int ns, int nd, int zSeed)
 Generates a vector of i.i.d. uniform(0,1) random variable samples of size ns*nd, given integer seed.
 
void generate_uniform (Array2D< double > &rvar, int zSeed)
 Generates a matrix of i.i.d. uniform(0,1) random variable samples, given integer seed.
 
void generate_uniform (double *rvar, int ns, int nd, dsfmt_t *rnstate)
 Generates a vector of i.i.d. uniform(0,1) random variable samples of size ns*nd, given pointer to the state of current random number generator.
 
void generate_uniform (Array2D< double > &rvar, dsfmt_t *rnstate)
 Generates a matrix of i.i.d. uniform(0,1) random variable samples, given pointer to the state of current random number generator.
 
void generate_uniform_lhs (double *rvar, int ns, int nd, int zSeed)
 Generates a vector of i.i.d. uniform(0,1) random variable LHS samples of size ns*nd, given integer seed.
 
void generate_uniform_lhs (Array2D< double > &rvar, int zSeed)
 Generates a matrix of i.i.d. uniform(0,1) random variable LHS samples, given integer seed.
 
void generate_uniform_lhs (double *rvar, int ns, int nd, dsfmt_t *rnstate)
 Generates a vector of i.i.d. uniform(0,1) random variable LHS samples of size ns*nd, given pointer to the state of current random number generator.
 
void generate_uniform_lhs (Array2D< double > &rvar, dsfmt_t *rnstate)
 Generates a matrix of i.i.d. uniform(0,1) random variable LHS samples, given pointer to the state of current random number generator.
 
void generate_normal (Array2D< double > &rvar, int zSeed)
 Generates a matrix of i.i.d. normal(0,1) random variable samples.
 
void generate_normal_lhs (Array2D< double > &rvar, int zSeed)
 Generates a matrix of i.i.d. normal(0,1) random variable LHS samples.
 
double get_median (const Array1D< double > &data)
 Returns the median of a data array.
 
double get_mean (const Array1D< double > &data)
 Returns the mean of a 1D data array.
 
double get_mean (const Array2D< double > &data)
 Returns the mean of a 2D data array.
 
double get_std (const Array1D< double > &data)
 Returns the std of a data array.
 
double get_var (const Array1D< double > &data)
 Returns the std of a data array.
 
double getMean_Variance (Array2D< double > &data_c, Array1D< double > &w, Array1D< double > &mean)
 Vector-mean and weighted variance.
 
void getMean (Array2D< double > &data_c, Array1D< double > &mean)
 Vector mean, column by column.
 
void getMean (Array2D< double > &data_c, Array1D< double > &mean, char *RC)
 Vector mean, either column by column for RC="C" or row by row for RC="R".
 
void rperm (int n, int *a, dsfmt_t *rnstate)
 Random permutation of 0..n-1.
 
void getPdf_figtree (Array2D< double > &source, Array2D< double > &target, Array1D< double > &sig, Array1D< double > &density, Array1D< double > &weight)
 KDE estimation of a PDF.
 
void getPdf_cl (Array2D< double > &data, Array2D< double > &points, Array1D< double > &dens, int ncl, double sfac)
 Compute the PDF of data at the given points using given number of clusters (if ncl=0, then find the optimal cluster number) and a scale factor for the optimal bandwidth.
 
double covariance (Array1D< double > &x1, Array1D< double > &x2, Array1D< double > &param, string covtype)
 Compute a few standard covariance functions C(x_1,x_2)
 
void ihsU (Array2D< double > &rndnos, int dfac, dsfmt_t *rnstate)
 
void ihsU (int ns, int np, double *rndnos, int dfac, dsfmt_t *rnstate)
 
void ihsP (int ns, int np, int *rpos, int dfac, dsfmt_t *rnstate)
 
void distCorr (const Array2D< double > &spl, Array2D< double > &dCor)
 Compute distance correlation factors given a set of samples (no. of rows in spl) from a collection of random variables (no. of columns in spl). dCor(i,j), with i>j stores the distance correlation values between random variables i and j.
 

Detailed Description

Header for probability and random number generation- related tools.

Todo
There shuold be a RNG class as a part of core UQTk - most of these functions will fit there.

Macro Definition Documentation

◆ DSFMT_DO_NOT_USE_OLD_NAMES

#define DSFMT_DO_NOT_USE_OLD_NAMES

Function Documentation

◆ covariance()

double covariance ( Array1D< double > & x1,
Array1D< double > & x2,
Array1D< double > & param,
string covtype )

Compute a few standard covariance functions C(x_1,x_2)

◆ distCorr()

void distCorr ( const Array2D< double > & spl,
Array2D< double > & dCor )

Compute distance correlation factors given a set of samples (no. of rows in spl) from a collection of random variables (no. of columns in spl). dCor(i,j), with i>j stores the distance correlation values between random variables i and j.

◆ erff()

double erff ( const double x)

An implementation of error function using incomplete gamma function.

◆ generate_normal()

void generate_normal ( Array2D< double > & rvar,
int zSeed )

Generates a matrix of i.i.d. normal(0,1) random variable samples.

◆ generate_normal_lhs()

void generate_normal_lhs ( Array2D< double > & rvar,
int zSeed )

Generates a matrix of i.i.d. normal(0,1) random variable LHS samples.

Todo
LHS generation is far from optimal, it is quite slow

◆ generate_uniform() [1/4]

void generate_uniform ( Array2D< double > & rvar,
dsfmt_t * rnstate )

Generates a matrix of i.i.d. uniform(0,1) random variable samples, given pointer to the state of current random number generator.

◆ generate_uniform() [2/4]

void generate_uniform ( Array2D< double > & rvar,
int zSeed )

Generates a matrix of i.i.d. uniform(0,1) random variable samples, given integer seed.

◆ generate_uniform() [3/4]

void generate_uniform ( double * rvar,
int ns,
int nd,
dsfmt_t * rnstate )

Generates a vector of i.i.d. uniform(0,1) random variable samples of size ns*nd, given pointer to the state of current random number generator.

◆ generate_uniform() [4/4]

void generate_uniform ( double * rvar,
int ns,
int nd,
int zSeed )

Generates a vector of i.i.d. uniform(0,1) random variable samples of size ns*nd, given integer seed.

◆ generate_uniform_lhs() [1/4]

void generate_uniform_lhs ( Array2D< double > & rvar,
dsfmt_t * rnstate )

Generates a matrix of i.i.d. uniform(0,1) random variable LHS samples, given pointer to the state of current random number generator.

◆ generate_uniform_lhs() [2/4]

void generate_uniform_lhs ( Array2D< double > & rvar,
int zSeed )

Generates a matrix of i.i.d. uniform(0,1) random variable LHS samples, given integer seed.

◆ generate_uniform_lhs() [3/4]

void generate_uniform_lhs ( double * rvar,
int ns,
int nd,
dsfmt_t * rnstate )

Generates a vector of i.i.d. uniform(0,1) random variable LHS samples of size ns*nd, given pointer to the state of current random number generator.

◆ generate_uniform_lhs() [4/4]

void generate_uniform_lhs ( double * rvar,
int ns,
int nd,
int zSeed )

Generates a vector of i.i.d. uniform(0,1) random variable LHS samples of size ns*nd, given integer seed.

◆ get_mean() [1/2]

double get_mean ( const Array1D< double > & data)

Returns the mean of a 1D data array.

◆ get_mean() [2/2]

double get_mean ( const Array2D< double > & data)

Returns the mean of a 2D data array.

◆ get_median()

double get_median ( const Array1D< double > & data)

Returns the median of a data array.

◆ get_std()

double get_std ( const Array1D< double > & data)

Returns the std of a data array.

◆ get_var()

double get_var ( const Array1D< double > & data)

Returns the std of a data array.

◆ getMean() [1/2]

void getMean ( Array2D< double > & data_c,
Array1D< double > & mean )

Vector mean, column by column.

◆ getMean() [2/2]

void getMean ( Array2D< double > & data_c,
Array1D< double > & mean,
char * RC )

Vector mean, either column by column for RC="C" or row by row for RC="R".

◆ getMean_Variance()

double getMean_Variance ( Array2D< double > & data_c,
Array1D< double > & w,
Array1D< double > & mean )

Vector-mean and weighted variance.

◆ getPdf_cl()

void getPdf_cl ( Array2D< double > & data,
Array2D< double > & points,
Array1D< double > & dens,
int ncl,
double sfac )

Compute the PDF of data at the given points using given number of clusters (if ncl=0, then find the optimal cluster number) and a scale factor for the optimal bandwidth.

◆ getPdf_figtree()

void getPdf_figtree ( Array2D< double > & source,
Array2D< double > & target,
Array1D< double > & sig,
Array1D< double > & density,
Array1D< double > & weight )

KDE estimation of a PDF.

◆ ihsP()

void ihsP ( int ns,
int np,
int * rpos,
int dfac,
dsfmt_t * rnstate )

◆ ihsU() [1/2]

void ihsU ( Array2D< double > & rndnos,
int dfac,
dsfmt_t * rnstate )

◆ ihsU() [2/2]

void ihsU ( int ns,
int np,
double * rndnos,
int dfac,
dsfmt_t * rnstate )

◆ inverf()

double inverf ( double y0)

Inverse error function, input scaled to [-1,1].

Note
Cephes Math Library Release 2.8: June, 2000. Copyright 1984, 1987, 1988, 1992, 2000 by Stephen L. Moshier

◆ invnormcdf()

double invnormcdf ( double y)

Inverse of the CDF of the normal random variable, uses inverf.

◆ normcdf()

double normcdf ( double y)

Normal random variable CDF.

◆ normcdfc()

double normcdfc ( double y)

Complementary function for normcdf.

◆ rperm()

void rperm ( int n,
int * a,
dsfmt_t * rnstate )

Random permutation of 0..n-1.