UQTk: Uncertainty Quantification Toolkit 3.1.5
probability.h
Go to the documentation of this file.
1/* =====================================================================================
2
3 The UQ Toolkit (UQTk) version 3.1.5
4 Copyright (2024) NTESS
5 https://www.sandia.gov/UQToolkit/
6 https://github.com/sandialabs/UQTk
7
8 Copyright 2024 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
9 Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
10 retains certain rights in this software.
11
12 This file is part of The UQ Toolkit (UQTk)
13
14 UQTk is open source software: you can redistribute it and/or modify
15 it under the terms of BSD 3-Clause License
16
17 UQTk is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 BSD 3 Clause License for more details.
21
22 You should have received a copy of the BSD 3 Clause License
23 along with UQTk. If not, see https://choosealicense.com/licenses/bsd-3-clause/.
24
25 Questions? Contact the UQTk Developers at https://github.com/sandialabs/UQTk/discussions
26 Sandia National Laboratories, Livermore, CA, USA
27===================================================================================== */
33#ifndef PROBABILITY_H
34#define PROBABILITY_H
35
36#include "Array1D.h"
37#include "Array2D.h"
38
39#define DSFMT_DO_NOT_USE_OLD_NAMES
40#include "dsfmt_add.h"
41
42#include "KCenterClustering.h"
43#include "figtree_internal.h"
44
45
47double erff(const double x);
48
52// The website (http://www.boutell.com/lsm/lsmbyid.cgi/000626) states copying policy=freely distributable as of July 2012
53// \note modified by Sandia UQTk group to scale the input to [-1,1]
54double inverf(double y0);
55
57double invnormcdf(double y);
58
60double normcdf(double y);
61
63double normcdfc(double y);
64
66void generate_uniform(double* rvar,int ns, int nd, int zSeed);
67
69void generate_uniform(Array2D<double>& rvar,int zSeed);
70
72void generate_uniform(double *rvar, int ns, int nd, dsfmt_t *rnstate);
73
75void generate_uniform(Array2D<double> &rvar, dsfmt_t *rnstate);
76
78void generate_uniform_lhs(double* rvar,int ns, int nd, int zSeed);
79
81void generate_uniform_lhs(Array2D<double>& rvar,int zSeed);
82
84void generate_uniform_lhs(double *rvar, int ns, int nd, dsfmt_t *rnstate);
85
87void generate_uniform_lhs(Array2D<double> &rvar, dsfmt_t *rnstate);
88
90void generate_normal(Array2D<double>& rvar,int zSeed);
91
94void generate_normal_lhs(Array2D<double>& rvar,int zSeed);
95
97double get_median(const Array1D<double>& data);
98
100double get_mean(const Array1D<double>& data);
101
103double get_mean(const Array2D<double>& data);
104
106double get_std(const Array1D<double>& data);
107
109double get_var(const Array1D<double>& data);
110
113
115void getMean(Array2D<double>& data_c, Array1D<double>& mean);
116
119void getMean(Array2D<double>& data_c, Array1D<double>& mean, char *RC);
120
122void rperm(int n, int *a, dsfmt_t *rnstate);
123
126
130void getPdf_cl(Array2D<double>& data, Array2D<double>& points, Array1D<double>& dens,int ncl, double sfac);
131
133double covariance(Array1D<double>& x1, Array1D<double>& x2,Array1D<double>& param, string covtype);
134
135
136void ihsU(Array2D<double> &rndnos, int dfac, dsfmt_t *rnstate) ;
137
138void ihsU(int ns, int np, double *rndnos, int dfac, dsfmt_t *rnstate) ;
139
140void ihsP(int ns, int np, int *rpos, int dfac, dsfmt_t *rnstate);
141
146void distCorr(const Array2D<double> &spl, Array2D<double> &dCor) ;
147
148//---------------------------------------------------------------------------------------
149#endif // PROBABILITY_H
1D Array class for any type T
2D Array class for any type T
Stores data of any type T in a 1D array.
Definition Array1D.h:61
Stores data of any type T in a 2D array.
Definition Array2D.h:60
static double x1[]
Definition gkpclib.cpp:36
double normcdfc(double y)
Complementary function for normcdf.
Definition probability.cpp:194
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,...
Definition probability.cpp:249
double getMean_Variance(Array2D< double > &data_c, Array1D< double > &w, Array1D< double > &mean)
Vector-mean and weighted variance.
Definition probability.cpp:437
void getMean(Array2D< double > &data_c, Array1D< double > &mean)
Vector mean, column by column.
Definition probability.cpp:460
void getPdf_figtree(Array2D< double > &source, Array2D< double > &target, Array1D< double > &sig, Array1D< double > &density, Array1D< double > &weight)
KDE estimation of a PDF.
Definition probability.cpp:535
double erff(const double x)
An implementation of error function using incomplete gamma function.
Definition probability.cpp:53
void ihsP(int ns, int np, int *rpos, int dfac, dsfmt_t *rnstate)
Definition probability.cpp:761
double get_std(const Array1D< double > &data)
Returns the std of a data array.
Definition probability.cpp:404
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,...
Definition probability.cpp:614
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...
Definition probability.cpp:827
void ihsU(Array2D< double > &rndnos, int dfac, dsfmt_t *rnstate)
Definition probability.cpp:737
double inverf(double y0)
Inverse error function, input scaled to [-1,1].
Definition probability.cpp:59
void generate_normal_lhs(Array2D< double > &rvar, int zSeed)
Generates a matrix of i.i.d. normal(0,1) random variable LHS samples.
Definition probability.cpp:337
double get_median(const Array1D< double > &data)
Returns the median of a data array.
Definition probability.cpp:353
double get_var(const Array1D< double > &data)
Returns the std of a data array.
Definition probability.cpp:421
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.
Definition probability.cpp:200
void rperm(int n, int *a, dsfmt_t *rnstate)
Random permutation of 0..n-1.
Definition probability.cpp:518
double get_mean(const Array1D< double > &data)
Returns the mean of a 1D data array.
Definition probability.cpp:374
double normcdf(double y)
Normal random variable CDF.
Definition probability.cpp:187
void generate_normal(Array2D< double > &rvar, int zSeed)
Generates a matrix of i.i.d. normal(0,1) random variable samples.
Definition probability.cpp:321
double covariance(Array1D< double > &x1, Array1D< double > &x2, Array1D< double > &param, string covtype)
Compute a few standard covariance functions C(x_1,x_2)
Definition probability.cpp:695
double invnormcdf(double y)
Inverse of the CDF of the normal random variable, uses inverf.
Definition probability.cpp:180