24 std::string outfile =
"data/hp/timing/lattice_sizes.txt";
27 int lattice_sizes[] = {20, 40, 60, 80, 100};
29 utils::mkpath(utils::dirname(outfile));
32 for (
int L : lattice_sizes) {
34 montecarlo::phase_transition(L, 2.1, 2.4, 40, 20000,
35 montecarlo::mcmc_parallel,
"/dev/null", 0);
37 montecarlo::phase_transition(L, 2.1, 2.4, 40, 20000,
38 montecarlo::mcmc_serial,
"/dev/null", 0);
40 ofile << utils::scientific_format(L) <<
','
41 << utils::scientific_format(t1 - t0) <<
','
42 << utils::scientific_format(t2 - t1) <<
'\n';
51 std::string outfile =
"data/hp/timing/sample_sizes.txt";
54 int sample_sizes[] = {1000, 10000, 100000};
56 utils::mkpath(utils::dirname(outfile));
59 for (
int samples : sample_sizes) {
61 montecarlo::phase_transition(20, 2.1, 2.4, 40, samples,
62 montecarlo::mcmc_parallel,
"/dev/null", 0);
64 montecarlo::phase_transition(20, 2.1, 2.4, 40, samples,
65 montecarlo::mcmc_serial,
"/dev/null", 0);
67 ofile << utils::scientific_format(samples) <<
','
68 << utils::scientific_format(t1 - t0) <<
','
69 << utils::scientific_format(t2 - t1) <<
'\n';
77 std::cout <<
"Usage: " << filename <<
" OPTION ...\n"
78 <<
"At least one option should be used.\n\n"
79 <<
"\t[ -h | --help ]\n"
81 <<
"\t[ --time-lattice-sizes ]\n"
82 <<
"\t[ --time-sample-sizes ]\n";
87int main(
int argc,
char **argv)
89 struct option long_options[] = {{
"all", 0, 0, 0},
90 {
"time-lattice-sizes", 0, 0, 0},
91 {
"time-sample-sizes", 0, 0, 0},
95 int option_index = -1;
99 c = getopt_long(argc, argv,
"h", long_options, &option_index);
106 switch (option_index) {
Header for the data_t type.
Functions for Monte Carlo simulations.
int main()
The main function.
void time_lattice_sizes()
Time phase transition using different lattice sizes.
void usage(std::string filename)
A function that displays how to use the program and quits.
void time_sample_sizes()
Time phase transition using different sample sizes.
Function prototypes and macros that are useful.