#include <random_number.h>
Public Member Functions | |
| RandomNumber () | |
| RandomNumber (int num_samples) | |
| RandomNumber (int num_samples, int num_ghosts) | |
| ~RandomNumber () | |
| void | set_size (int num_samples) |
| Allocates space for a random number even distributed across the cores. | |
| void | set_ghost_size (int num_samples, int num_ghosts) |
| Allocates space for a ghost padded random number even distributed across the cores. | |
| void | make_uniform (int seed) const |
| Gives the random number a uniform distribution. | |
| void | make_normal (double mu, double sigma, int seed) const |
| Gives the random number a normal distribution. | |
| double | mean () |
| Returns the sample mean and stores it for future use. | |
| double | variance () |
| Returns the unbiased sample variance and stores it for future use. | |
| double | min () |
| Returns the sample minimum and stores it for future use. | |
| double | max () |
| Returns the sample maximum and stores it for future use. | |
| void | create_frequency_table (int num_bins, bool normalized) |
| Uses an STL vector array to store the frequency table. | |
| void | print_frequency_table (std::string file_name, int num_bins, Distribution &dist) const |
| double | get_quantile (int alpha) |
| void | view (void) const |
| Write the random number to the screen. | |
| void | print (std::string file_name) const |
Public Attributes | |
| std::vector< double > * | frequency_table |
| ddata::Vector | samples |
Private Attributes | |
| int | num_samples |
| double * | sample_min |
| double * | sample_max |
| double * | sample_mean |
| double * | sample_variance |
| RandomNumber::RandomNumber | ( | ) |
| RandomNumber::RandomNumber | ( | int | num_samples | ) |
| RandomNumber::RandomNumber | ( | int | num_samples, | |
| int | num_ghosts | |||
| ) |
| RandomNumber::~RandomNumber | ( | ) |
| void RandomNumber::set_size | ( | int | num_samples_ | ) |
Allocates space for a random number even distributed across the cores.
| num_samples | : The number of samples. |
| void RandomNumber::set_ghost_size | ( | int | num_samples_, | |
| int | num_ghosts | |||
| ) |
Allocates space for a ghost padded random number even distributed across the cores.
| num_samples | : The number of samples. | |
| num_ghosts | : The number of ghost points. |
| void RandomNumber::make_uniform | ( | int | seed | ) | const |
Gives the random number a uniform distribution.
| seed | : True seeds the generator, false does not. |
| void RandomNumber::make_normal | ( | double | mu, | |
| double | sigma, | |||
| int | seed | |||
| ) | const |
Gives the random number a normal distribution.
| mu | : The mean. | |
| sigma | : The square root of the variance. | |
| seed | : True seeds the generator, false does not. |
and
, the transformed variables
and
are independent with a distribution of
. Where
| double RandomNumber::mean | ( | ) |
Returns the sample mean and stores it for future use.
| double RandomNumber::variance | ( | ) |
Returns the unbiased sample variance and stores it for future use.
| double RandomNumber::min | ( | ) |
Returns the sample minimum and stores it for future use.
| double RandomNumber::max | ( | ) |
Returns the sample maximum and stores it for future use.
| void RandomNumber::create_frequency_table | ( | int | num_bins, | |
| bool | normalized | |||
| ) |
Uses an STL vector array to store the frequency table.
| num_bins | : The number of bins. | |
| normalized | : If true the area under the frequency curve is 1.0. If false then the actual frequencies are computed. |

| void RandomNumber::print_frequency_table | ( | std::string | file_name, | |
| int | num_bins, | |||
| Distribution & | dist | |||
| ) | const |
| double RandomNumber::get_quantile | ( | int | alpha | ) |
| void RandomNumber::view | ( | void | ) | const |
Write the random number to the screen.
| void RandomNumber::print | ( | std::string | file_name | ) | const |
int RandomNumber::num_samples [private] |
double* RandomNumber::sample_min [private] |
double* RandomNumber::sample_max [private] |
double* RandomNumber::sample_mean [private] |
double* RandomNumber::sample_variance [private] |
| std::vector<double>* RandomNumber::frequency_table |
Source code hosted by