DFNgen
2.0
DFN Model Generator
|
#include <expDist.h>
Public Member Functions | |
ExpDist (double maxDecimal, std::mt19937_64 &_generator) | |
double | getValue (double lambda, double rv) |
double | getValue (double lambda, double minInput, double maxInput) |
double | getMaxValue (double lambda) |
double | computeInput (double output, double lambda) |
Private Member Functions | |
double | unifRandom (double, double) |
Private Attributes | |
double | maxInput |
std::mt19937_64 & | generator |
Exponentail Distribution Class
This class was created to allow the user to specify the min and max values to be produced by the exponential distrubution.
ExpDist::ExpDist | ( | double | maxDecimal, |
std::mt19937_64 & | _generator | ||
) |
Initializes 'maxInput': the maximum deecimal value the machine can produce less than 1.0 Initializes 'generator': the random number generator Arg 1: maxDecimal, the maximum double less than 1.0 the machine can produce e.g. 0.9999999... before being recognized as 1.0 Arg 2: Reference to std library <random> random number Mersenne twister engine generator.
Definition at line 21 of file expDist.cpp.
double ExpDist::computeInput | ( | double | output, |
double | lambda | ||
) |
Computes what the input value needs to be in order for the distribution to return 'output' Uses the distributions CDF for computation.
Arg 1: The desired output of from the distribution (getValue()) Arg 2: Lambda Return: The necessary input to getValue() to produce a value of 'output'
Definition at line 129 of file expDist.cpp.
double ExpDist::getMaxValue | ( | double | lambda | ) |
Returns maximum possible value from distribution. (What the inverse CDF returns when given 0.9999... to maximum precision. Inputing 1.0 into the distribution results in 'inf'.)
Used to print warning to user if their desired maximum is larger than the machine is able to produce.
Arg 1: Lambda Return: Maximum value possible due to machine precision issues before reutrning inf
Definition at line 115 of file expDist.cpp.
double ExpDist::getValue | ( | double | lambda, |
double | rv | ||
) |
Returns a random number from the distribution with a random variable given as an argument. Arg 1: Lambda Arg 2: Random variable between 0 and 1 Return: Random number from exponential distribution described by 'lambda'
Definition at line 46 of file expDist.cpp.
double ExpDist::getValue | ( | double | lambda, |
double | minVal, | ||
double | maxVal | ||
) |
Generates a random value from the exponental distribution between the user's defined minimum and maximum range.
minVal and maxVal are the inputs needed to produce the user's minimum and maximum fracture sizes. minVal and maxVal are initialized within the Distributions constructor and saved in the Shape structure. Using a uniform random variable with range [minVal, maxVal], the exponential distrubition will always return a value within that range.
Arg 1: Exponential Lambda (1/mean) Arg 2: Minimum input (between 0 and 1) Arg 3: Maximum input (between 0 and 1) Return: Random number from exponential distribution described by 'lambda' and sampled with random variable between minInput and maxVal
Definition at line 81 of file expDist.cpp.
|
private |
Function returns a random double on [min, max] Arg 1: Minimum bound Arg 2: Maximum bound Return: Random double on [min, max]
Definition at line 33 of file expDist.cpp.
|
private |
|
private |
Maximum input to distribution .999999... before being recognized as 1 by the computer. (1 returns inf). Initialized during Distributions constructor.