From 7c7db8f5a4a28d1ac51f3518c9d28856c8cb5c62 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 16 Jan 2020 14:22:34 -0700 Subject: [PATCH] Increase the precision of the output. --- MCMC-Laplace/mcmc-laplace.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MCMC-Laplace/mcmc-laplace.cc b/MCMC-Laplace/mcmc-laplace.cc index 483ea24..a390ceb 100644 --- a/MCMC-Laplace/mcmc-laplace.cc +++ b/MCMC-Laplace/mcmc-laplace.cc @@ -586,6 +586,13 @@ namespace ProposalGenerator // formula for accepting a sample slightly more awkward, but if you // take exponentials on both sides of the comparison, the formula // should become obvious again. +// +// Finally, we note that the output is generated with 7 digits of +// accuracy. (The C++ default is 6 digits.) We do this because, +// as shown in the paper, we can determine the mean value of the +// probability distribution we are sampling here to at least six +// digits of accuracy, and do not want to be limited by the precision +// of the output. namespace Sampler { class MetropolisHastings @@ -634,6 +641,8 @@ namespace Sampler , accepted_sample_number(0) { output_file.open("samples-" + dataset_name + ".txt"); + output_file.precision(7); + random_number_generator.seed(random_seed); } -- 2.39.5