Commit 8d5bcef7 authored by thomas.forbriger's avatar thomas.forbriger

libtfxx [FEATURE]: provide comment regarding recommended rng type

parent 99689a7e
......@@ -147,6 +147,58 @@ namespace tfxx {
}
} // RNGgaussian::UTException::UTException
/* ====================================================================== */
const char* RNGgaussian::comment_gsl_rng_ranlux=
{
"The recommended random number generator type is \"ranlxd2\"\n"
"\n"
"Quotation from \n"
"https://www.gnu.org/software/gsl/doc/html/index.html\n"
"https://www.gnu.org/software/gsl/doc/html/rng.html#random-number-generator-algorithms\n"
"\n"
"The following generators are recommended for use in simulation. They have\n"
"extremely long periods, low correlation and pass most statistical tests.\n"
"For the most reliable source of uncorrelated numbers, the second-generation\n"
"RANLUX generators have the strongest proof of randomness.\n"
"\n"
"gsl_rng_ranlxd1\n"
"gsl_rng_ranlxd2\n"
"\n"
" These generators produce double precision output (48 bits) from the\n"
" RANLXS generator. The library provides two luxury levels ranlxd1 and\n"
" ranlxd2, in increasing order of strength.\n"
"\n"
"gsl_rng_ranlux\n"
"gsl_rng_ranlux389\n"
"\n"
" The ranlux generator is an implementation of the original algorithm\n"
" developed by Luscher. It uses a lagged-fibonacci-with-skipping\n"
" algorithm to produce “luxury random numbers”. It is a 24-bit\n"
" generator, originally designed for single-precision IEEE floating\n"
" point numbers. This implementation is based on integer arithmetic,\n"
" while the second-generation versions RANLXS and RANLXD described\n"
" above provide floating-point implementations which will be faster\n"
" on many platforms. The period of the generator is about 10^{171}.\n"
" The algorithm has mathematically proven properties and it can\n"
" provide truly decorrelated numbers at a known level of randomness.\n"
" The default level of decorrelation recommended by Luscher is\n"
" provided by gsl_rng_ranlux, while gsl_rng_ranlux389 gives the\n"
" highest level of randomness, with all 24 bits decorrelated. Both\n"
" types of generator use 24 words of state per generator.\n"
"\n"
" For more information see,\n"
"\n"
" * M. Luscher, “A portable high-quality random number generator for\n"
" lattice field theory calculations”, Computer Physics Communications,\n"
" 79 (1994) 100–110.\n"
" DOI: 10.1016/0010-4655(94)90232-1.\n"
" * F. James, “RANLUX: A Fortran implementation of the high-quality\n"
" pseudo-random number generator of Luscher”, Computer Physics\n"
" Communications, 79 (1994) 111–114\n"
" DOI: 10.1016/0010-4655(94)90233-X\n"
}; // RNGgaussian::comment_gsl_rng_ranlux
} // namespace numeric
} // namespace tfxx
......
......@@ -100,6 +100,8 @@ namespace tfxx {
double mean() const { return Mmean; }
//! print list of random number generators to stream.
static void rng_list_types(std::ostream& os);
//! comment on GSL RNGs
static const char* comment_gsl_rng_ranlux;
private:
//! store standard deviation and mean value
double Mstd, Mmean;
......
......@@ -59,11 +59,14 @@ int main(int iargc, char* argv[])
"usage: rngtest [-l] [-v] [-t type] [-seed v] [-mean v]\n"
" [-std v] [-n n] [run]\n"
" or: rngtest --help|-h" "\n"
" or: rngtest --xhelp" "\n"
};
// define full help text
char help_text[]=
{
"--xhelp print comments regarding GSL RNG implementation\n"
"\n"
"run run the program\n"
"-l print list of random number generators and exit\n"
"-v be verbose\n"
......@@ -103,6 +106,8 @@ int main(int iargc, char* argv[])
{"std",arg_yes,"1."},
// 7: number of samples to be printed
{"n",arg_yes,"10"},
// 8: print comment text
{"xhelp",arg_no,"-"},
{NULL}
};
......@@ -117,10 +122,15 @@ int main(int iargc, char* argv[])
Commandline cmdline(iargc, argv, options);
// help requested? print full help text...
if (cmdline.optset(0))
if (cmdline.optset(0) || cmdline.optset(8))
{
cerr << usage_text << endl;
cerr << help_text << endl;
if (cmdline.optset(8))
{
cerr << endl;
cerr << tfxx::numeric::RNGgaussian::comment_gsl_rng_ranlux << endl;
}
exit(0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment