#include <cstdlib>#include "randomnumbers.hpp"#include "linearalgebra.hpp"#include <cmath>#include <utility>#include <vector>
Go to the source code of this file.
Functions | |
| double | randf (double min, double max) |
| Draw uniformly distributed samples between two numbers. More... | |
| double | randn (double mean, double stdv) |
| Draws from Gaussian \( \mathcal{N} (\mu,\sigma) \) (mean, standard deviation) using Box-Müller transform. More... | |
| std::vector< double > | randn (std::vector< double > means, std::vector< double > stdv) |
| Draws from uncorrelated Gaussians \( \mathcal{N} (\boldsymbol \mu,\boldsymbol{\sigma}) \) (vectors of mean, standard deviation) using Box-Müller transform. Loops over both vectors and calls randn(double mean, double stdv) every iteration. More... | |
| std::vector< double > | randn (std::vector< double > stdv) |
| Draws zero-mean samples from uncorrelated Gaussians \( \mathcal{N} (\boldsymbol 0,\boldsymbol{\sigma}) \) (standard deviation) using Box-Müller transform. Loops over both vectors and calls randn(double mean, double stdv) every iteration. More... | |
| std::vector< double > | randn_Cholesky (std::vector< double > mean, std::vector< std::vector< double >> CholeskyLower_CovarianceMatrix) |
| Drawing non-zero mean samples from an \( n \) dimensional correlated Gaussian. Invokes randn_Cholesky(std::vector<std::vector<double>> CholeskyLower_CovarianceMatrix) and adds mean. More... | |
| std::vector< double > | randn_Cholesky (std::vector< std::vector< double >> CholeskyLower_CovarianceMatrix) |
| Drawing non-zero mean samples from an \( n \) dimensional correlated Gaussian. This algorithm uses the lower Cholesky matrix of the (positive definite Hermitian) covariance matrix to transform (affine transform) n uncorrelated samples with standard deviation 1 to the right covariances. The mean is assumed zero. More... | |
| std::vector< double > | randn (std::vector< std::vector< double >> DiagonalCovarianceMatrix) |
| Drawing n zero mean samples from \( \mathcal{N} (\boldsymbol 0,\boldsymbol{\sigma}) \). No correlation is present between the parameters. More... | |
| double randf | ( | double | min, |
| double | max | ||
| ) |
Draw uniformly distributed samples between two numbers.
| min | Minimum of the distribution. |
| max | Maximum of the distribution. |
Definition at line 13 of file randomnumbers.cpp.
| double randn | ( | double | mean, |
| double | stdv | ||
| ) |
Draws from Gaussian \( \mathcal{N} (\mu,\sigma) \) (mean, standard deviation) using Box-Müller transform.
| mean | double containing \( \mu \) |
| stdv | double containing \( \sigma \) |
Definition at line 17 of file randomnumbers.cpp.
| std::vector<double> randn | ( | std::vector< double > | means, |
| std::vector< double > | stdv | ||
| ) |
Draws from uncorrelated Gaussians \( \mathcal{N} (\boldsymbol \mu,\boldsymbol{\sigma}) \) (vectors of mean, standard deviation) using Box-Müller transform. Loops over both vectors and calls randn(double mean, double stdv) every iteration.
| mean | vector containing \( \mu_i \) |
| stdv | vector containing \( \sigma_i \) |
Definition at line 30 of file randomnumbers.cpp.
| std::vector<double> randn | ( | std::vector< double > | stdv | ) |
Draws zero-mean samples from uncorrelated Gaussians \( \mathcal{N} (\boldsymbol 0,\boldsymbol{\sigma}) \) (standard deviation) using Box-Müller transform. Loops over both vectors and calls randn(double mean, double stdv) every iteration.
| stdv | vector containing \( \sigma_i \) |
Definition at line 36 of file randomnumbers.cpp.
| std::vector<double> randn | ( | std::vector< std::vector< double >> | DiagonalCovarianceMatrix | ) |
Drawing n zero mean samples from \( \mathcal{N} (\boldsymbol 0,\boldsymbol{\sigma}) \). No correlation is present between the parameters.
| DiagonalCovarianceMatrix | Matrix containing on the diagonal the variance, or standard deviation squared. |
Definition at line 62 of file randomnumbers.cpp.
| std::vector<double> randn_Cholesky | ( | std::vector< double > | mean, |
| std::vector< std::vector< double >> | CholeskyLower_CovarianceMatrix | ||
| ) |
Drawing non-zero mean samples from an \( n \) dimensional correlated Gaussian. Invokes randn_Cholesky(std::vector<std::vector<double>> CholeskyLower_CovarianceMatrix) and adds mean.
| mean | vector containing \( n \) means. |
| CholeskyLower_CovarianceMatrix | Matrix containing the n x n Lower Cholesky matrix of the n x n covariance matrix \( \boldsymbol \Sigma \), must be square and lower triangular. |
Definition at line 47 of file randomnumbers.cpp.
| std::vector<double> randn_Cholesky | ( | std::vector< std::vector< double >> | CholeskyLower_CovarianceMatrix | ) |
Drawing non-zero mean samples from an \( n \) dimensional correlated Gaussian. This algorithm uses the lower Cholesky matrix of the (positive definite Hermitian) covariance matrix to transform (affine transform) n uncorrelated samples with standard deviation 1 to the right covariances. The mean is assumed zero.
| CholeskyLower_CovarianceMatrix | Matrix containing the n x n Lower Cholesky matrix of the n x n covariance matrix \( \boldsymbol \Sigma \), must be square and lower triangular. |
Definition at line 51 of file randomnumbers.cpp.
1.8.13