su2hmc
|
Header for random number configuration. More...
Go to the source code of this file.
Macros | |
#define | RAN2 |
#define | IM1 2147483563 |
#define | IM2 2147483399 |
#define | AM (1.0/IM1) |
#define | IMM1 (IM1-1) |
#define | IA1 40014 |
#define | IA2 40692 |
#define | IQ1 53668 |
#define | IQ2 52774 |
#define | IR1 12211 |
#define | IR2 3791 |
#define | NTAB 32 |
#define | NDIV (1+IMM1/NTAB) |
#define | EPS 1.2e-7 |
#define | RNMX (1.0-EPS) |
Functions | |
int | ranset (long *seed) |
Dummy seed the ran2 generator. | |
int | Par_ranset (long *seed, int iread) |
Uses the rank to get a new seed. Copying from the FORTRAN description here c create new seeds in range seed to 9*seed c having a range of 0*seed gave an unfortunate pattern c in the underlying value of ds(1) (it was always 10 times bigger c on the last processor). This does not appear to happen with 9. | |
double | ran2 (long *idum) |
Generates uniformly distributed random double between zero and one as described in numerical recipes. It's also thread-safe for different seeds. | |
int | Gauss_z (Complex *ps, unsigned int n, const Complex mu, const double sigma) |
Generates a vector of normally distributed random double precision complex numbers using the Box-Muller Method. | |
int | Gauss_d (double *ps, unsigned int n, const double mu, const double sigma) |
Generates a vector of normally distributed random double precision numbers using the Box-Muller Method. | |
int | Gauss_c (Complex_f *ps, unsigned int n, const Complex_f mu, const float sigma) |
Generates a vector of normally distributed random single precision complex numbers using the Box-Muller Method. | |
int | Gauss_f (float *ps, unsigned int n, const float mu, const float sigma) |
Generates a vector of normally distributed random single precision numbers using the Box-Muller Method. | |
int | Par_ranread (char *filename, double *ranval) |
Reads ps from a file Since this function is very similar to Par_sread, I'm not really going to comment it check there if you are confused about things. | |
double | Par_granf () |
Generates a random double which is then sent to the other ranks. | |
int | ran_test () |
Test Functions. | |
Variables | |
long | seed |
RAN2 seed. | |
Header for random number configuration.
Definition in file random.h.
Generates a vector of normally distributed random single precision complex numbers using the Box-Muller Method.
ps | The output array |
n | The array length |
mu | mean |
sigma | variance |
Definition at line 260 of file random.c.
References M_PI, ran2(), and seed.
int Gauss_d | ( | double * | ps, |
unsigned int | n, | ||
const double | mu, | ||
const double | sigma ) |
Generates a vector of normally distributed random double precision numbers using the Box-Muller Method.
ps | The output array |
n | The array length |
mu | mean |
sigma | variance |
Definition at line 306 of file random.c.
References M_PI, ran2(), and seed.
int Gauss_f | ( | float * | ps, |
unsigned int | n, | ||
const float | mu, | ||
const float | sigma ) |
Generates a vector of normally distributed random single precision numbers using the Box-Muller Method.
ps | The output array |
n | The array length |
mu | mean |
sigma | variance |
Definition at line 369 of file random.c.
References M_PI, ran2(), and seed.
Generates a vector of normally distributed random double precision complex numbers using the Box-Muller Method.
ps | The output array |
n | The array length |
mu | mean |
sigma | variance |
Definition at line 214 of file random.c.
References M_PI, ran2(), and seed.
double Par_granf | ( | ) |
Generates a random double which is then sent to the other ranks.
Definition at line 190 of file random.c.
References Par_dcopy(), ran2(), rank, and seed.
int Par_ranread | ( | char * | filename, |
double * | ranval ) |
Reads ps from a file Since this function is very similar to Par_sread, I'm not really going to comment it check there if you are confused about things.
filename | The name of the file we're reading from |
ranval | The destination for the file's contents |
Definition at line 88 of file random.c.
References Par_dcopy(), and rank.
int Par_ranset | ( | long * | seed, |
int | iread ) |
Uses the rank to get a new seed. Copying from the FORTRAN description here c create new seeds in range seed to 9*seed c having a range of 0*seed gave an unfortunate pattern c in the underlying value of ds(1) (it was always 10 times bigger c on the last processor). This does not appear to happen with 9.
seed | The seed from the rank in question. |
iread | Do we read from file or not. Don't remember why it's here as it's not used |
Definition at line 135 of file random.c.
References rank, ranset(), seed, and size.
double ran2 | ( | long * | idum | ) |
Generates uniformly distributed random double between zero and one as described in numerical recipes. It's also thread-safe for different seeds.
idum | Pointer to the seed |
Definition at line 440 of file random.c.
|
inline |
Dummy seed the ran2 generator.
seed | pointer to seed |
Definition at line 74 of file random.c.
References seed.