32 #ifndef MCKL_RANDOM_RUN_TEST_HPP 33 #define MCKL_RANDOM_RUN_TEST_HPP 49 template <
typename ResultType>
50 static bool eval(ResultType u, ResultType v)
60 template <
typename ResultType>
61 static bool eval(ResultType u, ResultType v)
78 template <
typename RNGType,
typename DistributionType>
79 double operator()(RNGType &rng, DistributionType &distribution)
81 using result_type =
typename DistributionType::result_type;
83 std::array<double, 6> count;
84 std::fill(count.begin(), count.end(), 0);
86 const std::size_t t = 5;
95 v = distribution(rng);
103 count[std::min(r - 1, t)] += 1;
106 static const std::array<double, 36> a = {
107 {4529.3536459687906886, 9044.9020785000773816,
108 13567.945220995269025, 18091.267213474662936,
109 22614.713867746890457, 27892.158836517771651,
110 9044.9020785000773816, 18097.025434456939714,
111 27139.455190145025166, 36186.649289760956163,
112 45233.819845609141668, 55788.831062952543501,
113 13567.945220995269025, 27139.455190145025166,
114 40721.332025378211539, 54281.265638700444264,
115 67852.044551180596848, 83684.570464780923545,
116 18091.267213474662936, 36186.649289760956163,
117 54281.265638700444264, 72413.608184786274684,
118 90470.078876317476369, 111580.11003176274101,
119 22614.713867746890457, 45233.819845609141668,
120 67852.044551180596848, 90470.078876317476369,
121 113261.81500341715234, 139475.55458338270984,
122 27892.158836517771651, 55788.831062952543501,
123 83684.570464780923545, 111580.11003176274101,
124 139475.55458338270984, 172860.17010641275243}};
126 static const std::array<double, 6> b = {
127 {0.16666666666666666667, 0.20833333333333333333,
128 0.091666666666666666667, 0.026388888888888888889,
129 0.0057539682539682539683, 0.0011904761904761904762}};
132 6, -static_cast<double>(n_), b.data(), count.data(), count.data());
134 std::array<double, 36> c;
136 for (std::size_t i = 0; i != 6; ++i) {
137 for (std::size_t j = 0; j != 6; ++j) {
138 c[k++] = count[i] * count[j];
141 mul(36, a.data(), c.data(), c.data());
143 return std::accumulate(c.begin(), c.end(), 0.0) / (n_ - 6);
160 template <
typename RNGType,
typename DistributionType>
161 double operator()(RNGType &rng, DistributionType &distribution)
163 using result_type =
typename DistributionType::result_type;
165 const std::size_t t = 5;
166 std::array<double, 6> count;
167 std::fill(count.begin(), count.end(), 0);
178 v = distribution(rng);
180 count[std::min(r, t)] += 1;
182 v = distribution(rng);
189 double n =
static_cast<double>(n_);
190 std::array<double, 6> np = {
191 {n / 2, n / 3, n / 8, n / 30, n / 144, n / 720}};
193 return this->stat(t + 1, count.data(), np.data());
209 template <
bool Independent,
bool Up = true>
214 #endif // MCKL_RANDOM_RUN_TEST_HPP void mul(std::size_t n, const float *a, const float *b, float *y)
static bool eval(ResultType u, ResultType v)
static bool eval(ResultType u, ResultType v)
double operator()(RNGType &rng, DistributionType &distribution)
double operator()(RNGType &rng, DistributionType &distribution)
#define MCKL_DEFINE_RANDOM_TEST_OPERATOR(ResultType)
RunTestImpl(std::size_t n)
double degree_of_freedom() const
double degree_of_freedom() const
Tests based on the -distribution.
RunTestImpl(std::size_t n)