32 #ifndef MCKL_RANDOM_MAXIMUM_OF_T_TEST_HPP 33 #define MCKL_RANDOM_MAXIMUM_OF_T_TEST_HPP 45 template <std::
size_t D, std::
size_t T>
48 static_assert(D > 1,
"**MaximumOfTTest** used with D less than two");
50 static_assert(T > 0,
"**MaximumOfTTest** used with T equal to zero");
57 template <
typename RNGType,
typename U01DistributionType>
60 using result_type =
typename U01DistributionType::result_type;
63 std::fill(count.begin(), count.end(), 0);
66 const std::size_t m = n_ / k;
67 const std::size_t l = n_ % k;
70 for (std::size_t i = 0; i != m; ++i) {
71 generate(rng, u01, k, r.data(), s.data(), count.data());
73 generate(rng, u01, l, r.data(), s.data(), count.data());
75 return this->
stat(D, count.data(),
static_cast<double>(n_) / D);
83 template <
typename RNGType,
typename U01DistributionType>
84 void generate(RNGType &rng, U01DistributionType &
u01, std::size_t n,
85 typename U01DistributionType::result_type *r,
86 typename U01DistributionType::result_type *s,
double *count)
88 using result_type =
typename U01DistributionType::result_type;
90 rand(rng, u01, n * T, r);
91 for (std::size_t i = 0; i != n; ++i, r += T) {
92 s[i] = *std::max_element(r, r + T);
94 pow(n, s, static_cast<result_type>(T), s);
95 mul(n, static_cast<result_type>(D), s, s);
96 for (std::size_t i = 0; i != n; ++i) {
97 ++count[internal::ftoi<std::size_t, D>(s[i])];
104 #endif // MCKL_RANDOM_MAXIMUM_OF_T_TEST_HPP void pow(std::size_t n, const float *a, const float *b, float *y)
void mul(std::size_t n, const float *a, const float *b, float *y)
double degree_of_freedom() const
double stat(std::size_t m, const double *count, const double *np) const
std::vector< T, Alloc > Vector
std::vector with Allocator as the default allocator
RealType u01(UIntType u)
Convert uniform unsigned integers to floating points within [0, 1].
#define MCKL_DEFINE_RANDOM_TEST_OPERATOR(ResultType)
double operator()(RNGType &rng, U01DistributionType &u01)
void rand(RNGType &rng, ArcsineDistribution< RealType > &distribution, std::size_t N, RealType *r)
Tests based on the maximum-of-t method.
Tests based on the -distribution.
MaximumOfTTest(std::size_t n)