32 const std::string
test_name =
"RandomNumbers.Field";
45 return rand_field(
"test_RandomNumbers_MT19937_Field_Gaussian.yaml");
51 return rand_field(
"test_RandomNumbers_MT19937_Field_U1.yaml");
57 return rand_field(
"test_RandomNumbers_MT19937_Field_Z2.yaml");
63 return rand_field(
"test_RandomNumbers_Mseries_Field_Gaussian.yaml");
69 return rand_field(
"test_RandomNumbers_Mseries_Field_U1.yaml");
75 return rand_field(
"test_RandomNumbers_Mseries_Field_Z2.yaml");
80 int rand_field_SFMT_Gaussian()
82 return rand_field(
"test_RandomNumbers_SFMT_Field_Gaussian.yaml");
86 int rand_field_SFMT_U1()
88 return rand_field(
"test_RandomNumbers_SFMT_Field_U1.yaml");
92 int rand_field_SFMT_Z2()
94 return rand_field(
"test_RandomNumbers_SFMT_Field_Z2.yaml");
99 #ifdef USE_TESTMANAGER_AUTOREGISTER
102 "RandomNumbers.MT19937.Field.Gaussian",
107 "RandomNumbers.MT19937.Field.U1",
112 "RandomNumbers.MT19937.Field.Z2",
118 "RandomNumbers.Mseries.Field.Gaussian",
123 "RandomNumbers.Mseries.Field.U1",
128 "RandomNumbers.Mseries.Field.Z2",
134 "RandomNumbers.SFMT.Field.Gaussian",
135 rand_field_SFMT_Gaussian
139 "RandomNumbers.SFMT.Field.U1",
144 "RandomNumbers.SFMT.Field.Z2",
158 const string str_rand_type = params_test.
get_string(
"random_number_type");
159 const string str_noise_type = params_test.
get_string(
"noise_type");
160 const int iseed = params_test.
get_int(
"int_seed");
161 const string str_vlevel = params_test.
get_string(
"verbose_level");
163 const bool do_check = params_test.
is_set(
"expected_result");
164 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
169 vout.
general(
vl,
" rand_type = %s\n", str_rand_type.c_str());
170 vout.
general(
vl,
" noise_type = %s\n", str_noise_type.c_str());
177 unique_ptr<RandomNumbers> rand(RandomNumbers::New(str_rand_type, iseed));
189 Field v(Nin, Nvol, Nex);
194 rand->lex_global(str_noise_type, v);
196 const int size = v.
size();
197 for (
int i = 0; i < size; ++i) {
199 vr += v.
cmp(i) * v.
cmp(i);
206 av = av_all / Nvol / NPE / Nin / Nex;
207 vr = vr_all / Nvol / NPE / Nin / Nex - av * av;
215 vout.
general(
vl,
" variance(expect) = %10.8f\n", 1.0 / sqrt(2.0));