diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 1a985a0..20b4de1 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -27,6 +27,7 @@ doxygen_files = discrete_distribution exponential_distribution extreme_value_distribution + faure fisher_f_distribution gamma_distribution generate_canonical @@ -42,6 +43,7 @@ doxygen_files = mersenne_twister negative_binomial_distribution non_central_chi_squared_distribution + niederreiter_base2 normal_distribution piecewise_constant_distribution piecewise_linear_distribution @@ -52,6 +54,7 @@ doxygen_files = seed_seq shuffle_order # shuffle_output + sobol student_t_distribution subtract_with_carry taus88 @@ -107,6 +110,9 @@ doxygen reference : rand48=\"@xmlonly rand48 @endxmlonly\" \\ mt11213b=\"@xmlonly mt11213b @endxmlonly\" \\ mt19937=\"@xmlonly mt19937 @endxmlonly\" \\ + niederreiter_base2=\"@xmlonly niederreiter_base2 @endxmlonly\" \\ + sobol=\"@xmlonly sobol @endxmlonly\" \\ + faure=\"@xmlonly faure @endxmlonly\" \\ ecuyer1988=\"@xmlonly ecuyer1988 @endxmlonly\" \\ lagged_fibonacci607=\"@xmlonly lagged_fibonacci607 @endxmlonly\" \\ lagged_fibonacci44497=\"@xmlonly lagged_fibonacci44497 @endxmlonly\" \\ diff --git a/doc/concepts.qbk b/doc/concepts.qbk index 0e1a6de..84de047 100644 --- a/doc/concepts.qbk +++ b/doc/concepts.qbk @@ -199,6 +199,70 @@ the generator, for example to re-run a test suite at a later time.] [endsect] +[section Quasi-Random Number Generator] + +A quasi-random number generator is a __UniformRandomNumberGenerator which +provides a deterministic sequence of quasi-random numbers, based on some +algorithm and internal state. [classref boost::random::niederreiter_base2 +Niederreiter Base 2] generator is an example of such a [qrng quasi-random +number generator]. The "quasi" modifier is used to denote more clearly that the +values produced by such a generator are neither random nor pseudo-random, but +they form a low discrepancy sequence. The intuitive idea is that a low discrepancy +sequence is more evenly distributed than a pseudo random sequence would be. +For example, if we generate a low discrepancy sequence of 2D points on a square, +this square would be covered more evenly, and the number of points falling to any +part of the square would be proportional to the number of points in the whole square. +Such sequences share some properties of random variables and in certain applications +such as the quasi-Monte Carlo method their lower discrepancy is an important advantage. + +[note Quasi-random sequences are known to give efficient numerical integration +rules in many Bayesian statistical problems where the posterior distribution can be +transformed into periodic functions on the n-dimensional hypercube.] + +Harold Niederreiter gives an extensive overview on random number generation +and quasi-Monte Carlo methods in his book "Random number generation and +quasi-Monte Carlo methods, Society for Industrial and Applied Mathematics, 1992". + +In addition to the __UniformRandomNumberGenerator requirements, +a quasi-random number generator has some additional requirements. In the +following table, `X` denotes a quasi-random number generator class, and `v` is +a const value of `X`. + +[table QuasiRandomNumberGenerator requirements + [[expression] [return type] [pre/post-condition]] + [[`X::dimension()`] [std::size_t] [the dimension of quasi-random domain. It must be no less than 1. + The return value of this function shall not change during the lifetime of the object.]] + ] + +[note The `operator()` returns a successive element of an n-dimensional (n = `X::dimension()`) vector +at each invocation. When all elements are exhausted, `operator()` begins anew with the starting +element of a subsequent n-dimensional vector.] + +Classes which model a quasi-random number generator shall also model +__EqualityComparable, i.e. implement `operator==`. Two quasi-random number +generators are defined to be /equivalent/ if they both return an identical +sequence of numbers starting from a given state. + +Classes which model a quasi-random number generator shall also model the +__Streamable concept, i.e. implement `operator<<` and `operator>>`. +`operator<<` writes all current state of the quasi-random number generator +to the given `ostream` so that `operator>>` can restore the state at a later +time. The state shall be written in a platform-independent manner, but it is +assumed that the `locales` used for writing and reading be the same. The +quasi-random number generator with the restored state and the original at +the just-written state shall be equivalent. + +Classes which model a quasi-random number generator should also model the +__CopyConstructible and __Assignable concepts. However, note that the +sequences of the original and the copy are strongly correlated (in fact, +they are identical), which may make them unsuitable for some problem domains. +Thus, copying quasi-random number generators is discouraged; they should +always be passed by (non-const) reference. + +The classes __niederreiter_base2, __sobol, __faure are models for a quasi-random number generator. + +[endsect] + [section Seed Sequence] A SeedSeq represents a sequence of values that can be used to diff --git a/doc/random.qbk b/doc/random.qbk index fd7a06e..637c39b 100644 --- a/doc/random.qbk +++ b/doc/random.qbk @@ -13,6 +13,7 @@ [template sup[text]''''''[text]''''''] [template prng[text] [link boost_random.reference.concepts.pseudo_random_number_generator [text]]] +[template qrng[text] [link boost_random.reference.concepts.quasi_random_number_generator [text]]] [template concepts[text] [link boost_random.reference.concepts [text]]] [template generators[text] [link boost_random.reference.generators [text]]] [template distributions[text] [link boost_random.reference.distributions [text]]] @@ -20,6 +21,7 @@ [def __NumberGenerator [link boost_random.reference.concepts.number_generator NumberGenerator]] [def __UniformRandomNumberGenerator [link boost_random.reference.concepts.uniform_random_number_generator UniformRandomNumberGenerator]] [def __PseudoRandomNumberGenerator [link boost_random.reference.concepts.pseudo_random_number_generator PseudoRandomNumberGenerator]] +[def __QuasiRandomNumberGenerator [link boost_random.reference.concepts.quasi_random_number_generator QuasiRandomNumberGenerator]] [def __SeedSeq [link boost_random.reference.concepts.seed_sequence SeedSeq]] [def __CopyConstructible [@boost:/doc/html/CopyConstructible.html CopyConstructible]] @@ -64,6 +66,9 @@ [def __ranlux64_4_01 [classref boost::random::ranlux64_4_01 ranlux64_4_01]] [def __ranlux24 [classref boost::random::ranlux24 ranlux24]] [def __ranlux48 [classref boost::random::ranlux48 ranlux48]] +[def __niederreiter_base2 [classref boost::random::niederreiter_base2 niederreiter_base2]] +[def __sobol [classref boost::random::sobol sobol]] +[def __faure [classref boost::random::faure faure]] [def __uniform_smallint [classref boost::random::uniform_smallint uniform_smallint]] [def __uniform_int_distribution [classref boost::random::uniform_int_distribution uniform_int_distribution]] diff --git a/include/boost/random/detail/gray_coded_qrng_base.hpp b/include/boost/random/detail/gray_coded_qrng_base.hpp new file mode 100644 index 0000000..d568887 --- /dev/null +++ b/include/boost/random/detail/gray_coded_qrng_base.hpp @@ -0,0 +1,103 @@ +/* boost random/detail/gray_coded_qrng_base.hpp header file + * + * Copyright Justinas Vygintas Daugmaudis 2010-2017 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_RANDOM_DETAIL_GRAY_CODED_QRNG_BASE_HPP +#define BOOST_RANDOM_DETAIL_GRAY_CODED_QRNG_BASE_HPP + +#include + +// Prerequisite headers for bitscan to work +#include +#include +#include +#include // find_lsb + +//!\file +//!Describes the gray-coded quasi-random number generator base class template. + +namespace boost { +namespace random { + +namespace detail { + +template +class gray_coded_qrng_base : public qrng_base +{ +private: + typedef gray_coded_qrng_base self_t; + typedef qrng_base base_t; + + // The base needs to access modifying member f-ns, and we + // don't want these functions to be available for the public use + friend class qrng_base; + +public: + typedef typename LatticeT::value_type result_type; + + explicit gray_coded_qrng_base(std::size_t dimension) + : base_t(dimension) + {} + + // default copy c-tor is fine + + // default assignment operator is fine + +protected: + void seed(std::size_t init, const char *msg) + { + this->curr_elem = 0; + if (init != this->seq_count) + { + base_t::derived().seed(); + + this->seq_count = init; + init ^= (init / 2); + for (int r = 0; init != 0; ++r, init >>= 1) + { + if (init & 1) + update_quasi(r, msg); + } + } + } + +private: + // Compute next state for this QRNG + void compute_next() + { + compute_seq(this->seq_count++); + } + + void compute_seq(std::size_t cnt) + { + // Find the position of the least-significant zero in sequence count. + // This is the bit that changes in the Gray-code representation as + // the count is advanced. + int r = multiprecision::detail::find_lsb(~cnt); + update_quasi(r, "compute_seq"); + } + + void update_quasi(int r, const char* msg) + { + if (r < LatticeT::bit_count) + { + // Calculate the next state. + for (std::size_t i = 0; i != this->dimension(); ++i) + this->quasi_state[i] ^= this->lattice(r, i); + } + else + { + boost::throw_exception( std::overflow_error(msg) ); + } + } +}; + +}} // namespace detail::random + +} // namespace boost + +#endif // BOOST_RANDOM_DETAIL_GRAY_CODED_QRNG_BASE_HPP diff --git a/include/boost/random/detail/qrng_base.hpp b/include/boost/random/detail/qrng_base.hpp new file mode 100644 index 0000000..cbf5ded --- /dev/null +++ b/include/boost/random/detail/qrng_base.hpp @@ -0,0 +1,203 @@ +/* boost random/detail/quasi_random_number_generator_base.hpp header file + * + * Copyright Justinas Vygintas Daugmaudis 2010-2017 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_RANDOM_DETAIL_QRNG_BASE_HPP +#define BOOST_RANDOM_DETAIL_QRNG_BASE_HPP + +#include +#include + +#include +#include + +#include + +#include + +//!\file +//!Describes the quasi-random number generator base class template. + +namespace boost { +namespace random { + +namespace detail { + +template +class qrng_base +{ +public: + typedef typename LatticeT::value_type result_type; + + explicit qrng_base(std::size_t dimension) + // Guard against invalid dimensions before creating the lattice + : lattice(prevent_zero_dimension(dimension)) + , quasi_state(dimension) + { + derived().seed(); + } + + // default copy c-tor is fine + + // default assignment operator is fine + + //!Returns: The dimension of of the quasi-random domain. + //! + //!Throws: nothing. + std::size_t dimension() const { return quasi_state.size(); } + + //!Requirements: *this is mutable. + //! + //!Returns: Returns a successive element of an s-dimensional + //!(s = X::dimension()) vector at each invocation. When all elements are + //!exhausted, X::operator() begins anew with the starting element of a + //!subsequent s-dimensional vector. + //! + //!Throws: overflow_error. + result_type operator()() + { + return curr_elem != dimension() ? load_cached(): next_state(); + } + + //!Fills a range with quasi-random values. + template void generate(Iter first, Iter last) + { + for (; first != last; ++first) + *first = this->operator()(); + } + + //!Requirements: *this is mutable. + //! + //!Effects: Advances *this state as if z consecutive + //!X::operator() invocations were executed. + //! + //!Throws: overflow_error. + void discard(std::size_t z) + { + const std::size_t dimension_value = dimension(); + + std::size_t vec_n = z / dimension_value; + std::size_t elem_n = z - vec_n * dimension_value; // z % Dimension + std::size_t vec_offset = vec_n + (curr_elem + elem_n) / dimension_value; + // Discards vec_offset consecutive s-dimensional vectors + discard_vector(vec_offset); + // Sets up the proper position of the element-to-read + curr_elem += (z - dimension_value * vec_offset); + } + + //!Writes a @c DerivedT to a @c std::ostream. + BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, DerivedT, s) + { + os << s.dimension() << " " << s.seq_count << " " << s.curr_elem; + return os; + } + + //!Reads a @c DerivedT from a @c std::istream. + BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, DerivedT, s) + { + std::size_t dim, seed, z; + if (is >> dim >> std::ws >> seed >> std::ws >> z) // initialize iff success! + { + if (s.dimension() != dim) + { + prevent_zero_dimension(dim); + s.lattice.resize(dim); + s.quasi_state.resize(dim); + } + // Fast-forward to the correct state + s.seed(seed); + s.discard(z); + } + return is; + } + + //!Returns true if the two generators will produce identical sequences. + BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(DerivedT, x, y) + { + const std::size_t dimension_value = x.dimension(); + + // Note that two generators with different seq_counts and curr_elems can + // produce the same sequence because the generator triple + // (D, S, D) is equivalent to (D, S + 1, 0), where D is dimension, S -- seq_count, + // and the last one is curr_elem. + + return (dimension_value == y.dimension()) && + (x.seq_count + (x.curr_elem / dimension_value) == y.seq_count + (y.curr_elem / dimension_value)) && + (x.curr_elem % dimension_value == y.curr_elem % dimension_value); + } + + //!Returns true if the two generators will produce different sequences, + BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(DerivedT) + +protected: + DerivedT& derived() throw() + { + return *static_cast(this); + } + + void reset_state() + { + curr_elem = 0; + seq_count = 0; + std::fill(quasi_state.begin(), quasi_state.end(), result_type /*zero*/()); + } + +private: + inline static std::size_t prevent_zero_dimension(std::size_t dimension) + { + if (dimension == 0) + boost::throw_exception( std::invalid_argument("qrng_base: zero dimension") ); + return dimension; + } + + // Load the result from the saved state. + result_type load_cached() + { + return quasi_state[curr_elem++]; + } + + result_type next_state() + { + derived().compute_next(); + + curr_elem = 0; + return load_cached(); + } + + // Discards z consecutive s-dimensional vectors, + // and preserves the position of the element-to-read + void discard_vector(std::size_t z) + { + std::size_t inc_seq_count = seq_count + z; + // Here we check that no overflow occurs before we + // begin seeding the new value + if (inc_seq_count > seq_count) + { + std::size_t tmp = curr_elem; + + derived().seed(inc_seq_count); + + curr_elem = tmp; + } + else if (inc_seq_count < seq_count) // Increment overflowed? + { + boost::throw_exception( std::overflow_error("discard_vector") ); + } + } + +protected: + LatticeT lattice; + std::size_t curr_elem; + std::size_t seq_count; + std::vector quasi_state; +}; + +}} // namespace detail::random + +} // namespace boost + +#endif // BOOST_RANDOM_DETAIL_QRNG_BASE_HPP diff --git a/include/boost/random/faure.hpp b/include/boost/random/faure.hpp new file mode 100644 index 0000000..a923063 --- /dev/null +++ b/include/boost/random/faure.hpp @@ -0,0 +1,367 @@ +/* boost random/faure.hpp header file + * + * Copyright Justinas Vygintas Daugmaudis 2010-2017 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_RANDOM_FAURE_HPP +#define BOOST_RANDOM_FAURE_HPP + +#include + +#include +#include + +#include + +#include + +#include + +//!\file +//!Describes the quasi-random number generator class template faure. + +namespace boost { +namespace random { + +/** @cond */ +namespace detail { +namespace fr { + +// There is no particular reason why 187 first primes were chosen +// to be put into this table. The only reason was, perhaps, that +// the number of dimensions for Faure generator would be around +// the same number as the number of dimensions supported by the +// Sobol qrng. +struct prime_table +{ + typedef unsigned short value_type; + + BOOST_STATIC_CONSTANT(int, number_of_primes = 187); + + // A function that returns lower bound prime for a given n + static value_type lower_bound(std::size_t n) + { + static const value_type prim_a[number_of_primes] = { + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, + 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, + 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, + 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, + 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, + 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, + 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, + 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, + 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, + 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, + 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, + 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, + 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, + 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, + 1097, 1103, 1109, 1117 }; + + if (n > prim_a[number_of_primes - 1]) + { + std::ostringstream os; + os << "The Faure quasi-random number generator only supports up to " + << prim_a[number_of_primes - 1] << " dimensions."; + throw std::invalid_argument(os.str()); + } + + return *std::lower_bound(prim_a, prim_a + number_of_primes, n); + } +}; + +// Returns the integer part of the logarithm base Base of arg. +// In erroneous situations, e.g., integer_log(base, 0) the function +// returns 0 and does not report the error. This is the intended +// behavior. +inline std::size_t integer_log(std::size_t base, std::size_t arg) +{ + std::size_t ilog = 0; + while( base <= arg ) + { + arg /= base; ++ilog; + } + return ilog; +} + +// Perform exponentiation by squaring +inline std::size_t integer_pow(std::size_t base, std::size_t exp) +{ + std::size_t result = 1; + while (exp) + { + if (exp & 1) + result *= base; + exp >>= 1; + base *= base; + } + return result; +} + +// Computes a table of binomial coefficients modulo qs. +template +struct binomial_coefficients +{ + typedef RealType value_type; + + // Binomial values modulo qs_base will never be bigger than qs_base. + // We can choose an appropriate integer type to hold modulo values and + // shave off memory footprint. + typedef prime_table::value_type packed_uint_t; + + // default copy c-tor is fine + + explicit binomial_coefficients(std::size_t dimension) + { + resize(dimension); + } + + void resize(std::size_t dimension) + { + qs_base = fr::prime_table::lower_bound(dimension); + inv_qs_base = static_cast(1) / static_cast(qs_base); + + // Throw away previously computed coefficients. + // This will trigger recomputation on next update + coeff.clear(); + } + + void update(std::size_t seq, std::vector& quasi) + { + if (!quasi.empty()) + { + const std::size_t hisum = n_elements(seq); + if( coeff.size() != size_hint(hisum) ) + recompute_tables(hisum); + + typename std::vector::iterator it = quasi.begin(); + + *it = compute_recip(seq, hisum, ytemp.rbegin()); + + // Find other components using the Faure method. + ++it; + for ( ; it != quasi.end(); ++it) + { + *it = RealType(); + RealType r = inv_qs_base; + + for (std::size_t i = 0; i != hisum; ++i) + { + RealType ztemp = RealType(); + for (std::size_t j = i; j != hisum; ++j) + ztemp += ytemp[j] * upper_element(i, j, hisum); + + // Sum ( J <= I <= HISUM ) ( old ytemp(i) * binom(i,j) ) mod QS. + ytemp[i] = std::fmod(ztemp, static_cast(qs_base)); + *it += ytemp[i] * r; + r *= inv_qs_base; + } + } + } + } + +private: + inline std::size_t n_elements(std::size_t seq) const + { + return integer_log(qs_base, seq) + 1; + } + + inline static std::size_t size_hint(std::size_t n) + { + return n * (n + 1) / 2; + } + + packed_uint_t& upper_element(std::size_t i, std::size_t j, std::size_t dim) + { + BOOST_ASSERT( i < dim ); + BOOST_ASSERT( j < dim ); + BOOST_ASSERT( i <= j ); + return coeff[(i * (2 * dim - i + 1)) / 2 + j - i]; + } + + template + RealType compute_recip(std::size_t seq, std::size_t n, Iterator out) const + { + // Here we do + // Sum ( 0 <= J <= HISUM ) YTEMP(J) * QS**J + // Sum ( 0 <= J <= HISUM ) YTEMP(J) / QS**(J+1) + // in one go + RealType r = RealType(); + std::size_t m, k = integer_pow(qs_base, n - 1); + for( ; n != 0; --n, ++out, seq = m, k /= qs_base ) + { + m = seq % k; + RealType v = (seq - m) / k; // RealType <- IntType + r += v; + r *= inv_qs_base; + *out = v; // saves double dereference + } + return r; + } + + void compute_coefficients(const std::size_t n) + { + // Resize and initialize to zero + coeff.resize(size_hint(n)); + std::fill(coeff.begin(), coeff.end(), packed_uint_t()); + + // The first row and the diagonal is assigned to 1 + upper_element(0, 0, n) = 1; + for (std::size_t i = 1; i < n; ++i) + { + upper_element(0, i, n) = 1; + upper_element(i, i, n) = 1; + } + + // Computes binomial coefficients MOD qs_base + for (std::size_t i = 1; i < n; ++i) + { + for (std::size_t j = i + 1; j < n; ++j) + { + upper_element(i, j, n) = ( upper_element(i, j-1, n) + + upper_element(i-1, j-1, n) ) % qs_base; + } + } + } + + void recompute_tables(std::size_t n) + { + ytemp.resize(n); + compute_coefficients(n); + } + +private: + packed_uint_t qs_base; + RealType inv_qs_base; + + // here we cache precomputed data; note that binomial coefficients have + // to be recomputed iff the integer part of the logarithm of seq changes, + // which happens relatively rarely. + std::vector coeff; // packed upper (!) triangular matrix + std::vector ytemp; +}; + +}} // namespace detail::fr +/** @endcond */ + +//!class template faure implements a quasi-random number generator as described in +//! \blockquote +//!Henri Faure, +//!Discrepance de suites associees a un systeme de numeration (en dimension s), +//!Acta Arithmetica, +//!Volume 41, 1982, pages 337-351. +//! \endblockquote +// +//! \blockquote +//!Bennett Fox, +//!Algorithm 647: +//!Implementation and Relative Efficiency of Quasirandom +//!Sequence Generators, +//!ACM Transactions on Mathematical Software, +//!Volume 12, Number 4, December 1986, pages 362-376. +//! \endblockquote +//! +//!\attention\b Important: This implementation supports up to 229 dimensions. +//! +//!In the following documentation @c X denotes the concrete class of the template +//!faure returning objects of type @c RealType, u and v are the values of @c X. +//! +//!Some member functions may throw exceptions of type @c std::bad_alloc. +//! +//! \copydoc friendfunctions +template +class faure : public detail::qrng_base< + faure + , detail::fr::binomial_coefficients + > +{ + typedef faure self_t; + + typedef detail::fr::binomial_coefficients lattice_t; + typedef detail::qrng_base base_t; + + friend class detail::qrng_base; + +public: + typedef RealType result_type; + + /** @copydoc boost::random::niederreiter_base2::min() */ + static result_type min /** @cond */ BOOST_PREVENT_MACRO_SUBSTITUTION /** @endcond */ () { return static_cast(0); } + + /** @copydoc boost::random::niederreiter_base2::max() */ + static result_type max /** @cond */ BOOST_PREVENT_MACRO_SUBSTITUTION /** @endcond */ () { return static_cast(1); } + + //!Effects: Constructs the s-dimensional default Faure quasi-random number generator. + //! + //!Throws: bad_alloc, invalid_argument. + explicit faure(std::size_t s) + : base_t(s) // initialize the binomial table here + {} + + /** @copydetails boost::random::niederreiter_base2::seed() + * Throws: bad_alloc. + */ + void seed() + { + seed(0); + } + + /** @copydetails boost::random::niederreiter_base2::seed(std::size_t) + * Throws: bad_alloc. + */ + void seed(std::size_t init) + { + compute_seq(init); + this->curr_elem = 0; + this->seq_count = init; + } + + //=========================Doxygen needs this!============================== + + //!Requirements: *this is mutable. + //! + //!Returns: Returns a successive element of an s-dimensional + //!(s = X::dimension()) vector at each invocation. When all elements are + //!exhausted, X::operator() begins anew with the starting element of a + //!subsequent s-dimensional vector. + //! + //!Throws: bad_alloc. + + // Fixed in Doxygen 1.7.0 -- id 612458: Fixed problem handling @copydoc for function operators. + result_type operator()() + { + return base_t::operator()(); + } + + /** @copydoc boost::random::niederreiter_base2::discard(std::size_t) + * Throws: bad_alloc. + */ + void discard(std::size_t z) + { + base_t::discard(z); + } + +private: +/** @cond hide_private_members */ + void compute_seq(std::size_t seq) + { + this->lattice.update(seq, this->quasi_state); + } + void compute_next() + { + compute_seq(++this->seq_count); + } +/** @endcond */ +}; + +} // namespace random + +typedef random::faure faure; + +} // namespace boost + +#endif // BOOST_RANDOM_FAURE_HPP diff --git a/include/boost/random/niederreiter_base2.hpp b/include/boost/random/niederreiter_base2.hpp new file mode 100644 index 0000000..4e19d07 --- /dev/null +++ b/include/boost/random/niederreiter_base2.hpp @@ -0,0 +1,389 @@ +/* boost random/nierderreiter_base2.hpp header file + * + * Copyright Justinas Vygintas Daugmaudis 2010-2017 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_RANDOM_NIEDERREITER_BASE2_HPP +#define BOOST_RANDOM_NIEDERREITER_BASE2_HPP + +#include +#include +#include + +#include +#include + +#include +#include + +//!\file +//!Describes the quasi-random number generator class template niederreiter_base2. +//! +//!\b Note: it is especially useful in conjunction with class template uniform_real. + +namespace boost { +namespace random { + +/** @cond */ +namespace detail { +namespace nb2 { + +/* + Primitive polynomials in binary encoding + { + { 1, 0, 0, 0, 0, 0 }, 1 + { 0, 1, 0, 0, 0, 0 }, x + { 1, 1, 0, 0, 0, 0 }, 1 + x + { 1, 1, 1, 0, 0, 0 }, 1 + x + x^2 + { 1, 1, 0, 1, 0, 0 }, 1 + x + x^3 + { 1, 0, 1, 1, 0, 0 }, 1 + x^2 + x^3 + { 1, 1, 0, 0, 1, 0 }, 1 + x + x^4 + { 1, 0, 0, 1, 1, 0 }, 1 + x^3 + x^4 + { 1, 1, 1, 1, 1, 0 }, 1 + x + x^2 + x^3 + x^4 + { 1, 0, 1, 0, 0, 1 }, 1 + x^2 + x^5 + { 1, 0, 0, 1, 0, 1 }, 1 + x^3 + x^5 + { 1, 1, 1, 1, 0, 1 }, 1 + x + x^2 + x^3 + x^5 + { 1, 1, 1, 0, 1, 1 } 1 + x + x^2 + x^4 + x^5 + }; +*/ + +// Maximum allowed space dimension +#define BOOST_RANDOM_NIEDERREITER_BASE2_MAX_DIMENSION 54 + +struct niederreiter_tables +{ + BOOST_STATIC_CONSTANT(int, max_dimension = BOOST_RANDOM_NIEDERREITER_BASE2_MAX_DIMENSION); + + // Binary irreducible polynomials (primes in the ring GF(2)[X]), evaluated at X=2. + static unsigned short polynomial(std::size_t n) + { + static const unsigned short nb2_a[max_dimension] = { + 2, 3, 7, 11, 13, 19, 25, 31, 37, 41, + 47, 55, 59, 61, 67, 73, 87, 91, 97, 103, + 109, 115, 117, 131, 137, 143, 145, 157, + 167, 171, 185, 191, 193, 203, 211, 213, + 229, 239, 241, 247, 253, 283, 285, 299, + 301, 313, 319, 333, 351, 355, 357, 361, 369, + 375 + }; + + return nb2_a[n]; + } +}; + +// Return the base 2 logarithm for a given bitset v +template +inline typename boost::dynamic_bitset::size_type +bitset_log2(const boost::dynamic_bitset& v) +{ + typedef boost::dynamic_bitset bitset_t; + typedef typename bitset_t::size_type size_type; + + if (v.none()) + throw std::invalid_argument("bitset_log2"); + + size_type up = v.size() - 1; + size_type low = v.find_next(0); + + // Binary lookup for the most significant set bit + while (low < up) + { + size_type m = low + (up - low) / 2; + + // Check if any bit is present after mid + size_type p = v.find_next(m); + if (p != bitset_t::npos) + low = p; + else + up = m; + } + + return low; +} + + +// Multiply polynomials over Z_2. +template +inline boost::dynamic_bitset +modulo2_multiply(int P, boost::dynamic_bitset v) +{ + boost::dynamic_bitset pt (v.size()); + for (; P; P >>= 1, v <<= 1) + if (P & 1) pt ^= v; + return pt; +} + + +// Calculate the values of the constants V(J,R) as +// described in BFN section 3.3. +// +// px = appropriate irreducible polynomial for current dimension +// pb = polynomial defined in section 2.3 of BFN. +// pb is modified +template +inline void calculate_v(const boost::dynamic_bitset& pb, + int& pb_degree, std::vector& v) +{ + const T arbitrary_element = static_cast(1); // arbitray element of Z_2 + + // Now choose a value of Kj as defined in section 3.3. + // We must have 0 <= Kj < E*J = M. + // The limit condition on Kj does not seem very relevant + // in this program. + int kj = pb_degree; + + pb_degree = bitset_log2(pb); + + // Now choose values of V in accordance with + // the conditions in section 3.3. + std::fill(v.begin(), v.begin() + kj, T()); + + // Quoting from BFN: "Our program currently sets each K_q + // equal to eq. This has the effect of setting all unrestricted + // values of v to 1." + // Actually, it sets them to the arbitrary chosen value. + // Whatever. + for (int r = kj; r < pb_degree; ++r) + v[r] = arbitrary_element; + + // Calculate the remaining V's using the recursion of section 2.3, + // remembering that the B's have the opposite sign. + for (int r = pb_degree; r < v.size(); ++r) + { + T term = T /*zero*/ (); + boost::dynamic_bitset<> pb_c = pb; + for (int k = -pb_degree; k < 0; ++k, pb_c >>= 1) + { + if( pb_c.test(0) ) + term ^= v[r + k]; + } + v[r] = term; + } +} + +} // namespace nb2 + +template +struct niederreiter_base2_lattice +{ + typedef IntType value_type; + + BOOST_STATIC_CONSTANT(int, bit_count = std::numeric_limits::digits); + + explicit niederreiter_base2_lattice(std::size_t dimension) + { + resize(dimension); + } + + void resize(std::size_t dimension) + { + if (dimension > nb2::niederreiter_tables::max_dimension) + { + throw std::invalid_argument("The Niederreiter base 2 quasi-random number generator only supports up to " + BOOST_PP_STRINGIZE(BOOST_RANDOM_NIEDERREITER_BASE2_MAX_DIMENSION) " dimensions."); + } + + // Initialize the bit array + bits.resize(boost::extents[bit_count][dimension]); + + // Reserve temporary space for lattice computation + boost::multi_array ci(boost::extents[bit_count][bit_count]); + + std::vector v; + + // Compute Niedderreiter base 2 lattice + for (std::size_t dim = 0; dim != dimension; ++dim) + { + const int poly = nb2::niederreiter_tables::polynomial(dim); + if (static_cast(poly) > + static_cast(std::numeric_limits::max())) { + boost::throw_exception( std::range_error("niederreiter_base2: polynomial value outside the given IntType range") ); + } + + const int degree = multiprecision::detail::find_msb(poly); // integer log2(poly) + const int max_degree = degree * ((bit_count / degree) + 1); + + v.resize(degree + max_degree); + + // For each dimension, we need to calculate powers of an + // appropriate irreducible polynomial, see Niederreiter + // page 65, just below equation (19). + // Copy the appropriate irreducible polynomial into PX, + // and its degree into E. Set polynomial B = PX ** 0 = 1. + // M is the degree of B. Subsequently B will hold higher + // powers of PX. + int pb_degree = 0; + boost::dynamic_bitset<> pb(max_degree, 1); + + int j = 0; + while (j < bit_count) + { + // Now multiply B by PX so B becomes PX**J. + // In section 2.3, the values of Bi are defined with a minus sign : + // don't forget this if you use them later! + nb2::modulo2_multiply(poly, boost::move(pb)).swap(pb); + + // If U = 0, we need to set B to the next power of PX + // and recalculate V. + nb2::calculate_v(pb, pb_degree, v); + + // Niederreiter (page 56, after equation (7), defines two + // variables Q and U. We do not need Q explicitly, but we + // do need U. + + // Advance Niederreiter's state variables. + for (int u = 0; u < degree && j < bit_count; ++u, ++j) + { + // Now C is obtained from V. Niederreiter + // obtains A from V (page 65, near the bottom), and then gets + // C from A (page 56, equation (7)). However this can be done + // in one step. Here CI(J,R) corresponds to + // Niederreiter's C(I,J,R). + for (int r = 0; r < bit_count; ++r) { + ci[r][j] = v[r + u]; + } + } + } + + // The array CI now holds the values of C(I,J,R) for this value + // of I. We pack them into array CJ so that CJ(I,R) holds all + // the values of C(I,J,R) for J from 1 to NBITS. + for (int r = 0; r < bit_count; ++r) + { + IntType term = 0; + for (int j = 0; j < bit_count; ++j) + term = 2*term + ci[r][j]; + bits[r][dim] = term; + } + } + } + + value_type operator()(int i, int j) const + { + return bits[i][j]; + } + +private: + boost::multi_array bits; +}; + +} // namespace detail +/** @endcond */ + +//!class template niederreiter_base2 implements a quasi-random number generator as described in +//! \blockquote +//!Bratley, Fox, Niederreiter, ACM Trans. Model. Comp. Sim. 2, 195 (1992). +//! \endblockquote +//! +//!\attention \b Important: This implementation supports up to 20 dimensions. +//! +//!In the following documentation @c X denotes the concrete class of the template +//!niederreiter_base2 returning objects of type @c IntType, u and v are the values of @c X. +//! +//!Some member functions may throw exceptions of type std::overflow_error. This +//!happens when the quasi-random domain is exhausted and the generator cannot produce +//!any more values. The length of the low discrepancy sequence is given by +//! \f$L=Dimension \times 2^{digits}\f$, where digits = std::numeric_limits::digits. +template +class niederreiter_base2 : public detail::gray_coded_qrng_base< + niederreiter_base2, + detail::niederreiter_base2_lattice > +{ + typedef niederreiter_base2 self_t; + typedef detail::niederreiter_base2_lattice lattice_t; + typedef detail::gray_coded_qrng_base base_t; + +public: + typedef IntType result_type; + + //!Returns: Tight lower bound on the set of values returned by operator(). + //! + //!Throws: nothing. + static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; } + + //!Returns: Tight upper bound on the set of values returned by operator(). + //! + //!Throws: nothing. + static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return std::numeric_limits::max(); } + + //!Effects: Constructs the default s-dimensional Niederreiter base 2 quasi-random number generator. + //! + //!Throws: bad_alloc, invalid_argument, range_error. + explicit niederreiter_base2(std::size_t s) + : base_t(s) // initialize lattice here + {} + + //!Requirements: *this is mutable. + //! + //!Effects: Resets the quasi-random number generator state to + //!the one given by the default construction. Equivalent to u.seed(0). + //! + //!\brief Throws: nothing. + void seed() + { + base_t::reset_state(); + } + + //!Requirements: *this is mutable. + //! + //!Effects: Effectively sets the quasi-random number generator state to the init-th + //!vector in the s-dimensional quasi-random domain, where s == X::dimension(). + //!\code + //!X u, v; + //!for(int i = 0; i < N; ++i) + //! for( std::size_t j = 0; j < u.dimension(); ++j ) + //! u(); + //!v.seed(N); + //!assert(u() == v()); + //!\endcode + //! + //!\brief Throws: overflow_error. + void seed(std::size_t init) + { + base_t::seed(init, "niederreiter_base2::seed"); + } + + //=========================Doxygen needs this!============================== + + //!Requirements: *this is mutable. + //! + //!Returns: Returns a successive element of an s-dimensional + //!(s = X::dimension()) vector at each invocation. When all elements are + //!exhausted, X::operator() begins anew with the starting element of a + //!subsequent s-dimensional vector. + //! + //!Throws: overflow_error. + result_type operator()() + { + return base_t::operator()(); + } + + //!Requirements: *this is mutable. + //! + //!Effects: Advances *this state as if z consecutive + //!X::operator() invocations were executed. + //!\code + //!X u = v; + //!for(int i = 0; i < N; ++i) + //! u(); + //!v.discard(N); + //!assert(u() == v()); + //!\endcode + //! + //!Throws: overflow_error. + void discard(std::size_t z) + { + base_t::discard(z); + } +}; + +} // namespace random + +typedef random::niederreiter_base2 niederreiter_base2; + +} // namespace boost + +#endif // BOOST_RANDOM_NIEDERREITER_BASE2_HPP diff --git a/include/boost/random/sobol.hpp b/include/boost/random/sobol.hpp new file mode 100644 index 0000000..b688a1f --- /dev/null +++ b/include/boost/random/sobol.hpp @@ -0,0 +1,1118 @@ +/* boost random/sobol.hpp header file + * + * Copyright Justinas Vygintas Daugmaudis 2010-2017 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_RANDOM_SOBOL_HPP +#define BOOST_RANDOM_SOBOL_HPP + +#include + +#include + +#include +#include + +#include + +#include + +//!\file +//!Describes the quasi-random number generator class template sobol. +//! +//!\b Note: it is especially useful in conjunction with class template uniform_real. + +namespace boost { +namespace random { + +/** @cond */ +namespace detail { +namespace sbl { + +// Maximum allowed space dimension +#define BOOST_RANDOM_SOBOL_MAX_DIMENSION 1111 + +// Data on the primitive binary polynomials (a) and the corresponding +// starting values m, for Sobol sequences in up to 1111 dimensions, +// taken from: +// P. Bratley and B. L. Fox, Algorithm 659, ACM Trans. +// Math. Soft. 14 (1), 88-100 (1988), +// as modified by: +// S. Joe and F. Y. Kuo, ACM Trans. Math. Soft 29 (1), 49-57 (2003). +struct sobol_tables +{ + BOOST_STATIC_CONSTANT(int, max_dimension = BOOST_RANDOM_SOBOL_MAX_DIMENSION); + BOOST_STATIC_CONSTANT(int, num_polynomials = max_dimension - 1); + + // log2(polynomial(num_polynomials - 1)), i.e., integer log2 of the last polynomial in the table + BOOST_STATIC_CONSTANT(int, max_degree = 13); + + static unsigned short polynomial(std::size_t n) + { + // successive primitive binary-coefficient polynomials p(z) + // = a_0 + a_1 z + a_2 z^2 + ... a_31 z^31, where a_i is the + // i-th bit of sobol_a[j] for the j-th polynomial. + static const unsigned short sobol_a[num_polynomials] = { + 3,7,11,13,19,25,37,59,47,61,55,41,67,97,91, + 109,103,115,131,193,137,145,143,241,157,185,167,229,171,213, + 191,253,203,211,239,247,285,369,299,301,333,351,355,357,361, + 391,397,425,451,463,487,501,529,539,545,557,563,601,607,617, + 623,631,637,647,661,675,677,687,695,701,719,721,731,757,761, + 787,789,799,803,817,827,847,859,865,875,877,883,895,901,911, + 949,953,967,971,973,981,985,995,1001,1019,1033,1051,1063, + 1069,1125,1135,1153,1163,1221,1239,1255,1267,1279,1293,1305, + 1315,1329,1341,1347,1367,1387,1413,1423,1431,1441,1479,1509, + 1527,1531,1555,1557,1573,1591,1603,1615,1627,1657,1663,1673, + 1717,1729,1747,1759,1789,1815,1821,1825,1849,1863,1869,1877, + 1881,1891,1917,1933,1939,1969,2011,2035,2041,2053,2071,2091, + 2093,2119,2147,2149,2161,2171,2189,2197,2207,2217,2225,2255, + 2257,2273,2279,2283,2293,2317,2323,2341,2345,2363,2365,2373, + 2377,2385,2395,2419,2421,2431,2435,2447,2475,2477,2489,2503, + 2521,2533,2551,2561,2567,2579,2581,2601,2633,2657,2669, + 2681,2687,2693,2705,2717,2727,2731,2739, + 2741,2773,2783,2793,2799,2801,2811,2819,2825,2833,2867,2879, + 2881,2891,2905,2911,2917,2927,2941,2951,2955,2963,2965,2991, + 2999,3005,3017,3035,3037,3047,3053,3083,3085,3097,3103,3159, + 3169,3179,3187,3205,3209,3223,3227,3229,3251,3263,3271,3277, + 3283,3285,3299,3305,3319,3331,3343,3357,3367,3373,3393,3399, + 3413,3417,3427,3439,3441,3475,3487,3497,3515,3517,3529,3543, + 3547,3553,3559,3573,3589,3613,3617,3623,3627,3635,3641,3655, + 3659,3669,3679,3697,3707,3709,3713,3731,3743,3747,3771,3791, + 3805,3827,3833,3851,3865,3889,3895,3933,3947,3949,3957,3971, + 3985,3991,3995,4007,4013,4021,4045,4051,4069,4073,4179,4201, + 4219,4221,4249,4305,4331,4359,4383,4387,4411,4431,4439,4449, + 4459,4485,4531,4569,4575,4621,4663,4669,4711,4723,4735,4793, + 4801,4811,4879,4893,4897,4921,4927,4941,4977,5017,5027,5033, + 5127,5169,5175,5199,5213,5223,5237,5287,5293,5331,5391,5405, + 5453,5523,5573,5591,5597,5611,5641,5703,5717,5721,5797,5821, + 5909,5913, + 5955,5957,6005,6025,6061,6067,6079,6081, + 6231,6237,6289,6295,6329,6383,6427,6453,6465,6501,6523,6539, + 6577,6589,6601,6607,6631,6683,6699,6707,6761,6795,6865,6881, + 6901,6923,6931,6943,6999,7057,7079,7103,7105,7123,7173,7185, + 7191,7207,7245,7303,7327,7333,7355,7365,7369,7375,7411,7431, + 7459,7491,7505,7515,7541,7557,7561,7701,7705,7727,7749,7761, + 7783,7795,7823,7907,7953,7963,7975,8049,8089,8123,8125,8137, + 8219,8231,8245,8275,8293,8303,8331,8333,8351,8357,8367,8379, + 8381,8387,8393,8417,8435,8461,8469,8489,8495,8507,8515,8551, + 8555,8569,8585,8599,8605,8639,8641,8647,8653,8671,8675,8689, + 8699,8729,8741,8759,8765,8771,8795,8797,8825,8831,8841,8855, + 8859,8883,8895,8909,8943,8951,8955,8965,8999,9003,9031,9045, + 9049,9071,9073,9085,9095,9101,9109,9123,9129,9137,9143,9147, + 9185,9197,9209,9227,9235,9247,9253,9257,9277,9297,9303,9313, + 9325,9343,9347,9371,9373,9397,9407,9409,9415,9419,9443,9481, + 9495,9501,9505,9517,9529,9555,9557,9571,9585,9591,9607,9611, + 9621,9625, + 9631,9647,9661,9669,9679,9687,9707,9731, + 9733,9745,9773,9791,9803,9811,9817,9833,9847,9851,9863,9875, + 9881,9905,9911,9917,9923,9963,9973,10003,10025,10043,10063, + 10071,10077,10091,10099,10105,10115,10129,10145,10169,10183, + 10187,10207,10223,10225,10247,10265,10271,10275,10289,10299, + 10301,10309,10343,10357,10373,10411,10413,10431,10445,10453, + 10463,10467,10473,10491,10505,10511,10513,10523,10539,10549, + 10559,10561,10571,10581,10615,10621,10625,10643,10655,10671, + 10679,10685,10691,10711,10739,10741,10755,10767,10781,10785, + 10803,10805,10829,10857,10863,10865,10875,10877,10917,10921, + 10929,10949,10967,10971,10987,10995,11009,11029,11043,11045, + 11055,11063,11075,11081,11117,11135,11141,11159,11163,11181, + 11187,11225,11237,11261,11279,11297,11307,11309,11327,11329, + 11341,11377,11403,11405,11413,11427,11439,11453,11461,11473, + 11479,11489,11495,11499,11533,11545,11561,11567,11575,11579, + 11589,11611,11623,11637,11657,11663,11687,11691,11701,11747, + 11761,11773,11783,11795,11797,11817,11849,11855,11867,11869, + 11873,11883,11919, + 11921,11927,11933,11947,11955,11961, + 11999,12027,12029,12037,12041,12049,12055,12095,12097,12107, + 12109,12121,12127,12133,12137,12181,12197,12207,12209,12239, + 12253,12263,12269,12277,12287,12295,12309,12313,12335,12361, + 12367,12391,12409,12415,12433,12449,12469,12479,12481,12499, + 12505,12517,12527,12549,12559,12597,12615,12621,12639,12643, + 12657,12667,12707,12713,12727,12741,12745,12763,12769,12779, + 12781,12787,12799,12809,12815,12829,12839,12857,12875,12883, + 12889,12901,12929,12947,12953,12959,12969,12983,12987,12995, + 13015,13019,13031,13063,13077,13103,13137,13149,13173,13207, + 13211,13227,13241,13249,13255,13269,13283,13285,13303,13307, + 13321,13339,13351,13377,13389,13407,13417,13431,13435,13447, + 13459,13465,13477,13501,13513,13531,13543,13561,13581,13599, + 13605,13617,13623,13637,13647,13661,13677,13683,13695,13725, + 13729,13753,13773,13781,13785,13795,13801,13807,13825,13835, + 13855,13861,13871,13883,13897,13905,13915,13939,13941,13969, + 13979,13981,13997,14027,14035,14037,14051,14063,14085,14095, + 14107,14113,14125,14137,14145, + 14151,14163,14193,14199,14219,14229, + 14233,14243,14277,14287,14289,14295,14301,14305,14323,14339, + 14341,14359,14365,14375,14387,14411,14425,14441,14449,14499, + 14513,14523,14537,14543,14561,14579,14585,14593,14599,14603, + 14611,14641,14671,14695,14701,14723,14725,14743,14753,14759, + 14765,14795,14797,14803,14831,14839,14845,14855,14889,14895, + 14909,14929,14941,14945,14951,14963,14965,14985,15033,15039, + 15053,15059,15061,15071,15077,15081,15099,15121,15147,15149, + 15157,15167,15187,15193,15203,15205,15215,15217,15223,15243, + 15257,15269,15273,15287,15291,15313,15335,15347,15359,15373, + 15379,15381,15391,15395,15397,15419,15439,15453,15469,15491, + 15503,15517,15527,15531,15545,15559,15593,15611,15613,15619, + 15639,15643,15649,15661,15667,15669,15681,15693,15717,15721, + 15741,15745,15765,15793,15799,15811,15825,15835,15847,15851, + 15865,15877,15881,15887,15899,15915,15935,15937,15955,15973, + 15977,16011,16035,16061,16069,16087,16093,16097,16121,16141, + 16153,16159,16165,16183,16189,16195,16197,16201,16209,16215, + 16225,16259,16265,16273,16299, + 16309,16355,16375,16381, + }; + + return sobol_a[n]; + } + + static unsigned short vinit(std::size_t degree, std::size_t dim) + { + // starting direction #'s m[i] = sobol_minit[i][j] for i=0..d of the + // degree-d primitive polynomial sobol_a[j]. + static const unsigned short sobol_minit[max_degree][num_polynomials] = { + /* [0][*] */ + { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1 }, + /* [1][*] */ + { 0, + 1,3,1,3,1,3,3,1,3,1,3,1,3,1,1,3,1,3,1,3, + 1,3,3,1,1,1,3,1,3,1,3,3,1,3,1,1,1,3,1,3,1,1,1,3,3,1,3,3,1,1, + 3,3,1,3,3,3,1,3,1,3,1,1,3,3,1,1,1,1,3,1,1,3,1,1,1,3,3,1,3,3, + 1,3,3,3,1,3,3,3,1,3,3,1,3,3,3,1,3,1,3,1,1,3,3,1,3,3,1,1,1,3, + 3,1,3,3,1,3,1,1,3,3,3,1,1,1,3,1,1,3,1,1,3,3,1,3,1,3,3,3,3,1, + 1,1,3,3,1,1,3,1,1,1,1,1,1,3,1,3,1,1,1,3,1,3,1,3,3,3,1,1,3,3, + 1,3,1,3,1,1,3,1,3,1,3,1,3,1,1,1,3,3,1,3,3,1,3,1,1,1,3,1,3,1, + 1,3,1,1,3,3,1,1,3,3,3,1,3,3,3,1,3,1,3,1,1,1,3,1,1,1,3,1,1,1, + 1,1,3,3,3,1,1,1,1,3,3,3,1,3,3,1,1,1,1,3,1,1,3,1,3,3,1,1,3,3, + 1,1,1,1,3,1,3,3,1,3,3,1,1,1,3,3,3,1,3,3,1,3,3,1,3,1,3,3,3,1, + 3,1,1,3,1,3,1,1,1,3,3,3,1,1,3,1,3,1,1,1,1,1,1,3,1,1,3,1,3,3, + 1,1,1,1,3,1,3,1,3,1,1,1,1,3,3,1,1,1,1,1,3,3,3,1,1,3,3,3,3,3, + 1,3,3,1,3,3,3,3,1,1,1,1,1,1,3,1,1,3,1,1,1,3,1,1,1,3,3,3,1,3, + 1,1,3,3,3,1,3,3,1,3,1,3,3,1,3,3,3,1,1, + 3,3,1,3,1,3,1,1,1,3,3,3,3,1,3,1,1,3,1, + 3,1,1,1,3,1,3,1,3,1,3,3,3,3,3,3,3,3,1,3,3,3,3,3,1,3,1,3,3,3, + 1,3,1,3,1,3,3,1,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,3,3,1,1,3,3,1, + 1,1,3,3,1,1,3,3,3,3,1,1,3,1,3,3,1,3,3,1,1,1,3,3,3,1,1,3,3,3, + 3,3,1,1,1,3,1,3,3,1,3,3,3,3,1,1,3,1,1,3,1,3,1,3,1,3,3,1,1,3, + 3,1,3,3,1,3,3,1,1,3,1,3,3,1,1,3,1,3,1,3,1,1,3,3,1,1,1,3,3,1, + 3,1,1,3,3,1,1,3,1,3,1,1,1,1,1,3,1,1,1,1,3,1,3,1,1,3,3,1,1,3, + 1,3,1,3,3,3,1,3,3,3,1,1,3,3,3,1,1,1,1,3,1,3,1,3,1,1,3,3,1,1, + 1,3,3,1,3,1,3,1,1,1,1,1,1,3,1,3,3,1,3,3,3,1,3,1,1,3,3,1,1,3, + 3,1,1,1,3,1,3,3,1,1,3,1,1,3,1,3,1,1,1,3,3,3,3,1,1,3,3,1,1,1, + 1,3,1,1,3,3,3,1,1,3,3,1,3,3,1,1,3,3,3,3,3,3,3,1,3,3,1,3,1,3, + 1,1,3,3,1,1,1,3,1,3,3,1,3,3,1,3,1,1,3,3,3,1,1,1,3,1,1,1,3,3, + 3,1,3,3,1,3,1,1,3,3,3,1,3,3,1,1,1,3,1,3,3,3,3,3,3,3,3,1,3,3, + 1,3,1,1,3,3,3,1,3,3,3,3,3,1,3,3,3,1,1,1, + 3,3,1,3,3,1,3,1,3,1,3,1,3,3,3,3,3,3, + 1,1,3,1,3,1,1,1,1,1,3,1,1,1,3,1,3,1,1,3,3,3,1,3,1,3,1,1,3,1, + 3,3,1,3,1,3,3,1,3,3,1,3,3,3,3,3,3,1,3,1,1,3,3,3,1,1,3,3,3,3, + 3,3,3,1,3,3,3,3,1,3,1,3,3,3,1,3,1,3,1,1,1,3,3,1,3,1,1,3,3,1, + 3,1,1,1,1,3,1,3,1,1,3,1,3,1,3,3,3,3,3,3,1,3,3,3,3,1,3,3,1,3, + 3,3,3,3,1,1,1,1,3,3,3,1,3,3,1,1,3,3,1,1,3,3,1,3,1,1,3,1,3,3, + 3,3,3,1,3,1,1,3,3,3,3,1,3,1,1,3,3,3,3,3,3,1,1,3,1,3,1,1,3,1, + 1,1,1,3,3,1,1,3,1,1,1,3,1,3,1,1,3,3,1,3,1,1,3,3,3,3,3,1,3,1, + 1,1,3,1,1,1,3,1,1,3,1,3,3,3,3,3,1,1,1,3,3,3,3,1,3,3,3,3,1,1, + 3,3,3,1,3,1,1,3,3,1,3,3,1,1,1,1,1,3,1,1,3,3,1,1,1,3,1,1,3,3, + 1,3,3,3,3,3,3,3,3,1,1,3,3,1,1,3,1,3,3,3,3,3,1}, + /* [2][*] */ + { 0,0, + 7,5,1,3,3,7,5,5,7,7,1,3,3,7,5,1,1,5,3,7, + 1,7,5,1,3,7,7,1,1,1,5,7,7,5,1,3,3,7,5,5,5,3,3,3,1,1,5,1,1,5, + 3,3,3,3,1,3,7,5,7,3,7,1,3,3,5,1,3,5,5,7,7,7,1,1,3,3,1,1,5,1, + 5,7,5,1,7,5,3,3,1,5,7,1,7,5,1,7,3,1,7,1,7,3,3,5,7,3,3,5,1,3, + 3,1,3,5,1,3,3,3,7,1,1,7,3,1,3,7,5,5,7,5,5,3,1,3,3,3,1,3,3,7, + 3,3,1,7,5,1,7,7,5,7,5,1,3,1,7,3,7,3,5,7,3,1,3,3,3,1,5,7,3,3, + 7,7,7,5,3,1,7,1,3,7,5,3,3,3,7,1,1,3,1,5,7,1,3,5,3,5,3,3,7,5, + 5,3,3,1,3,7,7,7,1,5,7,1,3,1,1,7,1,3,1,7,1,5,3,5,3,1,1,5,5,3, + 3,5,7,1,5,3,7,7,3,5,3,3,1,7,3,1,3,5,7,1,3,7,1,5,1,3,1,5,3,1, + 7,1,5,5,5,3,7,1,1,7,3,1,1,7,5,7,5,7,7,3,7,1,3,7,7,3,5,1,1,7, + 1,5,5,5,1,5,1,7,5,5,7,1,1,7,1,7,7,1,1,3,3,3,7,7,5,3,7,3,1,3, + 7,5,3,3,5,7,1,1,5,5,7,7,1,1,1,1,5,5,5,7,5,7,1,1,3,5,1,3,3,7, + 3,7,5,3,5,3,1,7,1,7,7,1,1,7,7,7,5,5,1,1,7,5,5,7,5,1,1,5,5,5, + 5,5,5,1,3,1,5,7,3,3,5,7,3,7,1,7,7,1,3, + 5,1,5,5,3,7,3,7,7,5,7,5,7,1,1,5,3,5,1, + 5,3,7,1,5,7,7,3,5,1,3,5,1,5,3,3,3,7,3,5,1,3,7,7,3,7,5,3,3,1, + 7,5,1,1,3,7,1,7,1,7,3,7,3,5,7,3,5,3,1,1,1,5,7,7,3,3,1,1,1,5, + 5,7,3,1,1,3,3,7,3,3,5,1,3,7,3,3,7,3,5,7,5,7,7,3,3,5,1,3,5,3, + 1,3,5,1,1,3,7,7,1,5,1,3,7,3,7,3,5,1,7,1,1,3,5,3,7,1,5,5,1,1, + 3,1,3,3,7,1,7,3,1,7,3,1,7,3,5,3,5,7,3,3,3,5,1,7,7,1,3,1,3,7, + 7,1,3,7,3,1,5,3,1,1,1,5,3,3,7,1,5,3,5,1,3,1,3,1,5,7,7,1,1,5, + 3,1,5,1,1,7,7,3,5,5,1,7,1,5,1,1,3,1,5,7,5,7,7,1,5,1,1,3,5,1, + 5,5,3,1,3,1,5,5,3,3,3,3,1,1,3,1,3,5,5,7,5,5,7,5,7,1,3,7,7,3, + 5,5,7,5,5,3,3,3,1,7,1,5,5,5,3,3,5,1,3,1,3,3,3,7,1,7,7,3,7,1, + 1,5,7,1,7,1,7,7,1,3,7,5,1,3,5,5,5,1,1,7,1,7,1,7,7,3,1,1,5,1, + 5,1,5,3,5,5,5,5,5,3,3,7,3,3,5,5,3,7,1,5,7,5,1,5,5,3,5,5,7,5, + 3,5,5,5,1,5,5,5,5,1,3,5,3,1,7,5,5,7,1,5,3,3,1,5,3,7,1,7,5,1, + 1,3,1,1,7,1,5,5,3,7,3,7,5,3,1,1,3,1,3,5, + 5,7,5,3,7,7,7,3,7,3,7,1,3,1,7,7,1,7, + 3,7,3,7,3,7,3,5,1,1,7,3,1,5,5,7,1,5,5,5,7,1,5,5,1,5,5,3,1,3, + 1,7,3,1,3,5,7,7,7,1,1,7,3,1,5,5,5,1,1,1,1,1,5,3,5,1,3,5,3,1, + 1,1,1,3,7,3,7,5,7,1,5,5,7,5,3,3,7,5,3,1,1,3,1,3,1,1,3,7,1,7, + 1,1,5,1,7,5,3,7,3,5,3,1,1,5,5,1,7,7,3,7,3,7,1,5,1,5,3,7,3,5, + 7,7,7,3,3,1,1,5,5,3,7,1,1,1,3,5,3,1,1,3,3,7,5,1,1,3,7,1,5,7, + 3,7,5,5,7,3,5,3,1,5,3,1,1,7,5,1,7,3,7,5,1,7,1,7,7,1,1,7,1,5, + 5,1,1,7,5,7,1,5,3,5,3,3,7,1,5,1,1,5,5,3,3,7,5,5,1,1,1,3,1,5, + 7,7,1,7,5,7,3,7,3,1,3,7,3,1,5,5,3,5,1,3,5,5,5,1,1,7,7,1,5,5, + 1,3,5,1,5,3,5,3,3,7,5,7,3,7,3,1,3,7,7,3,3,1,1,3,3,3,3,3,5,5, + 3,3,3,1,3,5,7,7,1,5,7,3,7,1,1,3,5,7,5,3,3,3}, + /* [3][*] */ + { 0,0,0,0, + 1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3, + 15,7,9,13,9,1,11,7,5,15,1,15,11,5,11,1,7,9,7,7,1,15,15,15,13, + 3,3,15,5,9,7,13,3,7,5,11,9,1,9,1,5,7,13,9,9,1,7,3,5,1,11,11, + 13,7,7,9,9,1,1,3,9,15,1,5,13,1,9,9,9,9,9,13,11,3,5,11,11,13, + 5,3,15,1,11,11,7,13,15,11,13,9,11,15,15,13,3,15,7,9,11,13,11, + 9,9,5,13,9,1,13,7,7,7,7,7,5,9,7,13,11,9,11,15,3,13,11,1,11,3, + 3,9,11,1,7,1,15,15,3,1,9,1,7,13,11,3,13,11,7,3,3,5,13,11,5, + 11,1,3,9,7,15,7,5,13,7,9,13,15,13,9,7,15,7,9,5,11,11,13,13,9, + 3,5,13,9,11,15,11,7,1,7,13,3,13,3,13,9,15,7,13,13,3,13,15,15, + 11,9,13,9,15,1,1,15,11,11,7,1,11,13,9,13,3,5,11,13,9,9,13,1, + 11,15,13,3,13,7,15,1,15,3,3,11,7,13,7,7,9,7,5,15,9,5,5,7,15, + 13,15,5,15,5,3,1,11,7,1,5,7,9,3,11,1,15,1,3,15,11,13,5,13,1, + 7,1,15,7,5,1,1,15,13,11,11,13,5,11,7,9,7,1,5,3,9,5,5,11,5,1, + 7,1,11,7,9,13,15,13,3,1,11,13,15,1,1,11,9,13,3,13,11,15,13,9, + 9,9,5,5,5,5,1,15,5,9, + 11,7,15,5,3,13,5,3,11,5,1,11,13,9,11, + 3,7,13,15,1,7,11,1,13,1,15,1,9,7,3,9,11,1,9,13,13,3,11,7,9,1, + 7,15,9,1,5,13,5,11,3,9,15,11,13,5,1,7,7,5,13,7,7,9,5,11,11,1, + 1,15,3,13,9,13,9,9,11,5,5,13,15,3,9,15,3,11,11,15,15,3,11,15, + 15,3,1,3,1,3,3,1,3,13,1,11,5,15,7,15,9,1,7,1,9,11,15,1,13,9, + 13,11,7,3,7,3,13,7,9,7,7,3,3,9,9,7,5,11,13,13,7,7,15,9,5,5,3, + 3,13,3,9,3,1,11,1,3,11,15,11,11,11,9,13,7,9,15,9,11,1,3,3,9, + 7,15,13,13,7,15,9,13,9,15,13,15,9,13,1,11,7,11,3,13,5,1,7,15, + 3,13,7,13,13,11,3,5,3,13,11,9,9,3,11,11,7,9,13,11,7,15,13,7, + 5,3,1,5,15,15,3,11,1,7,3,15,11,5,5,3,5,5,1,15,5,1,5,3,7,5,11, + 3,13,9,13,15,5,3,5,9,5,3,11,1,13,9,15,3,5,11,9,1,3,15,9,9,9, + 11,7,5,13,1,15,3,13,9,13,5,1,5,1,13,13,7,7,1,9,5,11,9,11,13, + 3,15,15,13,15,7,5,7,9,7,9,9,9,11,9,3,11,15,13,13,5,9,15,1,1, + 9,5,13,3,13,15,3,1,3,11,13,1,15,9,9,3,1,9,1,9,1,13,11,15,7, + 11,15,13,15,1,9,9,7, + 3,5,11,7,3,9,5,15,7,5,3,13,7,1,1,9, + 15,15,15,11,3,5,15,13,7,15,15,11,11,9,5,15,9,7,3,13,1,1,5,1, + 3,1,7,1,1,5,1,11,11,9,9,5,13,7,7,7,1,1,9,9,11,11,15,7,5,5,3, + 11,1,3,7,13,7,7,7,3,15,15,11,9,3,9,3,15,13,5,3,3,3,5,9,15,9, + 9,1,5,9,9,15,5,15,7,9,1,9,9,5,11,5,15,15,11,7,7,7,1,1,11,11, + 13,15,3,13,5,1,7,1,11,3,13,15,3,5,3,5,7,3,9,9,5,1,7,11,9,3,5, + 11,13,13,13,9,15,5,7,1,15,11,9,15,15,13,13,13,1,11,9,15,9,5, + 15,5,7,3,11,3,15,7,13,11,7,3,7,13,5,13,15,5,13,9,1,15,11,5,5, + 1,11,3,3,7,1,9,7,15,9,9,3,11,15,7,1,3,1,1,1,9,1,5,15,15,7,5, + 5,7,9,7,15,13,13,11,1,9,11,1,13,1,7,15,15,5,5,1,11,3,9,11,9, + 9,9,1,9,3,5,15,1,1,9,7,3,3,1,9,9,11,9,9,13,13,3,13,11,13,5,1, + 5,5,9,9,3,13,13,9,15,9,11,7,11,9,13,9,1,15,9,7,7,1,7,9,9,15, + 1,11,1,13,13,15,9,13,7,15,3,9,3,1,13,7,5,9,3,1,7,1,1,13,3,3, + 11,1,7,13,15,15,5,7,13,13,15,11,13,1,13,13,3,9,15,15,11,15,9, + 15,1,13,15,1,1,5, + 11,5,1,11,11,5,3,9,1,3,5,13,9,7,7,1, + 9,9,15,7,5,5,15,13,9,7,13,3,13,11,13,7,9,13,13,13,15,9,5,5,3, + 3,3,1,3,15}, + /* [4][*] */ + { 0,0,0,0,0,0, + 9,3,27,15,29,21,23,19,11,25,7,13,17,1, + 25,29,3,31,11,5,23,27,19,21,5,1,17,13,7,15,9,31,25,3,5,23,7, + 3,17,23,3,3,21,25,25,23,11,19,3,11,31,7,9,5,17,23,17,17,25, + 13,11,31,27,19,17,23,7,5,11,19,19,7,13,21,21,7,9,11,1,5,21, + 11,13,25,9,7,7,27,15,25,15,21,17,19,19,21,5,11,3,5,29,31,29, + 5,5,1,31,27,11,13,1,3,7,11,7,3,23,13,31,17,1,27,11,25,1,23, + 29,17,25,7,25,27,17,13,17,23,5,17,5,13,11,21,5,11,5,9,31,19, + 17,9,9,27,21,15,15,1,1,29,5,31,11,17,23,19,21,25,15,11,5,5,1, + 19,19,19,7,13,21,17,17,25,23,19,23,15,13,5,19,25,9,7,3,21,17, + 25,1,27,25,27,25,9,13,3,17,25,23,9,25,9,13,17,17,3,15,7,7,29, + 3,19,29,29,19,29,13,15,25,27,1,3,9,9,13,31,29,31,5,15,29,1, + 19,5,9,19,5,15,3,5,7,15,17,17,23,11,9,23,19,3,17,1,27,9,9,17, + 13,25,29,23,29,11,31,25,21,29,19,27,31,3,5,3,3,13,21,9,29,3, + 17,11,11,9,21,19,7,17,31,25,1,27,5,15,27,29,29,29,25,27,25,3, + 21,17,25,13,15,17,13,23,9,3,11,7,9,9,7,17,7,1, + 27,1,9,5,31,21,25,25,21,11,1,23,19,27, + 15,3,5,23,9,25,7,29,11,9,13,5,11,1,3,31,27,3,17,27,11,13,15, + 29,15,1,15,23,25,13,21,15,3,29,29,5,25,17,11,7,15,5,21,7,31, + 13,11,23,5,7,23,27,21,29,15,7,27,27,19,7,15,27,27,19,19,9,15, + 1,3,29,29,5,27,31,9,1,7,3,19,19,29,9,3,21,31,29,25,1,3,9,27, + 5,27,25,21,11,29,31,27,21,29,17,9,17,13,11,25,15,21,11,19,31, + 3,19,5,3,3,9,13,13,3,29,7,5,9,23,13,21,23,21,31,11,7,7,3,23, + 1,23,5,9,17,21,1,17,29,7,5,17,13,25,17,9,19,9,5,7,21,19,13,9, + 7,3,9,3,15,31,29,29,25,13,9,21,9,31,7,15,5,31,7,15,27,25,19, + 9,9,25,25,23,1,9,7,11,15,19,15,27,17,11,11,31,13,25,25,9,7, + 13,29,19,5,19,31,25,13,25,15,5,9,29,31,9,29,27,25,27,11,17,5, + 17,3,23,15,9,9,17,17,31,11,19,25,13,23,15,25,21,31,19,3,11, + 25,7,15,19,7,5,3,13,13,1,23,5,25,11,25,15,13,21,11,23,29,5, + 17,27,9,19,15,5,29,23,19,1,27,3,23,21,19,27,11,17,13,27,11, + 31,23,5,9,21,31,29,11,21,17,15,7,15,7,9,21,27,25, + 29,11,3,21,13,23,19,27,17,29,25,17,9, + 1,19,23,5,23,1,17,17,13,27,23,7,7,11,13,17,13,11,21,13,23,1, + 27,13,9,7,1,27,29,5,13,25,21,3,31,15,13,3,19,13,1,27,15,17,1, + 3,13,13,13,31,29,27,7,7,21,29,15,17,17,21,19,17,3,15,5,27,27, + 3,31,31,7,21,3,13,11,17,27,25,1,9,7,29,27,21,23,13,25,29,15, + 17,29,9,15,3,21,15,17,17,31,9,9,23,19,25,3,1,11,27,29,1,31, + 29,25,29,1,23,29,25,13,3,31,25,5,5,11,3,21,9,23,7,11,23,11,1, + 1,3,23,25,23,1,23,3,27,9,27,3,23,25,19,29,29,13,27,5,9,29,29, + 13,17,3,23,19,7,13,3,19,23,5,29,29,13,13,5,19,5,17,9,11,11, + 29,27,23,19,17,25,13,1,13,3,11,1,17,29,1,13,17,9,17,21,1,11, + 1,1,25,5,7,29,29,19,19,1,29,13,3,1,31,15,13,3,1,11,19,5,29, + 13,29,23,3,1,31,13,19,17,5,5,1,29,23,3,19,25,19,27,9,27,13, + 15,29,23,13,25,25,17,19,17,15,27,3,25,17,27,3,27,31,23,13,31, + 11,15,7,21,19,27,19,21,29,7,31,13,9,9,7,21,13,11,9,11,29,19, + 11,19,21,5,29,13,7,19,19,27,23,31,1,27,21,7,3,7,11, + 23,13,29,11,31,19,1,5,5,11,5,3,27,5, + 7,11,31,1,27,31,31,23,5,21,27,9,25,3,15,19,1,19,9,5,25,21,15, + 25,29,15,21,11,19,15,3,7,13,11,25,17,1,5,31,13,29,23,9,5,29, + 7,17,27,7,17,31,9,31,9,9,7,21,3,3,3,9,11,21,11,31,9,25,5,1, + 31,13,29,9,29,1,11,19,7,27,13,31,7,31,7,25,23,21,29,11,11,13, + 11,27,1,23,31,21,23,21,19,31,5,31,25,25,19,17,11,25,7,13,1, + 29,17,23,15,7,29,17,13,3,17}, + /* [5][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0, + 37,33,7,5,11,39,63,59,17,15,23,29,3,21, + 13,31,25,9,49,33,19,29,11,19,27,15,25,63,55,17,63,49,19,41, + 59,3,57,33,49,53,57,57,39,21,7,53,9,55,15,59,19,49,31,3,39,5, + 5,41,9,19,9,57,25,1,15,51,11,19,61,53,29,19,11,9,21,19,43,13, + 13,41,25,31,9,11,19,5,53,37,7,51,45,7,7,61,23,45,7,59,41,1, + 29,61,37,27,47,15,31,35,31,17,51,13,25,45,5,5,33,39,5,47,29, + 35,47,63,45,37,47,59,21,59,33,51,9,27,13,25,43,3,17,21,59,61, + 27,47,57,11,17,39,1,63,21,59,17,13,31,3,31,7,9,27,37,23,31,9, + 45,43,31,63,21,39,51,27,7,53,11,1,59,39,23,49,23,7,55,59,3, + 19,35,13,9,13,15,23,9,7,43,55,3,19,9,27,33,27,49,23,47,19,7, + 11,55,27,35,5,5,55,35,37,9,33,29,47,25,11,47,53,61,59,3,53, + 47,5,19,59,5,47,23,45,53,3,49,61,47,39,29,17,57,5,17,31,23, + 41,39,5,27,7,29,29,33,31,41,31,29,17,29,29,9,9,31,27,53,35,5, + 61,1,49,13,57,29,5,21,43,25,57,49,37,27,11,61,37,49,5,63,63, + 3,45,37,63,21,21,19,27,59,21,45,23,13,15,3,43,63,39,19, + 63,31,41,41,15,43,63,53,1,63,31,7,17, + 11,61,31,51,37,29,59,25,63,59,47,15,27,19,29,45,35,55,39,19, + 43,21,19,13,17,51,37,5,33,35,49,25,45,1,63,47,9,63,15,25,25, + 15,41,13,3,19,51,49,37,25,49,13,53,47,23,35,29,33,21,35,23,3, + 43,31,63,9,1,61,43,3,11,55,11,35,1,63,35,49,19,45,9,57,51,1, + 47,41,9,11,37,19,55,23,55,55,13,7,47,37,11,43,17,3,25,19,55, + 59,37,33,43,1,5,21,5,63,49,61,21,51,15,19,43,47,17,9,53,45, + 11,51,25,11,25,47,47,1,43,29,17,31,15,59,27,63,11,41,51,29,7, + 27,63,31,43,3,29,39,3,59,59,1,53,63,23,63,47,51,23,61,39,47, + 21,39,15,3,9,57,61,39,37,21,51,1,23,43,27,25,11,13,21,43,7, + 11,33,55,1,37,35,27,61,39,5,19,61,61,57,59,21,59,61,57,25,55, + 27,31,41,33,63,19,57,35,13,63,35,17,11,11,49,41,55,5,45,17, + 35,5,31,31,37,17,45,51,1,39,49,55,19,41,13,5,51,5,49,1,21,13, + 17,59,51,11,3,61,1,33,37,33,61,25,27,59,7,49,13,63,3,33,3,15, + 9,13,35,39,11,59,59,1,57,11,5,57,13,31,13,11,55,45,9,55,55, + 19,25,41,23,45,29,63,59,27,39,21,37,7, + 61,49,35,39,9,29,7,25,23,57,5,19,15,33,49,37,25,17,45,29,15, + 25,3,3,49,11,39,15,19,57,39,15,11,3,57,31,55,61,19,5,41,35, + 59,61,39,41,53,53,63,31,9,59,13,35,55,41,49,5,41,25,27,43,5, + 5,43,5,5,17,5,15,27,29,17,9,3,55,31,1,45,45,13,57,17,3,61,15, + 49,15,47,9,37,45,9,51,61,21,33,11,21,63,63,47,57,61,49,9,59, + 19,29,21,23,55,23,43,41,57,9,39,27,41,35,61,29,57,63,21,31, + 59,35,49,3,49,47,49,33,21,19,21,35,11,17,37,23,59,13,37,35, + 55,57,1,29,45,11,1,15,9,33,19,53,43,39,23,7,13,13,1,19,41,55, + 1,13,15,59,55,15,3,57,37,31,17,1,3,21,29,25,55,9,37,33,53,41, + 51,19,57,13,63,43,19,7,13,37,33,19,15,63,51,11,49,23,57,47, + 51,15,53,41,1,15,37,61,11,35,29,33,23,55,11,59,19,61,61,45, + 13,49,13,63,5,61,5,31,17,61,63,13,27,57,1,21,5,11,39,57,51, + 53,39,25,41,39,37,23,31,25,33,17,57,29,27,23,47,41,29,19,47, + 41,25,5,51,43,39,29,7,31,45,51,49,55,17,43,49,45,9,29,3,5,47, + 9,15,19, + 51,45,57,63,9,21,59,3,9,13,45,23,15, + 31,21,15,51,35,9,11,61,23,53,29,51,45,31,29,5,35,29,53,35,17, + 59,55,27,51,59,27,47,15,29,37,7,49,55,5,19,45,29,19,57,33,53, + 45,21,9,3,35,29,43,31,39,3,45,1,41,29,5,59,41,33,35,27,19,13, + 25,27,43,33,35,17,17,23,7,35,15,61,61,53,5,15,23,11,13,43,55, + 47,25,43,15,57,45,1,49,63,57,15,31,31,7,53,27,15,47,23,7,29, + 53,47,9,53,3,25,55,45,63,21,17,23,31,27,27,43,63,55,63,45,51, + 15,27,5,37,43,11,27,5,27,59,21,7,39,27,63,35,47,55,17,17,17, + 3,19,21,13,49,61,39,15}, + /* [6][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 13,33,115,41,79,17,29,119,75,73,105,7, + 59,65,21,3,113,61,89,45,107,21,71,79,19,71,61,41,57,121,87, + 119,55,85,121,119,11,23,61,11,35,33,43,107,113,101,29,87,119, + 97,29,17,89,5,127,89,119,117,103,105,41,83,25,41,55,69,117, + 49,127,29,1,99,53,83,15,31,73,115,35,21,89,5,1,91,53,35,95, + 83,19,85,55,51,101,33,41,55,45,95,61,27,37,89,75,57,61,15, + 117,15,21,27,25,27,123,39,109,93,51,21,91,109,107,45,15,93, + 127,3,53,81,79,107,79,87,35,109,73,35,83,107,1,51,7,59,33, + 115,43,111,45,121,105,125,87,101,41,95,75,1,57,117,21,27,67, + 29,53,117,63,1,77,89,115,49,127,15,79,81,29,65,103,33,73,79, + 29,21,113,31,33,107,95,111,59,99,117,63,63,99,39,9,35,63,125, + 99,45,93,33,93,9,105,75,51,115,11,37,17,41,21,43,73,19,93,7, + 95,81,93,79,81,55,9,51,63,45,89,73,19,115,39,47,81,39,5,5,45, + 53,65,49,17,105,13,107,5,5,19,73,59,43,83,97,115,27,1,69,103, + 3,99,103,63,67,25,121,97,77,13,83,103,41,11,27,81,37,33,125, + 71,41,41,59,41,87,123, + 43,101,63,45,39,21,97,15,97,111,21,49, + 13,17,79,91,65,105,75,1,45,67,83,107,125,87,15,81,95,105,65, + 45,59,103,23,103,99,67,99,47,117,71,89,35,53,73,9,115,49,37, + 1,35,9,45,81,19,127,17,17,105,89,49,101,7,37,33,11,95,95,17, + 111,105,41,115,5,69,101,27,27,101,103,53,9,21,43,79,91,65, + 117,87,125,55,45,63,85,83,97,45,83,87,113,93,95,5,17,77,77, + 127,123,45,81,85,121,119,27,85,41,49,15,107,21,51,119,11,87, + 101,115,63,63,37,121,109,7,43,69,19,77,49,71,59,35,7,13,55, + 101,127,103,85,109,29,61,67,21,111,67,23,57,75,71,101,123,41, + 107,101,107,125,27,47,119,41,19,127,33,31,109,7,91,91,39,125, + 105,47,125,123,91,9,103,45,23,117,9,125,73,11,37,61,79,21,5, + 47,117,67,53,85,33,81,121,47,61,51,127,29,65,45,41,95,57,73, + 33,117,61,111,59,123,65,47,105,23,29,107,37,81,67,29,115,119, + 75,73,99,103,7,57,45,61,95,49,101,101,35,47,119,39,67,31,103, + 7,61,127,87,3,35,29,73,95,103,71,75,51,87,57,97,11,105,87,41, + 73,109,69,35,121,39,111,1,77, + 39,47,53,91,3,17,51,83,39,125,85,111, + 21,69,85,29,55,11,117,1,47,17,65,63,47,117,17,115,51,25,33, + 123,123,83,51,113,95,121,51,91,109,43,55,35,55,87,33,37,5,3, + 45,21,105,127,35,17,35,37,97,97,21,77,123,17,89,53,105,75,25, + 125,13,47,21,125,23,55,63,61,5,17,93,57,121,69,73,93,121,105, + 75,91,67,95,75,9,69,97,99,93,11,53,19,73,5,33,79,107,65,69, + 79,125,25,93,55,61,17,117,69,97,87,111,37,93,59,79,95,53,115, + 53,85,85,65,59,23,75,21,67,27,99,79,27,3,95,27,69,19,75,47, + 59,41,85,77,99,55,49,93,93,119,51,125,63,13,15,45,61,19,105, + 115,17,83,7,7,11,61,37,63,89,95,119,113,67,123,91,33,37,99, + 43,11,33,65,81,79,81,107,63,63,55,89,91,25,93,101,27,55,75, + 121,79,43,125,73,27,109,35,21,71,113,89,59,95,41,45,113,119, + 113,39,59,73,15,13,59,67,121,27,7,105,15,59,59,35,91,89,23, + 125,97,53,41,91,111,29,31,3,103,61,71,35,7,119,29,45,49,111, + 41,109,59,125,13,27,19,79,9,75,83,81,33,91,109,33,29,107,111, + 101,107,109,65,59,43,37, + 1,9,15,109,37,111,113,119,79,73,65, + 71,93,17,101,87,97,43,23,75,109,41,49,53,31,97,105,109,119, + 51,9,53,113,97,73,89,79,49,61,105,13,99,53,71,7,87,21,101,5, + 71,31,123,121,121,73,79,115,13,39,101,19,37,51,83,97,55,81, + 91,127,105,89,63,47,49,75,37,77,15,49,107,23,23,35,19,69,17, + 59,63,73,29,125,61,65,95,101,81,57,69,83,37,11,37,95,1,73,27, + 29,57,7,65,83,99,69,19,103,43,95,25,19,103,41,125,97,71,105, + 83,83,61,39,9,45,117,63,31,5,117,67,125,41,117,43,77,97,15, + 29,5,59,25,63,87,39,39,77,85,37,81,73,89,29,125,109,21,23, + 119,105,43,93,97,15,125,29,51,69,37,45,31,75,109,119,53,5, + 101,125,121,35,29,7,63,17,63,13,69,15,105,51,127,105,9,57,95, + 59,109,35,49,23,33,107,55,33,57,79,73,69,59,107,55,11,63,95, + 103,23,125,91,31,91,51,65,61,75,69,107,65,101,59,35,15}, + /* [7][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 7,23,39,217,141,27,53,181,169,35,15, + 207,45,247,185,117,41,81,223,151,81,189,61,95,185,23,73,113, + 239,85,9,201,83,53,183,203,91,149,101,13,111,239,3,205,253, + 247,121,189,169,179,197,175,217,249,195,95,63,19,7,5,75,217, + 245,111,189,165,169,141,221,249,159,253,207,249,219,23,49, + 127,237,5,25,177,37,103,65,167,81,87,119,45,79,143,57,79,187, + 143,183,75,97,211,149,175,37,135,189,225,241,63,33,43,13,73, + 213,57,239,183,117,21,29,115,43,205,223,15,3,159,51,101,127, + 99,239,171,113,171,119,189,245,201,27,185,229,105,153,189,33, + 35,137,77,97,17,181,55,197,201,155,37,197,137,223,25,179,91, + 23,235,53,253,49,181,249,53,173,97,247,67,115,103,159,239,69, + 173,217,95,221,247,97,91,123,223,213,129,181,87,239,85,89, + 249,141,39,57,249,71,101,159,33,137,189,71,253,205,171,13, + 249,109,131,199,189,179,31,99,113,41,173,23,189,197,3,135,9, + 95,195,27,183,1,123,73,53,99,197,59,27,101,55,193,31,61,119, + 11,7,255,233,53,157,193,97,83,65,81,239,167,69,71,109, + 97,137,71,193,189,115,79,205,37,227, + 53,33,91,229,245,105,77,229,161,103,93,13,161,229,223,69,15, + 25,23,233,93,25,217,247,61,75,27,9,223,213,55,197,145,89,199, + 41,201,5,149,35,119,183,53,11,13,3,179,229,43,55,187,233,47, + 133,91,47,71,93,105,145,45,255,221,115,175,19,129,5,209,197, + 57,177,115,187,119,77,211,111,33,113,23,87,137,41,7,83,43, + 121,145,5,219,27,11,111,207,55,97,63,229,53,33,149,23,187, + 153,91,193,183,59,211,93,139,59,179,163,209,77,39,111,79,229, + 85,237,199,137,147,25,73,121,129,83,87,93,205,167,53,107,229, + 213,95,219,109,175,13,209,97,61,147,19,13,123,73,35,141,81, + 19,171,255,111,107,233,113,133,89,9,231,95,69,33,1,253,219, + 253,247,129,11,251,221,153,35,103,239,7,27,235,181,5,207,53, + 149,155,225,165,137,155,201,97,245,203,47,39,35,105,239,49, + 15,253,7,237,213,55,87,199,27,175,49,41,229,85,3,149,179,129, + 185,249,197,15,97,197,139,203,63,33,251,217,199,199,99,249, + 33,229,177,13,209,147,97,31,125,177,137, + 187,11,91,223,29,169,231,59,31,163,41, + 57,87,247,25,127,101,207,187,73,61,105,27,91,171,243,33,3,1, + 21,229,93,71,61,37,183,65,211,53,11,151,165,47,5,129,79,101, + 147,169,181,19,95,77,139,197,219,97,239,183,143,9,13,209,23, + 215,53,137,203,19,151,171,133,219,231,3,15,253,225,33,111, + 183,213,169,119,111,15,201,123,121,225,113,113,225,161,165,1, + 139,55,3,93,217,193,97,29,69,231,161,93,69,143,137,9,87,183, + 113,183,73,215,137,89,251,163,41,227,145,57,81,57,11,135,145, + 161,175,159,25,55,167,157,211,97,247,249,23,129,159,71,197, + 127,141,219,5,233,131,217,101,131,33,157,173,69,207,239,81, + 205,11,41,169,65,193,77,201,173,1,221,157,1,15,113,147,137, + 205,225,73,45,49,149,113,253,99,17,119,105,117,129,243,75, + 203,53,29,247,35,247,171,31,199,213,29,251,7,251,187,91,11, + 149,13,205,37,249,137,139,9,7,113,183,205,187,39,3,79,155, + 227,89,185,51,127,63,83,41,133,183,181,127,19,255,219,59,251, + 3,187,57,217,115,217,229,181,185,149,83,115,11, + 123,19,109,165,103,123,219,129,155, + 207,177,9,49,181,231,33,233,67,155,41,9,95,123,65,117,249,85, + 169,129,241,173,251,225,147,165,69,81,239,95,23,83,227,249, + 143,171,193,9,21,57,73,97,57,29,239,151,159,191,47,51,1,223, + 251,251,151,41,119,127,131,33,209,123,53,241,25,31,183,107, + 25,115,39,11,213,239,219,109,185,35,133,123,185,27,55,245,61, + 75,205,213,169,163,63,55,49,83,195,51,31,41,15,203,41,63,127, + 161,5,143,7,199,251,95,75,101,15,43,237,197,117,167,155,21, + 83,205,255,49,101,213,237,135,135,21,73,93,115,7,85,223,237, + 79,89,5,57,239,67,65,201,155,71,85,195,89,181,119,135,147, + 237,173,41,155,67,113,111,21,183,23,103,207,253,69,219,205, + 195,43,197,229,139,177,129,69,97,201,163,189,11,99,91,253, + 239,91,145,19,179,231,121,7,225,237,125,191,119,59,175,237, + 131,79,43,45,205,199,251,153,207,37,179,113,255,107,217,61,7, + 181,247,31,13,113,145,107,233,233,43,79,23,169,137,129,183, + 53,91,55,103,223,87,177,157,79,213,139, + 183,231,205,143,129,243,205,93,59, + 15,89,9,11,47,133,227,75,9,91,19,171,163,79,7,103,5,119,155, + 75,11,71,95,17,13,243,207,187}, + /* [8][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 235,307,495,417,57,151,19,119,375,451, + 55,449,501,53,185,317,17,21,487,13,347,393,15,391,307,189, + 381,71,163,99,467,167,433,337,257,179,47,385,23,117,369,425, + 207,433,301,147,333,85,221,423,49,3,43,229,227,201,383,281, + 229,207,21,343,251,397,173,507,421,443,399,53,345,77,385,317, + 155,187,269,501,19,169,235,415,61,247,183,5,257,401,451,95, + 455,49,489,75,459,377,87,463,155,233,115,429,211,419,143,487, + 195,209,461,193,157,193,363,181,271,445,381,231,135,327,403, + 171,197,181,343,113,313,393,311,415,267,247,425,233,289,55, + 39,247,327,141,5,189,183,27,337,341,327,87,429,357,265,251, + 437,201,29,339,257,377,17,53,327,47,375,393,369,403,125,429, + 257,157,217,85,267,117,337,447,219,501,41,41,193,509,131,207, + 505,421,149,111,177,167,223,291,91,29,305,151,177,337,183, + 361,435,307,507,77,181,507,315,145,423,71,103,493,271,469, + 339,237,437,483,31,219,61,131,391,233,219,69,57,459,225,421, + 7,461,111,451,277,185,193,125,251,199,73,71,7,409,417,149, + 193,53,437,29,467,229,31,35,75,105, + 503,75,317,401,367,131,365,441,433,93,377,405,465,259,283, + 443,143,445,3,461,329,309,77,323,155,347,45,381,315,463,207, + 321,157,109,479,313,345,167,439,307,235,473,79,101,245,19, + 381,251,35,25,107,187,115,113,321,115,445,61,77,293,405,13, + 53,17,171,299,41,79,3,485,331,13,257,59,201,497,81,451,199, + 171,81,253,365,75,451,149,483,81,453,469,485,305,163,401,15, + 91,3,129,35,239,355,211,387,101,299,67,375,405,357,267,363, + 79,83,437,457,39,97,473,289,179,57,23,49,79,71,341,287,95, + 229,271,475,49,241,261,495,353,381,13,291,37,251,105,399,81, + 89,265,507,205,145,331,129,119,503,249,1,289,463,163,443,63, + 123,361,261,49,429,137,355,175,507,59,277,391,25,185,381,197, + 39,5,429,119,247,177,329,465,421,271,467,151,45,429,137,471, + 11,17,409,347,199,463,177,11,51,361,95,497,163,351,127,395, + 511,327,353,49,105,151,321,331,329,509,107,109,303,467,287, + 161,45,385,289,363,331,265,407,37,433,315,343,63,51,185,71, + 27,267, + 503,239,293,245,281,297,75,461,371, + 129,189,189,339,287,111,111,379,93,27,185,347,337,247,507, + 161,231,43,499,73,327,263,331,249,493,37,25,115,3,167,197, + 127,357,497,103,125,191,165,55,101,95,79,351,341,43,125,135, + 173,289,373,133,421,241,281,213,177,363,151,227,145,363,239, + 431,81,397,241,67,291,255,405,421,399,75,399,105,329,41,425, + 7,283,375,475,427,277,209,411,3,137,195,289,509,121,55,147, + 275,251,19,129,285,415,487,491,193,219,403,23,97,65,285,75, + 21,373,261,339,239,495,415,333,107,435,297,213,149,463,199, + 323,45,19,301,121,499,187,229,63,425,99,281,35,125,349,87, + 101,59,195,511,355,73,263,243,101,165,141,11,389,219,187,449, + 447,393,477,305,221,51,355,209,499,479,265,377,145,411,173, + 11,433,483,135,385,341,89,209,391,33,395,319,451,119,341,227, + 375,61,331,493,411,293,47,203,375,167,395,155,5,237,361,489, + 127,21,345,101,371,233,431,109,119,277,125,263,73,135,123,83, + 123,405,69,75,287,401,23,283,393,41,379,431,11,475,505,19, + 365,265,271, + 499,489,443,165,91,83,291,319,199, + 107,245,389,143,137,89,125,281,381,215,131,299,249,375,455, + 43,73,281,217,297,229,431,357,81,357,171,451,481,13,387,491, + 489,439,385,487,177,393,33,71,375,443,129,407,395,127,65,333, + 309,119,197,435,497,373,71,379,509,387,159,265,477,463,449, + 47,353,249,335,505,89,141,55,235,187,87,363,93,363,101,67, + 215,321,331,305,261,411,491,479,65,307,469,415,131,315,487, + 83,455,19,113,163,503,99,499,251,239,81,167,391,255,317,363, + 359,395,419,307,251,267,171,461,183,465,165,163,293,477,223, + 403,389,97,335,357,297,19,469,501,249,85,213,311,265,379,297, + 283,393,449,463,289,159,289,499,407,129,137,221,43,89,403, + 271,75,83,445,453,389,149,143,423,499,317,445,157,137,453, + 163,87,23,391,119,427,323,173,89,259,377,511,249,31,363,229, + 353,329,493,427,57,205,389,91,83,13,219,439,45,35,371,441,17, + 267,501,53,25,333,17,201,475,257,417,345,381,377,55,403,77, + 389,347,363,211,413,419,5,167,219,201,285,425,11,77,269,489, + 281,403,79, + 425,125,81,331,437,271,397,299,475, + 271,249,413,233,261,495,171,69,27,409,21,421,367,81,483,255, + 15,219,365,497,181,75,431,99,325,407,229,281,63,83,493,5,113, + 15,271,37,87,451,299,83,451,311,441,47,455,47,253,13,109,369, + 347,11,409,275,63,441,15}, + /* [9][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 519,307,931,1023,517,771,151,1023, + 539,725,45,927,707,29,125,371,275,279,817,389,453,989,1015, + 29,169,743,99,923,981,181,693,309,227,111,219,897,377,425, + 609,227,19,221,143,581,147,919,127,725,793,289,411,835,921, + 957,443,349,813,5,105,457,393,539,101,197,697,27,343,515,69, + 485,383,855,693,133,87,743,747,475,87,469,763,721,345,479, + 965,527,121,271,353,467,177,245,627,113,357,7,691,725,355, + 889,635,737,429,545,925,357,873,187,351,677,999,921,477,233, + 765,495,81,953,479,89,173,473,131,961,411,291,967,65,511,13, + 805,945,369,827,295,163,835,259,207,331,29,315,999,133,967, + 41,117,677,471,717,881,755,351,723,259,879,455,721,289,149, + 199,805,987,851,423,597,129,11,733,549,153,285,451,559,377, + 109,357,143,693,615,677,701,475,767,85,229,509,547,151,389, + 711,785,657,319,509,99,1007,775,359,697,677,85,497,105,615, + 891,71,449,835,609,377,693,665,627,215,911,503,729,131,19, + 895,199,161,239,633,1013,537,255,23,149,679,1021,595,199,557, + 659,251,829,727,439,495,647,223, + 949,625,87,481,85,799,917,769,949, + 739,115,499,945,547,225,1015,469,737,495,353,103,17,665,639, + 525,75,447,185,43,729,577,863,735,317,99,17,477,893,537,519, + 1017,375,297,325,999,353,343,729,135,489,859,267,141,831,141, + 893,249,807,53,613,131,547,977,131,999,175,31,341,739,467, + 675,241,645,247,391,583,183,973,433,367,131,467,571,309,385, + 977,111,917,935,473,345,411,313,97,149,959,841,839,669,431, + 51,41,301,247,1015,377,329,945,269,67,979,581,643,823,557,91, + 405,117,801,509,347,893,303,227,783,555,867,99,703,111,797, + 873,541,919,513,343,319,517,135,871,917,285,663,301,15,763, + 89,323,757,317,807,309,1013,345,499,279,711,915,411,281,193, + 739,365,315,375,809,469,487,621,857,975,537,939,585,129,625, + 447,129,1017,133,83,3,415,661,53,115,903,49,79,55,385,261, + 345,297,199,385,617,25,515,275,849,401,471,377,661,535,505, + 939,465,225,929,219,955,659,441,117,527,427,515,287,191,33, + 389,197,825,63,417,949,35,571,9,131,609,439,95,19,569,893, + 451,397,971,801, + 125,471,187,257,67,949,621,453,411, + 621,955,309,783,893,597,377,753,145,637,941,593,317,555,375, + 575,175,403,571,555,109,377,931,499,649,653,329,279,271,647, + 721,665,429,957,803,767,425,477,995,105,495,575,687,385,227, + 923,563,723,481,717,111,633,113,369,955,253,321,409,909,367, + 33,967,453,863,449,539,781,911,113,7,219,725,1015,971,1021, + 525,785,873,191,893,297,507,215,21,153,645,913,755,371,881, + 113,903,225,49,587,201,927,429,599,513,97,319,331,833,325, + 887,139,927,399,163,307,803,169,1019,869,537,907,479,335,697, + 479,353,769,787,1023,855,493,883,521,735,297,1011,991,879, + 855,591,415,917,375,453,553,189,841,339,211,601,57,765,745, + 621,209,875,639,7,595,971,263,1009,201,23,77,621,33,535,963, + 661,523,263,917,103,623,231,47,301,549,337,675,189,357,1005, + 789,189,319,721,1005,525,675,539,191,813,917,51,167,415,579, + 755,605,721,837,529,31,327,799,961,279,409,847,649,241,285, + 545,407,161,591,73,313,811,17,663,269,261,37,783,127,917,231, + 577,975,793, + 921,343,751,139,221,79,817,393,545, + 11,781,71,1,699,767,917,9,107,341,587,903,965,599,507,843, + 739,579,397,397,325,775,565,925,75,55,979,931,93,957,857,753, + 965,795,67,5,87,909,97,995,271,875,671,613,33,351,69,811,669, + 729,401,647,241,435,447,721,271,745,53,775,99,343,451,427, + 593,339,845,243,345,17,573,421,517,971,499,435,769,75,203, + 793,985,343,955,735,523,659,703,303,421,951,405,631,825,735, + 433,841,485,49,749,107,669,211,497,143,99,57,277,969,107,397, + 563,551,447,381,187,57,405,731,769,923,955,915,737,595,341, + 253,823,197,321,315,181,885,497,159,571,981,899,785,947,217, + 217,135,753,623,565,717,903,581,955,621,361,869,87,943,907, + 853,353,335,197,771,433,743,195,91,1023,63,301,647,205,485, + 927,1003,987,359,577,147,141,1017,701,273,89,589,487,859,343, + 91,847,341,173,287,1003,289,639,983,685,697,35,701,645,911, + 501,705,873,763,745,657,559,699,315,347,429,197,165,955,859, + 167,303,833,531,473,635,641,195,589,821,205,3,635,371,891, + 249,123, + 77,623,993,401,525,427,71,655,951, + 357,851,899,535,493,323,1003,343,515,859,1017,5,423,315,1011, + 703,41,777,163,95,831,79,975,235,633,723,297,589,317,679,981, + 195,399,1003,121,501,155}, + /* [10][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 7,2011,1001,49,825,415,1441,383,1581, + 623,1621,1319,1387,619,839,217,75,1955,505,281,1629,1379,53, + 1111,1399,301,209,49,155,1647,631,129,1569,335,67,1955,1611, + 2021,1305,121,37,877,835,1457,669,1405,935,1735,665,551,789, + 1543,1267,1027,1,1911,163,1929,67,1975,1681,1413,191,1711, + 1307,401,725,1229,1403,1609,2035,917,921,1789,41,2003,187,67, + 1635,717,1449,277,1903,1179,363,1211,1231,647,1261,1029,1485, + 1309,1149,317,1335,171,243,271,1055,1601,1129,1653,205,1463, + 1681,1621,197,951,573,1697,1265,1321,1805,1235,1853,1307,945, + 1197,1411,833,273,1517,1747,1095,1345,869,57,1383,221,1713, + 335,1751,1141,839,523,1861,1105,389,1177,1877,805,93,1591, + 423,1835,99,1781,1515,1909,1011,303,385,1635,357,973,1781, + 1707,1363,1053,649,1469,623,1429,1241,1151,1055,503,921,3, + 349,1149,293,45,303,877,1565,1583,1001,663,1535,395,1141, + 1481,1797,643,1507,465,2027,1695,367,937,719,545,1991,83,819, + 239,1791,1461,1647,1501,1161,1629,139,1595,1921,1267,1415, + 509,347,777,1083,363,269,1015, + 1809,1105,1429,1471,2019,381,2025, + 1223,827,1733,887,1321,803,1951,1297,1995,833,1107,1135,1181, + 1251,983,1389,1565,273,137,71,735,1005,933,67,1471,551,457, + 1667,1729,919,285,1629,1815,653,1919,1039,531,393,1411,359, + 221,699,1485,471,1357,1715,595,1677,153,1903,1281,215,781, + 543,293,1807,965,1695,443,1985,321,879,1227,1915,839,1945, + 1993,1165,51,557,723,1491,817,1237,947,1215,1911,1225,1965, + 1889,1503,1177,73,1767,303,177,1897,1401,321,921,217,1779, + 327,1889,333,615,1665,1825,1639,237,1205,361,129,1655,983, + 1089,1171,401,677,643,749,303,1407,1873,1579,1491,1393,1247, + 789,763,49,5,1607,1891,735,1557,1909,1765,1777,1127,813,695, + 97,731,1503,1751,333,769,865,693,377,1919,957,1359,1627,1039, + 1783,1065,1665,1917,1947,991,1997,841,459,221,327,1595,1881, + 1269,1007,129,1413,475,1105,791,1983,1359,503,691,659,691, + 343,1375,1919,263,1373,603,1383,297,781,145,285,767,1739, + 1715,715,317,1333,85,831,1615,81,1667,1467,1457,1453,1825, + 109,387,1207,2039,213,1351,1329,1173, + 57,1769,951,183,23,451,1155,1551, + 2037,811,635,1671,1451,863,1499,1673,363,1029,1077,1525,277, + 1023,655,665,1869,1255,965,277,1601,329,1603,1901,395,65, + 1307,2029,21,1321,543,1569,1185,1905,1701,413,2041,1697,725, + 1417,1847,411,211,915,1891,17,1877,1699,687,1089,1973,1809, + 851,1495,1257,63,1323,1307,609,881,1543,177,617,1505,1747, + 1537,925,183,77,1723,1877,1703,397,459,521,257,1177,389,1947, + 1553,1583,1831,261,485,289,1281,1543,1591,1123,573,821,1065, + 1933,1373,2005,905,207,173,1573,1597,573,1883,1795,1499,1743, + 553,335,333,1645,791,871,1157,969,557,141,223,1129,1685,423, + 1069,391,99,95,1847,531,1859,1833,1833,341,237,1997,1799,409, + 431,1917,363,335,1039,1085,1657,1975,1527,1111,659,389,899, + 595,1439,1861,1979,1569,1087,1009,165,1895,1481,1583,29,1193, + 1673,1075,301,1081,1377,1747,1497,1103,1789,887,739,1577,313, + 1367,1299,1801,1131,1837,73,1865,1065,843,635,55,1655,913, + 1037,223,1871,1161,461,479,511,1721,1107,389,151,35,375,1099, + 937,1185,1701,769,639,1633, + 1609,379,1613,2031,685,289,975,671, + 1599,1447,871,647,99,139,1427,959,89,117,841,891,1959,223, + 1697,1145,499,1435,1809,1413,1445,1675,171,1073,1349,1545, + 2039,1027,1563,859,215,1673,1919,1633,779,411,1845,1477,1489, + 447,1545,351,1989,495,183,1639,1385,1805,1097,1249,1431,1571, + 591,697,1509,709,31,1563,165,513,1425,1299,1081,145,1841, + 1211,941,609,845,1169,1865,1593,347,293,1277,157,211,93,1679, + 1799,527,41,473,563,187,1525,575,1579,857,703,1211,647,709, + 981,285,697,163,981,153,1515,47,1553,599,225,1147,381,135, + 821,1965,609,1033,983,503,1117,327,453,2005,1257,343,1649, + 1199,599,1877,569,695,1587,1475,187,973,233,511,51,1083,665, + 1321,531,1875,1939,859,1507,1979,1203,1965,737,921,1565,1943, + 819,223,365,167,1705,413,1577,745,1573,655,1633,1003,91,1123, + 477,1741,1663,35,715,37,1513,815,941,1379,263,1831,1735,1111, + 1449,353,1941,1655,1349,877,285,1723,125,1753,985,723,175, + 439,791,1051,1261,717,1555,1757,1777,577,1583,1957,873,331, + 1163,313,1,1963,963,1905,821, + 1677,185,709,545,1723,215,1885, + 1249,583,1803,839,885,485,413,1767,425,129,1035,329,1263, + 1881,1779,1565,359,367,453,707,1419,831,1889,887,1871,1869, + 747,223,1547,1799,433,1441,553,2021,1303,1505,1735,1619,1065, + 1161,2047,347,867,881,1447,329,781,1065,219,589,645,1257, + 1833,749,1841,1733,1179,1191,1025,1639,1955,1423,1685,1711, + 493,549,783,1653,397,895,233,759,1505,677,1449,1573,1297, + 1821,1691,791,289,1187,867,1535,575,183}, + /* [11][*] */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 3915,97,3047,937,2897,953,127,1201, + 3819,193,2053,3061,3759,1553,2007,2493,603,3343,3751,1059, + 783,1789,1589,283,1093,3919,2747,277,2605,2169,2905,721,4069, + 233,261,1137,3993,3619,2881,1275,3865,1299,3757,1193,733,993, + 1153,2945,3163,3179,437,271,3493,3971,1005,2615,2253,1131, + 585,2775,2171,2383,2937,2447,1745,663,1515,3767,2709,1767, + 3185,3017,2815,1829,87,3341,793,2627,2169,1875,3745,367,3783, + 783,827,3253,2639,2955,3539,1579,2109,379,2939,3019,1999, + 2253,2911,3733,481,1767,1055,4019,4085,105,1829,2097,2379, + 1567,2713,737,3423,3941,2659,3961,1755,3613,1937,1559,2287, + 2743,67,2859,325,2601,1149,3259,2403,3947,2011,175,3389,3915, + 1315,2447,141,359,3609,3933,729,2051,1755,2149,2107,1741, + 1051,3681,471,1055,845,257,1559,1061,2803,2219,1315,1369, + 3211,4027,105,11,1077,2857,337,3553,3503,3917,2665,3823,3403, + 3711,2085,1103,1641,701,4095,2883,1435,653,2363,1597,767,869, + 1825,1117,1297,501,505,149,873,2673,551,1499,2793,3277,2143, + 3663,533,3991,575,1877,1009,3929,473,3009,2595,3249,675,3593, + 2453,1567,973,595,1335,1715,589,85, + 2265,3069,461,1659,2627,1307,1731,1501,1699,3545,3803,2157, + 453,2813,2047,2999,3841,2361,1079,573,69,1363,1597,3427,2899, + 2771,1327,1117,1523,3521,2393,2537,1979,3179,683,2453,453, + 1227,779,671,3483,2135,3139,3381,3945,57,1541,3405,3381,2371, + 2879,1985,987,3017,3031,3839,1401,3749,2977,681,1175,1519, + 3355,907,117,771,3741,3337,1743,1227,3335,2755,1909,3603, + 2397,653,87,2025,2617,3257,287,3051,3809,897,2215,63,2043, + 1757,3671,297,3131,1305,293,3865,3173,3397,2269,3673,717, + 3041,3341,3595,3819,2871,3973,1129,513,871,1485,3977,2473, + 1171,1143,3063,3547,2183,3993,133,2529,2699,233,2355,231, + 3241,611,1309,3829,1839,1495,301,1169,1613,2673,243,3601, + 3669,2813,2671,2679,3463,2477,1795,617,2317,1855,1057,1703, + 1761,2515,801,1205,1311,473,3963,697,1221,251,381,3887,1761, + 3093,3721,2079,4085,379,3601,3845,433,1781,29,1897,1599,2163, + 75,3475,3957,1641,3911,2959,2833,1279,1099,403,799,2183,2699, + 1711,2037,727,289,1785,1575,3633,2367,1261,3953,1735,171, + 1959, + 2867,859,2951,3211,15,1279,1323,599, + 1651,3951,1011,315,3513,3351,1725,3793,2399,287,4017,3571, + 1007,541,3115,429,1585,1285,755,1211,3047,915,3611,2697,2129, + 3669,81,3939,2437,915,779,3567,3701,2479,3807,1893,3927,2619, + 2543,3633,2007,3857,3837,487,1769,3759,3105,2727,3155,2479, + 1341,1657,2767,2541,577,2105,799,17,2871,3637,953,65,69,2897, + 3841,3559,4067,2335,3409,1087,425,2813,1705,1701,1237,821, + 1375,3673,2693,3925,1541,1871,2285,847,4035,1101,2029,855, + 2733,2503,121,2855,1069,3463,3505,1539,607,1349,575,2301, + 2321,1101,333,291,2171,4085,2173,2541,1195,925,4039,1379,699, + 1979,275,953,1755,1643,325,101,2263,3329,3673,3413,1977,2727, + 2313,1419,887,609,2475,591,2613,2081,3805,3435,2409,111,3557, + 3607,903,231,3059,473,2959,2925,3861,2043,3887,351,2865,369, + 1377,2639,1261,3625,3279,2201,2949,3049,449,1297,897,1891, + 411,2773,749,2753,1825,853,2775,3547,3923,3923,987,3723,2189, + 3877,3577,297,2763,1845,3083,2951,483,2169,3985,245,3655, + 3441,1023,235,835,3693,3585,327,1003,543,3059,2637, + 2923,87,3617,1031,1043,903,2913, + 2177,2641,3279,389,2009,525,4085,3299,987,2409,813,2683,373, + 2695,3775,2375,1119,2791,223,325,587,1379,2877,2867,3793,655, + 831,3425,1663,1681,2657,1865,3943,2977,1979,2271,3247,1267, + 1747,811,159,429,2001,1195,3065,553,1499,3529,1081,2877,3077, + 845,1793,2409,3995,2559,4081,1195,2955,1117,1409,785,287, + 1521,1607,85,3055,3123,2533,2329,3477,799,3683,3715,337,3139, + 3311,431,3511,2299,365,2941,3067,1331,1081,1097,2853,2299, + 495,1745,749,3819,619,1059,3559,183,3743,723,949,3501,733, + 2599,3983,3961,911,1899,985,2493,1795,653,157,433,2361,3093, + 3119,3679,2367,1701,1445,1321,2397,1241,3305,3985,2349,4067, + 3805,3073,2837,1567,3783,451,2441,1181,487,543,1201,3735, + 2517,733,1535,2175,3613,3019}, + /* [12][*] */ + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 2319,653,1379,1675,1951,7075,2087, + 7147,1427,893,171,2019,7235,5697,3615,1961,7517,6849,2893, + 1883,2863,2173,4543,73,381,3893,6045,1643,7669,1027,1549, + 3983,1985,6589,7497,2745,2375,7047,1117,1171,1975,5199,3915, + 3695,8113,4303,3773,7705,6855,1675,2245,2817,1719,569,1021, + 2077,5945,1833,2631,4851,6371,833,7987,331,1899,8093,6719, + 6903,5903,5657,5007,2689,6637,2675,1645,1819,689,6709,7717, + 6295,7013,7695,3705,7069,2621,3631,6571,6259,7261,3397,7645, + 1115,4753,2047,7579,2271,5403,4911,7629,4225,1209,6955,6951, + 1829,5579,5231,1783,4285,7425,599,5785,3275,5643,2263,657, + 6769,6261,1251,3249,4447,4111,3991,1215,131,4397,3487,7585, + 5565,7199,3573,7105,7409,1671,949,3889,5971,3333,225,3647, + 5403,3409,7459,6879,5789,6567,5581,4919,1927,4407,8085,4691, + 611,3005,591,753,589,171,5729,5891,1033,3049,6567,5257,8003, + 1757,4489,4923,6379,5171,1757,689,3081,1389,4113,455,2761, + 847,7575,5829,633,6629,1103,7635,803,6175,6587,2711,3879,67, + 1179,4761,7281,1557,3379,2459,4273,4127,7147,35, + 3549,395,3735,5787,4179,5889,5057, + 7473,4713,2133,2897,1841,2125,1029,1695,6523,1143,5105,7133, + 3351,2775,3971,4503,7589,5155,4305,1641,4717,2427,5617,1267, + 399,5831,4305,4241,3395,3045,4899,1713,171,411,7099,5473, + 5209,1195,1077,1309,2953,7343,4887,3229,6759,6721,6775,675, + 4039,2493,7511,3269,4199,6625,7943,2013,4145,667,513,2303, + 4591,7941,2741,987,8061,3161,5951,1431,831,5559,7405,1357, + 4319,4235,5421,2559,4415,2439,823,1725,6219,4903,6699,5451, + 349,7703,2927,7809,6179,1417,5987,3017,4983,3479,4525,4643, + 4911,227,5475,2287,5581,6817,1937,1421,4415,7977,1789,3907, + 6815,6789,6003,5609,4507,337,7427,7943,3075,6427,1019,7121, + 4763,81,3587,2929,1795,8067,2415,1265,4025,5599,4771,3025, + 2313,6129,7611,6881,5253,4413,7869,105,3173,1629,2537,1023, + 4409,7209,4413,7107,7469,33,1955,2881,5167,6451,4211,179, + 5573,7879,3387,7759,5455,7157,1891,5683,5689,6535,3109,6555, + 6873,1249,4251,6437,49,2745,1201,7327,4179,6783,623,2779, + 5963,2585,6927,5333,4033,285,7467,4443,4917,3, + 4319,5517,3449,813,5499,2515,5771, + 3357,2073,4395,4925,2643,7215,5817,1199,1597,1619,7535,4833, + 609,4797,8171,6847,793,6757,8165,3371,2431,5235,4739,7703, + 7223,6525,5891,5605,4433,3533,5267,5125,5037,225,6717,1121, + 5741,2013,4327,4839,569,5227,7677,4315,2391,5551,859,3627, + 6377,3903,4311,6527,7573,4905,7731,1909,1555,3279,1949,1887, + 6675,5509,2033,5473,3539,5033,5935,6095,4761,1771,1271,1717, + 4415,5083,6277,3147,7695,2461,4783,4539,5833,5583,651,1419, + 2605,5511,3913,5795,2333,2329,4431,3725,6069,2699,7055,6879, + 1017,3121,2547,4603,2385,6915,6103,5669,7833,2001,4287,6619, + 955,2761,5711,6291,3415,3909,2841,5627,4939,7671,6059,6275, + 6517,1931,4583,7301,1267,7509,1435,2169,6939,3515,2985,2787, + 2123,1969,3307,353,4359,7059,5273,5873,6657,6765,6229,3179, + 1583,6237,2155,371,273,7491,3309,6805,3015,6831,7819,713, + 4747,3935,4109,1311,709,3089,7059,4247,2989,1509,4919,1841, + 3045,3821,6929,4655,1333,6429,6649,2131,5265,1051,261,8057, + 3379,2179,1993,5655,3063,6381, + 3587,7417,1579,1541,2107,5085,2873, + 6141,955,3537,2157,841,1999,1465,5171,5651,1535,7235,4349, + 1263,1453,1005,6893,2919,1947,1635,3963,397,969,4569,655, + 6737,2995,7235,7713,973,4821,2377,1673,1,6541} + }; + + return sobol_minit[degree][dim]; + } + +}; + +} // namespace sbl + + +// sobol_lattice sets up the random-number generator to produce a Sobol +// sequence of at most max dims-dimensional quasi-random vectors. +// Adapted from ACM TOMS algorithm 659, see + +// http://doi.acm.org/10.1145/42288.214372 + +template +struct sobol_lattice +{ + typedef IntType value_type; + + BOOST_STATIC_CONSTANT(int, bit_count = std::numeric_limits::digits); + + // default copy c-tor is fine + + explicit sobol_lattice(std::size_t dimension) + { + resize(dimension); + } + + void resize(std::size_t dimension) + { + if (dimension > sbl::sobol_tables::max_dimension) + { + throw std::invalid_argument("The Sobol quasi-random number generator only supports up to " + BOOST_PP_STRINGIZE(BOOST_RANDOM_SOBOL_MAX_DIMENSION) " dimensions."); + } + + // Initialize the bit array + bits.resize(boost::extents[bit_count][dimension]); + + // Initialize direction table in dimension 0 + for (int k = 0; k < bit_count; ++k) + bits[k][0] = static_cast(1); + + // Initialize in remaining dimensions. + for (std::size_t dim = 1; dim < dimension; ++dim) + { + const int poly = sbl::sobol_tables::polynomial(dim-1); + if (static_cast(poly) > + static_cast(std::numeric_limits::max())) { + boost::throw_exception( std::range_error("sobol: polynomial value outside the given IntType range") ); + } + const int degree = multiprecision::detail::find_msb(poly); // integer log2(poly) + + // set initial values of m from table + for (int k = 0; k < degree; ++k) + bits[k][dim] = sbl::sobol_tables::vinit(k, dim-1); + + // Calculate remaining elements for this dimension, + // as explained in Bratley+Fox, section 2. + for (int j = degree; j < bit_count; ++j) + { + int p_i = poly; + bits[j][dim] = bits[j - degree][dim]; + for (int k = 0; k < degree; ++k) + { + int rem = degree - k; + bits[j][dim] ^= ((p_i & 1) * bits[j-rem][dim]) << rem; + p_i >>= 1; + } + } + } + + // Multiply columns by appropriate power of 2. + IntType p = static_cast(2); + for (int j = bit_count-1-1; j >= 0; --j, p <<= 1) + for (std::size_t dim = 0; dim != dimension; ++dim) + bits[j][dim] *= p; + } + + value_type operator()(int i, int j) const + { + return bits[i][j]; + } + +private: + boost::multi_array bits; +}; + +} // namespace detail +/** @endcond */ + +//!class template sobol implements a quasi-random number generator as described in +//! \blockquote +//![Bratley+Fox, TOMS 14, 88 (1988)] +//!and [Antonov+Saleev, USSR Comput. Maths. Math. Phys. 19, 252 (1980)] +//! \endblockquote +//! +//!\attention \b Important: This implementation supports up to 40 dimensions. +//! +//!In the following documentation @c X denotes the concrete class of the template +//!sobol returning objects of type @c IntType, u and v are the values of @c X. +//! +//!Some member functions may throw exceptions of type @c std::overflow_error. This +//!happens when the quasi-random domain is exhausted and the generator cannot produce +//!any more values. The length of the low discrepancy sequence is given by +//! \f$L=Dimension \times 2^{digits}\f$, where digits = std::numeric_limits::digits. +//! +//! \copydoc friendfunctions +template +class sobol : public detail::gray_coded_qrng_base< + sobol + , detail::sobol_lattice + > +{ + typedef sobol self_t; + typedef detail::sobol_lattice lattice_t; + typedef detail::gray_coded_qrng_base base_t; + +public: + typedef IntType result_type; + + /** @copydoc boost::random::niederreiter_base2::min() */ + static result_type min /** @cond */ BOOST_PREVENT_MACRO_SUBSTITUTION /** @endcond */ () { return 0u; } + + /** @copydoc boost::random::niederreiter_base2::max() */ + static result_type max /** @cond */ BOOST_PREVENT_MACRO_SUBSTITUTION /** @endcond */ () { return std::numeric_limits::max(); } + + //!Effects: Constructs the default s-dimensional Sobol quasi-random number generator. + //! + //!Throws: bad_alloc, invalid_argument, range_error. + explicit sobol(std::size_t s) + : base_t(s) + {} + + // default copy c-tor is fine + + /** @copydoc boost::random::niederreiter_base2::seed() */ + void seed() + { + base_t::reset_state(); + } + + /** @copydoc boost::random::niederreiter_base2::seed(std::size_t) */ + void seed(std::size_t init) + { + base_t::seed(init, "sobol::seed"); + } + + //=========================Doxygen needs this!============================== + + //!Requirements: *this is mutable. + //! + //!Returns: Returns a successive element of an s-dimensional + //!(s = X::dimension()) vector at each invocation. When all elements are + //!exhausted, X::operator() begins anew with the starting element of a + //!subsequent s-dimensional vector. + //! + //!Throws: overflow_error. + + // Fixed in Doxygen 1.7.0 -- id 612458: Fixed problem handling @copydoc for function operators. + result_type operator()() + { + return base_t::operator()(); + } + + /** @copydoc boost::random::niederreiter_base2::discard(std::size_t) */ + void discard(std::size_t z) + { + base_t::discard(z); + } +}; + +} // namespace random + +typedef random::sobol sobol; + +} // namespace boost + +#endif // BOOST_RANDOM_SOBOL_HPP diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 25424bc..13a7643 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -55,6 +55,10 @@ run test_lagged_fibonacci23209.cpp /boost//unit_test_framework ; run test_lagged_fibonacci44497.cpp /boost//unit_test_framework ; run test_zero_seed.cpp /boost//unit_test_framework ; +run niederreiter_base2_validate.cpp /boost//unit_test_framework ; +run sobol_validate.cpp /boost//unit_test_framework ; +run faure_validate.cpp /boost//unit_test_framework ; + # Disable by default. These don't add much and the larger # ones can overflow the stack. explicit test_lagged_fibonacci1279 test_lagged_fibonacci2281 diff --git a/test/faure_validate.cpp b/test/faure_validate.cpp new file mode 100644 index 0000000..0e87539 --- /dev/null +++ b/test/faure_validate.cpp @@ -0,0 +1,375 @@ +// Copyright Justinas Vygintas Daugmaudis, 2010. +// Use, modification and distribution is subject to the +// Boost Software License, Version 1.0. (See accompanying +// file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0) + +#include + +#include + +#define BOOST_TEST_MAIN +#include + +#include "test_qrng_functions.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the faure quasi-random number generator. +// These tests compare our results with values produced by the original +// version of ACM TOMS Algorithm 647, which is available in the +// TOMS subdirectory in http://www.netlib.org +// +// For independently generated datasets look at http://people.sc.fsu.edu/~jburkardt/datasets/faure/ + + +// Spatial dimension: 2 +// N: 100 +// Base: 2 +// Vectors skipped: 15 +static const double faure_02_100[100][2] = +{ + { 0.9375000000, 0.0625000000 }, + { 0.0312500000, 0.5312500000 }, + { 0.5312500000, 0.0312500000 }, + { 0.2812500000, 0.2812500000 }, + { 0.7812500000, 0.7812500000 }, + { 0.1562500000, 0.1562500000 }, + { 0.6562500000, 0.6562500000 }, + { 0.4062500000, 0.9062500000 }, + { 0.9062500000, 0.4062500000 }, + { 0.0937500000, 0.4687500000 }, + { 0.5937500000, 0.9687500000 }, + { 0.3437500000, 0.7187500000 }, + { 0.8437500000, 0.2187500000 }, + { 0.2187500000, 0.8437500000 }, + { 0.7187500000, 0.3437500000 }, + { 0.4687500000, 0.0937500000 }, + { 0.9687500000, 0.5937500000 }, + { 0.0156250000, 0.7968750000 }, + { 0.5156250000, 0.2968750000 }, + { 0.2656250000, 0.0468750000 }, + { 0.7656250000, 0.5468750000 }, + { 0.1406250000, 0.4218750000 }, + { 0.6406250000, 0.9218750000 }, + { 0.3906250000, 0.6718750000 }, + { 0.8906250000, 0.1718750000 }, + { 0.0781250000, 0.2343750000 }, + { 0.5781250000, 0.7343750000 }, + { 0.3281250000, 0.9843750000 }, + { 0.8281250000, 0.4843750000 }, + { 0.2031250000, 0.6093750000 }, + { 0.7031250000, 0.1093750000 }, + { 0.4531250000, 0.3593750000 }, + { 0.9531250000, 0.8593750000 }, + { 0.0468750000, 0.2656250000 }, + { 0.5468750000, 0.7656250000 }, + { 0.2968750000, 0.5156250000 }, + { 0.7968750000, 0.0156250000 }, + { 0.1718750000, 0.8906250000 }, + { 0.6718750000, 0.3906250000 }, + { 0.4218750000, 0.1406250000 }, + { 0.9218750000, 0.6406250000 }, + { 0.1093750000, 0.7031250000 }, + { 0.6093750000, 0.2031250000 }, + { 0.3593750000, 0.4531250000 }, + { 0.8593750000, 0.9531250000 }, + { 0.2343750000, 0.0781250000 }, + { 0.7343750000, 0.5781250000 }, + { 0.4843750000, 0.8281250000 }, + { 0.9843750000, 0.3281250000 }, + { 0.0078125000, 0.6640625000 }, + { 0.5078125000, 0.1640625000 }, + { 0.2578125000, 0.4140625000 }, + { 0.7578125000, 0.9140625000 }, + { 0.1328125000, 0.0390625000 }, + { 0.6328125000, 0.5390625000 }, + { 0.3828125000, 0.7890625000 }, + { 0.8828125000, 0.2890625000 }, + { 0.0703125000, 0.3515625000 }, + { 0.5703125000, 0.8515625000 }, + { 0.3203125000, 0.6015625000 }, + { 0.8203125000, 0.1015625000 }, + { 0.1953125000, 0.9765625000 }, + { 0.6953125000, 0.4765625000 }, + { 0.4453125000, 0.2265625000 }, + { 0.9453125000, 0.7265625000 }, + { 0.0390625000, 0.1328125000 }, + { 0.5390625000, 0.6328125000 }, + { 0.2890625000, 0.8828125000 }, + { 0.7890625000, 0.3828125000 }, + { 0.1640625000, 0.5078125000 }, + { 0.6640625000, 0.0078125000 }, + { 0.4140625000, 0.2578125000 }, + { 0.9140625000, 0.7578125000 }, + { 0.1015625000, 0.8203125000 }, + { 0.6015625000, 0.3203125000 }, + { 0.3515625000, 0.0703125000 }, + { 0.8515625000, 0.5703125000 }, + { 0.2265625000, 0.4453125000 }, + { 0.7265625000, 0.9453125000 }, + { 0.4765625000, 0.6953125000 }, + { 0.9765625000, 0.1953125000 }, + { 0.0234375000, 0.3984375000 }, + { 0.5234375000, 0.8984375000 }, + { 0.2734375000, 0.6484375000 }, + { 0.7734375000, 0.1484375000 }, + { 0.1484375000, 0.7734375000 }, + { 0.6484375000, 0.2734375000 }, + { 0.3984375000, 0.0234375000 }, + { 0.8984375000, 0.5234375000 }, + { 0.0859375000, 0.5859375000 }, + { 0.5859375000, 0.0859375000 }, + { 0.3359375000, 0.3359375000 }, + { 0.8359375000, 0.8359375000 }, + { 0.2109375000, 0.2109375000 }, + { 0.7109375000, 0.7109375000 }, + { 0.4609375000, 0.9609375000 }, + { 0.9609375000, 0.4609375000 }, + { 0.0546875000, 0.9296875000 }, + { 0.5546875000, 0.4296875000 }, + { 0.3046875000, 0.1796875000 } +}; + +// Spatial dimension: 7 +// N: 100 +// Base: 7 +// Vectors skipped: 2400 +static const double faure_07_100[100][7] = +{ + { 0.9995835069, 0.4602249063, 0.9412744690, 0.3202832153, 0.9850062474, 0.8334027489, 0.1103706789 }, + { 0.0000594990, 0.2437079788, 0.3765692866, 0.6493722854, 0.6685309692, 0.3582435890, 0.2228833224 }, + { 0.1429166419, 0.3865651217, 0.5194264295, 0.7922294282, 0.8113881121, 0.5011007318, 0.3657404653 }, + { 0.2857737847, 0.5294222645, 0.6622835723, 0.9350865711, 0.9542452550, 0.6439578747, 0.5085976081 }, + { 0.4286309276, 0.6722794074, 0.8051407152, 0.0779437139, 0.0971023978, 0.7868150176, 0.6514547510 }, + { 0.5714880704, 0.8151365502, 0.9479978580, 0.2208008568, 0.2399595407, 0.9296721604, 0.7943118939 }, + { 0.7143452133, 0.9579936931, 0.0908550009, 0.3636579996, 0.3828166835, 0.0725293033, 0.9371690367 }, + { 0.8572023562, 0.1008508360, 0.2337121437, 0.5065151425, 0.5256738264, 0.2153864461, 0.0800261796 }, + { 0.0204676623, 0.4069732849, 0.6826917356, 0.0983518772, 0.2603677039, 0.0929374665, 0.1004343428 }, + { 0.1633248051, 0.5498304278, 0.8255488784, 0.2412090201, 0.4032248468, 0.2357946094, 0.2432914857 }, + { 0.3061819480, 0.6926875707, 0.9684060213, 0.3840661629, 0.5460819896, 0.3786517522, 0.3861486285 }, + { 0.4490390909, 0.8355447135, 0.1112631642, 0.5269233058, 0.6889391325, 0.5215088951, 0.5290057714 }, + { 0.5918962337, 0.9784018564, 0.2541203070, 0.6697804486, 0.8317962754, 0.6643660380, 0.6718629143 }, + { 0.7347533766, 0.1212589992, 0.3969774499, 0.8126375915, 0.9746534182, 0.8072231808, 0.8147200571 }, + { 0.8776105194, 0.2641161421, 0.5398345927, 0.9554947343, 0.1175105611, 0.9500803237, 0.9575772000 }, + { 0.0408758255, 0.5702385911, 0.9888141846, 0.5473314690, 0.8522044386, 0.8276313441, 0.9779853632 }, + { 0.1837329684, 0.7130957339, 0.1316713274, 0.6901886119, 0.9950615815, 0.9704884869, 0.1208425061 }, + { 0.3265901113, 0.8559528768, 0.2745284703, 0.8330457547, 0.1379187243, 0.1133456298, 0.2636996490 }, + { 0.4694472541, 0.9988100196, 0.4173856131, 0.9759028976, 0.2807758672, 0.2562027727, 0.4065567918 }, + { 0.6123043970, 0.1416671625, 0.5602427560, 0.1187600405, 0.4236330101, 0.3990599155, 0.5494139347 }, + { 0.7551615398, 0.2845243053, 0.7030998989, 0.2616171833, 0.5664901529, 0.5419170584, 0.6922710775 }, + { 0.8980186827, 0.4273814482, 0.8459570417, 0.4044743262, 0.7093472958, 0.6847742012, 0.8351282204 }, + { 0.0612839888, 0.5906467543, 0.1520794907, 0.9963110609, 0.3011840305, 0.5623252216, 0.8555363836 }, + { 0.2041411317, 0.7335038972, 0.2949366335, 0.1391682037, 0.4440411733, 0.7051823645, 0.9983935265 }, + { 0.3469982745, 0.8763610400, 0.4377937764, 0.2820253466, 0.5868983162, 0.8480395073, 0.1412506694 }, + { 0.4898554174, 0.0192181829, 0.5806509193, 0.4248824894, 0.7297554590, 0.9908966502, 0.2841078122 }, + { 0.6327125602, 0.1620753258, 0.7235080621, 0.5677396323, 0.8726126019, 0.1337537931, 0.4269649551 }, + { 0.7755697031, 0.3049324686, 0.8663652050, 0.7105967752, 0.0154697447, 0.2766109359, 0.5698220979 }, + { 0.9184268460, 0.4477896115, 0.0092223478, 0.8534539180, 0.1583268876, 0.4194680788, 0.7126792408 }, + { 0.0816921521, 0.7539120605, 0.4582019397, 0.3024335098, 0.8930207652, 0.1541619563, 0.5902302612 }, + { 0.2245492949, 0.8967692033, 0.6010590825, 0.4452906527, 0.0358779080, 0.2970190992, 0.7330874041 }, + { 0.3674064378, 0.0396263462, 0.7439162254, 0.5881477956, 0.1787350509, 0.4398762420, 0.8759445469 }, + { 0.5102635807, 0.1824834890, 0.8867733682, 0.7310049384, 0.3215921937, 0.5827333849, 0.0188016898 }, + { 0.6531207235, 0.3253406319, 0.0296305111, 0.8738620813, 0.4644493366, 0.7255905278, 0.1616588326 }, + { 0.7959778664, 0.4681977747, 0.1724876540, 0.0167192241, 0.6073064794, 0.8684476706, 0.3045159755 }, + { 0.9388350092, 0.6110549176, 0.3153447968, 0.1595763670, 0.7501636223, 0.0113048135, 0.4473731183 }, + { 0.1021003153, 0.9171773666, 0.7643243886, 0.7514131017, 0.4848574999, 0.8888558339, 0.4677812816 }, + { 0.2449574582, 0.0600345094, 0.9071815315, 0.8942702445, 0.6277146427, 0.0317129767, 0.6106384245 }, + { 0.3878146011, 0.2028916523, 0.0500386744, 0.0371273874, 0.7705717856, 0.1745701196, 0.7534955673 }, + { 0.5306717439, 0.3457487951, 0.1928958172, 0.1799845303, 0.9134289284, 0.3174272625, 0.8963527102 }, + { 0.6735288868, 0.4886059380, 0.3357529601, 0.3228416731, 0.0562860713, 0.4602844053, 0.0392098530 }, + { 0.8163860296, 0.6314630809, 0.4786101029, 0.4656988160, 0.1991432141, 0.6031415482, 0.1820669959 }, + { 0.9592431725, 0.7743202237, 0.6214672458, 0.6085559588, 0.3420003570, 0.7459986910, 0.3249241388 }, + { 0.1225084786, 0.0804426727, 0.0704468376, 0.2003926935, 0.0766942345, 0.6235497114, 0.3453323020 }, + { 0.2653656215, 0.2232998156, 0.2133039805, 0.3432498364, 0.2195513774, 0.7664068543, 0.4881894449 }, + { 0.4082227643, 0.3661569584, 0.3561611233, 0.4861069792, 0.3624085203, 0.9092639971, 0.6310465877 }, + { 0.5510799072, 0.5090141013, 0.4990182662, 0.6289641221, 0.5052656631, 0.0521211400, 0.7739037306 }, + { 0.6939370500, 0.6518712441, 0.6418754091, 0.7718212649, 0.6481228060, 0.1949782829, 0.9167608734 }, + { 0.8367941929, 0.7947283870, 0.7847325519, 0.9146784078, 0.7909799488, 0.3378354257, 0.0596180163 }, + { 0.9796513358, 0.9375855298, 0.9275896948, 0.0575355507, 0.9338370917, 0.4806925686, 0.2024751592 }, + { 0.0029749509, 0.4098887368, 0.8896888201, 0.9175938597, 0.9775688701, 0.9938121021, 0.3074314274 }, + { 0.1458320938, 0.5527458797, 0.0325459630, 0.0604510026, 0.1204260130, 0.1366692450, 0.4502885702 }, + { 0.2886892366, 0.6956030226, 0.1754031058, 0.2033081454, 0.2632831558, 0.2795263878, 0.5931457131 }, + { 0.4315463795, 0.8384601654, 0.3182602487, 0.3461652883, 0.4061402987, 0.4223835307, 0.7360028560 }, + { 0.5744035223, 0.9813173083, 0.4611173916, 0.4890224311, 0.5489974415, 0.5652406735, 0.8788599988 }, + { 0.7172606652, 0.1241744511, 0.6039745344, 0.6318795740, 0.6918545844, 0.7080978164, 0.0217171417 }, + { 0.8601178081, 0.2670315940, 0.7468316773, 0.7747367168, 0.8347117273, 0.8509549592, 0.1645742845 }, + { 0.0233831142, 0.4302969001, 0.1958112691, 0.3665734515, 0.5694056048, 0.5856488368, 0.1849824478 }, + { 0.1662402570, 0.5731540430, 0.3386684120, 0.5094305944, 0.7122627477, 0.7285059797, 0.3278395906 }, + { 0.3090973999, 0.7160111858, 0.4815255548, 0.6522877373, 0.8551198905, 0.8713631225, 0.4706967335 }, + { 0.4519545428, 0.8588683287, 0.6243826977, 0.7951448801, 0.9979770334, 0.0142202654, 0.6135538764 }, + { 0.5948116856, 0.0017254715, 0.7672398405, 0.9380020230, 0.1408341762, 0.1570774082, 0.7564110192 }, + { 0.7376688285, 0.1445826144, 0.9100969834, 0.0808591658, 0.2836913191, 0.2999345511, 0.8992681621 }, + { 0.8805259713, 0.2874397572, 0.0529541263, 0.2237163087, 0.4265484620, 0.4427916939, 0.0421253049 }, + { 0.0437912774, 0.5935622062, 0.5019337181, 0.8155530434, 0.0183851966, 0.3203427143, 0.0625334682 }, + { 0.1866484203, 0.7364193491, 0.6447908610, 0.9584101862, 0.1612423395, 0.4631998572, 0.2053906111 }, + { 0.3295055632, 0.8792764919, 0.7876480038, 0.1012673291, 0.3040994824, 0.6060570001, 0.3482477539 }, + { 0.4723627060, 0.0221336348, 0.9305051467, 0.2441244719, 0.4469566252, 0.7489141429, 0.4911048968 }, + { 0.6152198489, 0.1649907777, 0.0733622895, 0.3869816148, 0.5898137681, 0.8917712858, 0.6339620396 }, + { 0.7580769917, 0.3078479205, 0.2162194324, 0.5298387577, 0.7326709109, 0.0346284286, 0.7768191825 }, + { 0.9009341346, 0.4507050634, 0.3590765752, 0.6726959005, 0.8755280538, 0.1774855715, 0.9196763253 }, + { 0.0641994407, 0.7568275123, 0.8080561671, 0.2645326352, 0.6102219313, 0.0550365919, 0.9400844886 }, + { 0.2070565836, 0.8996846552, 0.9509133099, 0.4073897781, 0.7530790742, 0.1978937348, 0.0829416315 }, + { 0.3499137264, 0.0425417981, 0.0937704528, 0.5502469209, 0.8959362171, 0.3407508776, 0.2257987743 }, + { 0.4927708693, 0.1853989409, 0.2366275956, 0.6931040638, 0.0387933599, 0.4836080205, 0.3686559172 }, + { 0.6356280121, 0.3282560838, 0.3794847385, 0.8359612066, 0.1816505028, 0.6264651633, 0.5115130600 }, + { 0.7784851550, 0.4711132266, 0.5223418814, 0.9788183495, 0.3245076456, 0.7693223062, 0.6543702029 }, + { 0.9213422979, 0.6139703695, 0.6651990242, 0.1216754924, 0.4673647885, 0.9121794490, 0.7972273457 }, + { 0.0846076040, 0.9200928185, 0.1141786161, 0.7135122270, 0.2020586660, 0.7897304694, 0.8176355090 }, + { 0.2274647468, 0.0629499613, 0.2570357589, 0.8563693699, 0.3449158089, 0.9325876123, 0.9604926519 }, + { 0.3703218897, 0.2058071042, 0.3998929018, 0.9992265128, 0.4877729517, 0.0754447552, 0.1033497947 }, + { 0.5131790325, 0.3486642470, 0.5427500446, 0.1420836556, 0.6306300946, 0.2183018980, 0.2462069376 }, + { 0.6560361754, 0.4915213899, 0.6856071875, 0.2849407985, 0.7734872375, 0.3611590409, 0.3890640804 }, + { 0.7988933183, 0.6343785328, 0.8284643303, 0.4277979413, 0.9163443803, 0.5040161837, 0.5319212233 }, + { 0.9417504611, 0.7772356756, 0.9713214732, 0.5706550842, 0.0592015232, 0.6468733266, 0.6747783662 }, + { 0.1050157672, 0.0833581246, 0.4203010650, 0.0196346760, 0.7938954007, 0.5244243470, 0.6951865294 }, + { 0.2478729101, 0.2262152674, 0.5631582079, 0.1624918189, 0.9367525436, 0.6672814899, 0.8380436723 }, + { 0.3907300530, 0.3690724103, 0.7060153507, 0.3053489617, 0.0796096864, 0.8101386327, 0.9809008151 }, + { 0.5335871958, 0.5119295532, 0.8488724936, 0.4482061046, 0.2224668293, 0.9529957756, 0.1237579580 }, + { 0.6764443387, 0.6547866960, 0.9917296365, 0.5910632475, 0.3653239722, 0.0958529184, 0.2666151009 }, + { 0.8193014815, 0.7976438389, 0.1345867793, 0.7339203903, 0.5081811150, 0.2387100613, 0.4094722437 }, + { 0.9621586244, 0.9405009817, 0.2774439222, 0.8767775332, 0.6510382579, 0.3815672041, 0.5523293866 }, + { 0.1254239305, 0.2466234307, 0.5835663712, 0.4686142679, 0.3857321354, 0.2591182245, 0.4298804070 }, + { 0.2682810734, 0.3894805736, 0.7264235140, 0.6114714107, 0.5285892783, 0.4019753674, 0.5727375498 }, + { 0.4111382162, 0.5323377164, 0.8692806569, 0.7543285536, 0.6714464211, 0.5448325103, 0.7155946927 }, + { 0.5539953591, 0.6751948593, 0.0121377997, 0.8971856964, 0.8143035640, 0.6876896531, 0.8584518355 }, + { 0.6968525019, 0.8180520021, 0.1549949426, 0.0400428393, 0.9571607068, 0.8305467960, 0.0013089784 }, + { 0.8397096448, 0.9609091450, 0.2978520854, 0.1828999822, 0.1000178497, 0.9734039388, 0.1441661213 }, + { 0.9825667876, 0.1037662879, 0.4407092283, 0.3257571250, 0.2428749926, 0.1162610817, 0.2870232641 }, + { 0.0058904028, 0.4536205153, 0.5456654965, 0.1654072708, 0.2661986077, 0.4865234724, 0.5552448385 } +}; + + +// Spatial dimension: 16 +// N: 100 +// Base: 17 +// Vectors skipped: 83520 +static const double faure_16_100[100][16] = +{ + { 0.9999880270, 0.8056057758, 0.1198740437, 0.6486751835, 0.0390680188, 0.8792878438, 0.8198536895, 0.5009039643, 0.6317812287, 0.8007207768, 0.6547814322, 0.8998455478, 0.1276086254, 0.0370326026, 0.2198129812, 0.3230085847 }, + { 0.0000007043, 0.0739342061, 0.9946008647, 0.7862221336, 0.0647149678, 0.7918135418, 0.2862640393, 0.2779667248, 0.9710738476, 0.9743784057, 0.2536854063, 0.2482376746, 0.8023258680, 0.1164384864, 0.8034393604, 0.9496301388 }, + { 0.0588242337, 0.1327577355, 0.0534243941, 0.8450456630, 0.1235384972, 0.8506370712, 0.3450875687, 0.3367902542, 0.0298973770, 0.0332019351, 0.3125089358, 0.3070612041, 0.8611493974, 0.1752620158, 0.8622628899, 0.0084536682 }, + { 0.1176477631, 0.1915812649, 0.1122479236, 0.9038691925, 0.1823620266, 0.9094606006, 0.4039110981, 0.3956137836, 0.0887209064, 0.0920254645, 0.3713324652, 0.3658847335, 0.9199729269, 0.2340855452, 0.9210864193, 0.0672771976 }, + { 0.1764712925, 0.2504047943, 0.1710714530, 0.9626927219, 0.2411855560, 0.9682841300, 0.4627346275, 0.4544373131, 0.1475444358, 0.1508489939, 0.4301559946, 0.4247082629, 0.9787964563, 0.2929090746, 0.9799099487, 0.1261007270 }, + { 0.2352948219, 0.3092283237, 0.2298949824, 0.0215162513, 0.3000090854, 0.0271076594, 0.5215581569, 0.5132608425, 0.2063679652, 0.2096725234, 0.4889795240, 0.4835317923, 0.0376199857, 0.3517326041, 0.0387334781, 0.1849242565 }, + { 0.2941183514, 0.3680518531, 0.2887185118, 0.0803397807, 0.3588326148, 0.0859311888, 0.5803816863, 0.5720843719, 0.2651914946, 0.2684960528, 0.5478030534, 0.5423553217, 0.0964435151, 0.4105561335, 0.0975570075, 0.2437477859 }, + { 0.3529418808, 0.4268753825, 0.3475420412, 0.1391633101, 0.4176561442, 0.1447547183, 0.6392052157, 0.6309079013, 0.3240150240, 0.3273195822, 0.6066265828, 0.6011788511, 0.1552670445, 0.4693796629, 0.1563805369, 0.3025713153 }, + { 0.4117654102, 0.4856989119, 0.4063655706, 0.1979868395, 0.4764796737, 0.2035782477, 0.6980287451, 0.6897314307, 0.3828385535, 0.3861431116, 0.6654501122, 0.6600023805, 0.2140905739, 0.5282031923, 0.2152040663, 0.3613948447 }, + { 0.4705889396, 0.5445224413, 0.4651891000, 0.2568103689, 0.5353032031, 0.2624017771, 0.7568522746, 0.7485549601, 0.4416620829, 0.4449666410, 0.7242736416, 0.7188259099, 0.2729141033, 0.5870267217, 0.2740275957, 0.4202183741 }, + { 0.5294124690, 0.6033459708, 0.5240126294, 0.3156338983, 0.5941267325, 0.3212253065, 0.8156758040, 0.8073784895, 0.5004856123, 0.5037901704, 0.7830971711, 0.7776494393, 0.3317376327, 0.6458502511, 0.3328511251, 0.4790419035 }, + { 0.5882359984, 0.6621695002, 0.5828361589, 0.3744574278, 0.6529502619, 0.3800488359, 0.8744993334, 0.8662020189, 0.5593091417, 0.5626136998, 0.8419207005, 0.8364729688, 0.3905611621, 0.7046737805, 0.3916746546, 0.5378654329 }, + { 0.6470595278, 0.7209930296, 0.6416596883, 0.4332809572, 0.7117737913, 0.4388723653, 0.9333228628, 0.9250255483, 0.6181326711, 0.6214372292, 0.9007442299, 0.8952964982, 0.4493846916, 0.7634973099, 0.4504981840, 0.5966889623 }, + { 0.7058830572, 0.7798165590, 0.7004832177, 0.4921044866, 0.7705973207, 0.4976958947, 0.9921463922, 0.9838490778, 0.6769562005, 0.6802607587, 0.9595677593, 0.9541200276, 0.5082082210, 0.8223208394, 0.5093217134, 0.6555124918 }, + { 0.7647065866, 0.8386400884, 0.7593067471, 0.5509280160, 0.8294208501, 0.5565194241, 0.0509699216, 0.0426726072, 0.7357797299, 0.7390842881, 0.0183912887, 0.0129435570, 0.5670317504, 0.8811443688, 0.5681452428, 0.7143360212 }, + { 0.8235301161, 0.8974636178, 0.8181302765, 0.6097515454, 0.8882443795, 0.6153429536, 0.1097934510, 0.1014961366, 0.7946032593, 0.7979078175, 0.0772148181, 0.0717670864, 0.6258552798, 0.9399678982, 0.6269687722, 0.7731595506 }, + { 0.8823536455, 0.9562871472, 0.8769538059, 0.6685750748, 0.9470679090, 0.6741664830, 0.1686169804, 0.1603196660, 0.8534267888, 0.8567313469, 0.1360383475, 0.1305906158, 0.6846788092, 0.9987914276, 0.6857923016, 0.8319830800 }, + { 0.9411771749, 0.0151106766, 0.9357773353, 0.7273986042, 0.0058914384, 0.7329900124, 0.2274405099, 0.2191431954, 0.9122503182, 0.9155548763, 0.1948618769, 0.1894141452, 0.7435023386, 0.0576149570, 0.7446158310, 0.8908066094 }, + { 0.0034609119, 0.1362179431, 0.1157081312, 0.9661529295, 0.3034692930, 0.0893913965, 0.6426654233, 0.6931916383, 0.4451222905, 0.5072503780, 0.8453809081, 0.8987567058, 0.5116684286, 0.8257810470, 0.6304289798, 0.8354432876 }, + { 0.0622844413, 0.1950414725, 0.1745316606, 0.0249764589, 0.3622928224, 0.1482149259, 0.7014889528, 0.7520151677, 0.5039458199, 0.5660739074, 0.9042044375, 0.9575802352, 0.5704919580, 0.8846045764, 0.6892525092, 0.8942668170 }, + { 0.1211079707, 0.2538650019, 0.2333551900, 0.0837999883, 0.4211163519, 0.2070384553, 0.7603124822, 0.8108386971, 0.5627693493, 0.6248974369, 0.9630279669, 0.0164037646, 0.6293154874, 0.9434281058, 0.7480760386, 0.9530903464 }, + { 0.1799315001, 0.3126885313, 0.2921787194, 0.1426235177, 0.4799398813, 0.2658619847, 0.8191360116, 0.8696622265, 0.6215928787, 0.6837209663, 0.0218514963, 0.0752272940, 0.6881390168, 0.0022516352, 0.8068995681, 0.0119138758 }, + { 0.2387550296, 0.3715120607, 0.3510022488, 0.2014470471, 0.5387634107, 0.3246855141, 0.8779595410, 0.9284857560, 0.6804164081, 0.7425444957, 0.0806750257, 0.1340508234, 0.7469625462, 0.0610751646, 0.8657230975, 0.0707374052 }, + { 0.2975785590, 0.4303355901, 0.4098257782, 0.2602705765, 0.5975869401, 0.3835090435, 0.9367830704, 0.9873092854, 0.7392399375, 0.8013680251, 0.1394985551, 0.1928743528, 0.8057860756, 0.1198986940, 0.9245466269, 0.1295609347 }, + { 0.3564020884, 0.4891591195, 0.4686493076, 0.3190941060, 0.6564104695, 0.4423325729, 0.9956065998, 0.0461328148, 0.7980634670, 0.8601915545, 0.1983220845, 0.2516978823, 0.8646096051, 0.1787222234, 0.9833701563, 0.1883844641 }, + { 0.4152256178, 0.5479826490, 0.5274728371, 0.3779176354, 0.7152339989, 0.5011561023, 0.0544301292, 0.1049563442, 0.8568869964, 0.9190150839, 0.2571456140, 0.3105214117, 0.9234331345, 0.2375457528, 0.0421936857, 0.2472079935 }, + { 0.4740491472, 0.6068061784, 0.5862963665, 0.4367411648, 0.7740575283, 0.5599796318, 0.1132536586, 0.1637798736, 0.9157105258, 0.9778386133, 0.3159691434, 0.3693449411, 0.9822566639, 0.2963692823, 0.1010172151, 0.3060315229 }, + { 0.5328726766, 0.6656297078, 0.6451198959, 0.4955646942, 0.8328810577, 0.6188031612, 0.1720771881, 0.2226034030, 0.9745340552, 0.0366621427, 0.3747926728, 0.4281684705, 0.0410801933, 0.3551928117, 0.1598407445, 0.3648550523 }, + { 0.5916962060, 0.7244532372, 0.7039434253, 0.5543882236, 0.8917045872, 0.6776266906, 0.2309007175, 0.2814269324, 0.0333575846, 0.0954856721, 0.4336162022, 0.4869919999, 0.0999037227, 0.4140163411, 0.2186642739, 0.4236785817 }, + { 0.6505197354, 0.7832767666, 0.7627669547, 0.6132117530, 0.9505281166, 0.7364502200, 0.2897242469, 0.3402504618, 0.0921811140, 0.1543092016, 0.4924397316, 0.5458155293, 0.1587272521, 0.4728398705, 0.2774878033, 0.4825021111 }, + { 0.7093432648, 0.8421002960, 0.8215904841, 0.6720352824, 0.0093516460, 0.7952737494, 0.3485477763, 0.3990739913, 0.1510046434, 0.2131327310, 0.5512632610, 0.6046390587, 0.2175507815, 0.5316633999, 0.3363113328, 0.5413256405 }, + { 0.7681667943, 0.9009238254, 0.8804140135, 0.7308588118, 0.0681751754, 0.8540972788, 0.4073713057, 0.4578975207, 0.2098281728, 0.2719562604, 0.6100867904, 0.6634625881, 0.2763743109, 0.5904869293, 0.3951348622, 0.6001491700 }, + { 0.8269903237, 0.9597473548, 0.9392375429, 0.7896823412, 0.1269987048, 0.9129208082, 0.4661948351, 0.5167210501, 0.2686517022, 0.3307797898, 0.6689103198, 0.7222861175, 0.3351978403, 0.6493104587, 0.4539583916, 0.6589726994 }, + { 0.8858138531, 0.0185708843, 0.9980610723, 0.8485058707, 0.1858222342, 0.9717443376, 0.5250183645, 0.5755445795, 0.3274752317, 0.3896033192, 0.7277338493, 0.7811096470, 0.3940213698, 0.7081339881, 0.5127819210, 0.7177962288 }, + { 0.9446373825, 0.0773944137, 0.0568846018, 0.9073294001, 0.2446457636, 0.0305678670, 0.5838418939, 0.6343681089, 0.3862987611, 0.4484268486, 0.7865573787, 0.8399331764, 0.4528448992, 0.7669575176, 0.5716054504, 0.7766197582 }, + { 0.0069211195, 0.1985016801, 0.1779918682, 0.1460837253, 0.5422236183, 0.3869692511, 0.9990668074, 0.1084165518, 0.9191707334, 0.0401223503, 0.4370764098, 0.5492757369, 0.2210109891, 0.5939471369, 0.4574185992, 0.7212564364 }, + { 0.0657446489, 0.2573252095, 0.2368153976, 0.2049072547, 0.6010471477, 0.4457927805, 0.0578903368, 0.1672400812, 0.9779942628, 0.0989458798, 0.4958999392, 0.6080992663, 0.2798345185, 0.6527706663, 0.5162421286, 0.7800799658 }, + { 0.1245681783, 0.3161487389, 0.2956389270, 0.2637307842, 0.6598706771, 0.5046163100, 0.1167138663, 0.2260636106, 0.0368177922, 0.1577694092, 0.5547234686, 0.6669227957, 0.3386580480, 0.7115941958, 0.5750656580, 0.8389034952 }, + { 0.1833917078, 0.3749722683, 0.3544624564, 0.3225543136, 0.7186942065, 0.5634398394, 0.1755373957, 0.2848871400, 0.0956413216, 0.2165929386, 0.6135469980, 0.7257463252, 0.3974815774, 0.7704177252, 0.6338891874, 0.8977270246 }, + { 0.2422152372, 0.4337957977, 0.4132859858, 0.3813778430, 0.7775177359, 0.6222633688, 0.2343609251, 0.3437106695, 0.1544648510, 0.2754164680, 0.6723705275, 0.7845698546, 0.4563051068, 0.8292412546, 0.6927127168, 0.9565505540 }, + { 0.3010387666, 0.4926193272, 0.4721095153, 0.4402013724, 0.8363412654, 0.6810868982, 0.2931844545, 0.4025341989, 0.2132883804, 0.3342399974, 0.7311940569, 0.8433933840, 0.5151286362, 0.8880647840, 0.7515362463, 0.0153740834 }, + { 0.3598622960, 0.5514428566, 0.5309330447, 0.4990249018, 0.8951647948, 0.7399104276, 0.3520079839, 0.4613577283, 0.2721119099, 0.3930635268, 0.7900175863, 0.9022169134, 0.5739521656, 0.9468883134, 0.8103597757, 0.0741976129 }, + { 0.4186858254, 0.6102663860, 0.5897565741, 0.5578484312, 0.9539883242, 0.7987339570, 0.4108315133, 0.5201812577, 0.3309354393, 0.4518870562, 0.8488411157, 0.9610404428, 0.6327756950, 0.0057118428, 0.8691833051, 0.1330211423 }, + { 0.4775093548, 0.6690899154, 0.6485801035, 0.6166719606, 0.0128118536, 0.8575574864, 0.4696550427, 0.5790047871, 0.3897589687, 0.5107105856, 0.9076646451, 0.0198639722, 0.6915992244, 0.0645353722, 0.9280068345, 0.1918446717 }, + { 0.5363328842, 0.7279134448, 0.7074036329, 0.6754954900, 0.0716353830, 0.9163810158, 0.5284785721, 0.6378283165, 0.4485824981, 0.5695341151, 0.9664881745, 0.0786875016, 0.7504227538, 0.1233589016, 0.9868303639, 0.2506682011 }, + { 0.5951564136, 0.7867369742, 0.7662271623, 0.7343190195, 0.1304589124, 0.9752045452, 0.5873021015, 0.6966518459, 0.5074060275, 0.6283576445, 0.0253117039, 0.1375110310, 0.8092462833, 0.1821824310, 0.0456538933, 0.3094917305 }, + { 0.6539799431, 0.8455605036, 0.8250506917, 0.7931425489, 0.1892824418, 0.0340280747, 0.6461256310, 0.7554753753, 0.5662295569, 0.6871811739, 0.0841352333, 0.1963345605, 0.8680698127, 0.2410059605, 0.1044774227, 0.3683152599 }, + { 0.7128034725, 0.9043840330, 0.8838742211, 0.8519660783, 0.2481059712, 0.0928516041, 0.7049491604, 0.8142989047, 0.6250530863, 0.7460047033, 0.1429587627, 0.2551580899, 0.9268933421, 0.2998294899, 0.1633009521, 0.4271387893 }, + { 0.7716270019, 0.9632075625, 0.9426977505, 0.9107896077, 0.3069295006, 0.1516751335, 0.7637726898, 0.8731224342, 0.6838766157, 0.8048282327, 0.2017822922, 0.3139816193, 0.9857168715, 0.3586530193, 0.2221244815, 0.4859623187 }, + { 0.8304505313, 0.0220310919, 0.0015212800, 0.9696131371, 0.3657530301, 0.2104986629, 0.8225962192, 0.9319459636, 0.7427001452, 0.8636517621, 0.2606058216, 0.3728051487, 0.0445404009, 0.4174765487, 0.2809480110, 0.5447858482 }, + { 0.8892740607, 0.0808546213, 0.0603448094, 0.0284366665, 0.4245765595, 0.2693221923, 0.8814197486, 0.9907694930, 0.8015236746, 0.9224752915, 0.3194293510, 0.4316286781, 0.1033639303, 0.4763000781, 0.3397715404, 0.6036093776 }, + { 0.9480975901, 0.1396781507, 0.1191683388, 0.0872601959, 0.4834000889, 0.3281457217, 0.9402432780, 0.0495930224, 0.8603472040, 0.9812988209, 0.3782528804, 0.4904522075, 0.1621874597, 0.5351236075, 0.3985950698, 0.6624329070 }, + { 0.0103813271, 0.2607854171, 0.2990991346, 0.3260145212, 0.7809779436, 0.6845471058, 0.2966446621, 0.5236414653, 0.3932191763, 0.5729943227, 0.0287719115, 0.1997947681, 0.9303535497, 0.3621132269, 0.2844082186, 0.6070695852 }, + { 0.0692048565, 0.3196089465, 0.3579226640, 0.3848380506, 0.8398014730, 0.7433706352, 0.3554681915, 0.5824649947, 0.4520427057, 0.6318178521, 0.0875954409, 0.2586182975, 0.9891770791, 0.4209367563, 0.3432317480, 0.6658931146 }, + { 0.1280283860, 0.3784324759, 0.4167461935, 0.4436615800, 0.8986250024, 0.8021941646, 0.4142917209, 0.6412885241, 0.5108662351, 0.6906413815, 0.1464189704, 0.3174418269, 0.0480006085, 0.4797602857, 0.4020552774, 0.7247166440 }, + { 0.1868519154, 0.4372560054, 0.4755697229, 0.5024851094, 0.9574485318, 0.8610176940, 0.4731152503, 0.7001120535, 0.5696897645, 0.7494649109, 0.2052424998, 0.3762653563, 0.1068241379, 0.5385838151, 0.4608788068, 0.7835401734 }, + { 0.2456754448, 0.4960795348, 0.5343932523, 0.5613086388, 0.0162720612, 0.9198412234, 0.5319387798, 0.7589355829, 0.6285132939, 0.8082884403, 0.2640660292, 0.4350888857, 0.1656476673, 0.5974073445, 0.5197023362, 0.8423637028 }, + { 0.3044989742, 0.5549030642, 0.5932167817, 0.6201321682, 0.0750955906, 0.9786647529, 0.5907623092, 0.8177591124, 0.6873368234, 0.8671119697, 0.3228895586, 0.4939124151, 0.2244711967, 0.6562308740, 0.5785258656, 0.9011872322 }, + { 0.3633225036, 0.6137265936, 0.6520403111, 0.6789556977, 0.1339191200, 0.0374882823, 0.6495858386, 0.8765826418, 0.7461603528, 0.9259354991, 0.3817130880, 0.5527359445, 0.2832947262, 0.7150544034, 0.6373493950, 0.9600107616 }, + { 0.4221460330, 0.6725501230, 0.7108638405, 0.7377792271, 0.1927426494, 0.0963118117, 0.7084093680, 0.9354061712, 0.8049838822, 0.9847590286, 0.4405366174, 0.6115594739, 0.3421182556, 0.7738779328, 0.6961729245, 0.0188342911 }, + { 0.4809695624, 0.7313736524, 0.7696873699, 0.7966027565, 0.2515661788, 0.1551353411, 0.7672328974, 0.9942297006, 0.8638074116, 0.0435825580, 0.4993601468, 0.6703830034, 0.4009417850, 0.8327014622, 0.7549964539, 0.0776578205 }, + { 0.5397930918, 0.7901971818, 0.8285108993, 0.8554262859, 0.3103897083, 0.2139588705, 0.8260564268, 0.0530532300, 0.9226309410, 0.1024060874, 0.5581836762, 0.7292065328, 0.4597653144, 0.8915249916, 0.8138199833, 0.1364813499 }, + { 0.5986166213, 0.8490207112, 0.8873344287, 0.9142498153, 0.3692132377, 0.2727823999, 0.8848799562, 0.1118767594, 0.9814544704, 0.1612296168, 0.6170072057, 0.7880300622, 0.5185888438, 0.9503485210, 0.8726435127, 0.1953048793 }, + { 0.6574401507, 0.9078442407, 0.9461579582, 0.9730733447, 0.4280367671, 0.3316059293, 0.9437034856, 0.1707002888, 0.0402779998, 0.2200531462, 0.6758307351, 0.8468535916, 0.5774123732, 0.0091720504, 0.9314670421, 0.2541284087 }, + { 0.7162636801, 0.9666677701, 0.0049814876, 0.0318968741, 0.4868602965, 0.3904294587, 0.0025270150, 0.2295238182, 0.0991015292, 0.2788766756, 0.7346542645, 0.9056771210, 0.6362359026, 0.0679955798, 0.9902905715, 0.3129519381 }, + { 0.7750872095, 0.0254912995, 0.0638050170, 0.0907204035, 0.5456838259, 0.4492529882, 0.0613505445, 0.2883473477, 0.1579250587, 0.3377002050, 0.7934777939, 0.9645006504, 0.6950594320, 0.1268191092, 0.0491141009, 0.3717754675 }, + { 0.8339107389, 0.0843148289, 0.1226285464, 0.1495439329, 0.6045073553, 0.5080765176, 0.1201740739, 0.3471708771, 0.2167485881, 0.3965237344, 0.8523013233, 0.0233241798, 0.7538829615, 0.1856426387, 0.1079376303, 0.4305989969 }, + { 0.8927342683, 0.1431383583, 0.1814520758, 0.2083674624, 0.6633308847, 0.5669000470, 0.1789976033, 0.4059944065, 0.2755721175, 0.4553472638, 0.9111248527, 0.0821477092, 0.8127064909, 0.2444661681, 0.1667611598, 0.4894225264 }, + { 0.9515577977, 0.2019618877, 0.2402756052, 0.2671909918, 0.7221544141, 0.6257235764, 0.2378211327, 0.4648179359, 0.3343956469, 0.5141707933, 0.9699483821, 0.1409712387, 0.8715300203, 0.3032896975, 0.2255846892, 0.5482460558 }, + { 0.0138415347, 0.3230691541, 0.4202064011, 0.5059453170, 0.0197322688, 0.9821249605, 0.6530460462, 0.9388663788, 0.8672676192, 0.1058662950, 0.6204674133, 0.8503137992, 0.6396961102, 0.1302793169, 0.1113978380, 0.4928827340 }, + { 0.0726650642, 0.3818926836, 0.4790299305, 0.5647688464, 0.0785557982, 0.0409484899, 0.7118695756, 0.9976899082, 0.9260911486, 0.1646898244, 0.6792909427, 0.9091373286, 0.6985196397, 0.1891028463, 0.1702213674, 0.5517062634 }, + { 0.1314885936, 0.4407162130, 0.5378534599, 0.6235923759, 0.1373793276, 0.0997720193, 0.7706931050, 0.0565134376, 0.9849146780, 0.2235133538, 0.7381144721, 0.9679608580, 0.7573431691, 0.2479263757, 0.2290448968, 0.6105297928 }, + { 0.1903121230, 0.4995397424, 0.5966769893, 0.6824159053, 0.1962028570, 0.1585955487, 0.8295166344, 0.1153369670, 0.0437382074, 0.2823368832, 0.7969380015, 0.0267843874, 0.8161666985, 0.3067499051, 0.2878684262, 0.6693533222 }, + { 0.2491356524, 0.5583632718, 0.6555005187, 0.7412394347, 0.2550263865, 0.2174190781, 0.8883401638, 0.1741604964, 0.1025617369, 0.3411604126, 0.8557615309, 0.0856079169, 0.8749902279, 0.3655734345, 0.3466919556, 0.7281768516 }, + { 0.3079591818, 0.6171868012, 0.7143240481, 0.8000629641, 0.3138499159, 0.2762426075, 0.9471636932, 0.2329840259, 0.1613852663, 0.3999839420, 0.9145850603, 0.1444314463, 0.9338137573, 0.4243969639, 0.4055154850, 0.7870003810 }, + { 0.3667827112, 0.6760103306, 0.7731475775, 0.8588864935, 0.3726734453, 0.3350661369, 0.0059872227, 0.2918075553, 0.2202087957, 0.4588074715, 0.9734085897, 0.2032549757, 0.9926372867, 0.4832204933, 0.4643390144, 0.8458239104 }, + { 0.4256062406, 0.7348338600, 0.8319711069, 0.9177100229, 0.4314969747, 0.3938896664, 0.0648107521, 0.3506310847, 0.2790323251, 0.5176310009, 0.0322321192, 0.2620785051, 0.0514608161, 0.5420440227, 0.5231625438, 0.9046474398 }, + { 0.4844297700, 0.7936573894, 0.8907946364, 0.9765335523, 0.4903205041, 0.4527131958, 0.1236342815, 0.4094546141, 0.3378558545, 0.5764545303, 0.0910556486, 0.3209020345, 0.1102843455, 0.6008675522, 0.5819860732, 0.9634709693 }, + { 0.5432532995, 0.8524809189, 0.9496181658, 0.0353570817, 0.5491440335, 0.5115367252, 0.1824578109, 0.4682781435, 0.3966793839, 0.6352780597, 0.1498791780, 0.3797255639, 0.1691078749, 0.6596910816, 0.6408096027, 0.0222944987 }, + { 0.6020768289, 0.9113044483, 0.0084416952, 0.0941806111, 0.6079675629, 0.5703602546, 0.2412813403, 0.5271016729, 0.4555029133, 0.6941015891, 0.2087027074, 0.4385490933, 0.2279314044, 0.7185146110, 0.6996331321, 0.0811180281 }, + { 0.6609003583, 0.9701279777, 0.0672652246, 0.1530041406, 0.6667910923, 0.6291837840, 0.3001048697, 0.5859252023, 0.5143264427, 0.7529251185, 0.2675262368, 0.4973726227, 0.2867549338, 0.7773381404, 0.7584566615, 0.1399415575 }, + { 0.7197238877, 0.0289515071, 0.1260887540, 0.2118276700, 0.7256146218, 0.6880073134, 0.3589283991, 0.6447487317, 0.5731499721, 0.8117486479, 0.3263497662, 0.5561961521, 0.3455784632, 0.8361616698, 0.8172801909, 0.1987650869 }, + { 0.7785474171, 0.0877750365, 0.1849122834, 0.2706511994, 0.7844381512, 0.7468308428, 0.4177519285, 0.7035722612, 0.6319735016, 0.8705721773, 0.3851732956, 0.6150196816, 0.4044019926, 0.8949851992, 0.8761037203, 0.2575886163 }, + { 0.8373709465, 0.1465985659, 0.2437358128, 0.3294747288, 0.8432616806, 0.8056543722, 0.4765754580, 0.7623957906, 0.6907970310, 0.9293957068, 0.4439968250, 0.6738432110, 0.4632255220, 0.9538087286, 0.9349272497, 0.3164121457 }, + { 0.8961944759, 0.2054220953, 0.3025593422, 0.3882982582, 0.9020852100, 0.8644779016, 0.5353989874, 0.8212193200, 0.7496205604, 0.9882192362, 0.5028203544, 0.7326667404, 0.5220490514, 0.0126322580, 0.9937507791, 0.3752356751 }, + { 0.9550180053, 0.2642456247, 0.3613828717, 0.4471217876, 0.9609087394, 0.9233014311, 0.5942225168, 0.8800428494, 0.8084440898, 0.0470427656, 0.5616438839, 0.7914902698, 0.5808725808, 0.0714557874, 0.0525743085, 0.4340592046 }, + { 0.0173017424, 0.3853528912, 0.5413136675, 0.6858761129, 0.2584865941, 0.2797028151, 0.0094474303, 0.2952677629, 0.3413160621, 0.6387382673, 0.2121629150, 0.5008328303, 0.3490386708, 0.8984454068, 0.9383874573, 0.3786958828 }, + { 0.0761252718, 0.4441764206, 0.6001371969, 0.7446996423, 0.3173101235, 0.3385263446, 0.0682709597, 0.3540912923, 0.4001395915, 0.6975617967, 0.2709864444, 0.5596563598, 0.4078622002, 0.9572689362, 0.9972109867, 0.4375194122 }, + { 0.1349488012, 0.5029999500, 0.6589607263, 0.8035231717, 0.3761336529, 0.3973498740, 0.1270944891, 0.4129148217, 0.4589631209, 0.7563853261, 0.3298099738, 0.6184798892, 0.4666857296, 0.0160924656, 0.0560345162, 0.4963429416 }, + { 0.1937723306, 0.5618234794, 0.7177842557, 0.8623467011, 0.4349571823, 0.4561734034, 0.1859180185, 0.4717383511, 0.5177866503, 0.8152088555, 0.3886335032, 0.6773034186, 0.5255092590, 0.0749159951, 0.1148580456, 0.5551664710 }, + { 0.2525958600, 0.6206470088, 0.7766077852, 0.9211702305, 0.4937807117, 0.5149969328, 0.2447415479, 0.5305618805, 0.5766101798, 0.8740323850, 0.4474570326, 0.7361269480, 0.5843327884, 0.1337395245, 0.1736815750, 0.6139900004 }, + { 0.3114193894, 0.6794705382, 0.8354313146, 0.9799937599, 0.5526042411, 0.5738204622, 0.3035650773, 0.5893854099, 0.6354337092, 0.9328559144, 0.5062805621, 0.7949504774, 0.6431563179, 0.1925630539, 0.2325051044, 0.6728135298 }, + { 0.3702429188, 0.7382940676, 0.8942548440, 0.0388172893, 0.6114277705, 0.6326439916, 0.3623886067, 0.6482089394, 0.6942572386, 0.9916794438, 0.5651040915, 0.8537740068, 0.7019798473, 0.2513865833, 0.2913286338, 0.7316370592 }, + { 0.4290664482, 0.7971175971, 0.9530783734, 0.0976408188, 0.6702513000, 0.6914675210, 0.4212121362, 0.7070324688, 0.7530807680, 0.0505029732, 0.6239276209, 0.9125975362, 0.7608033767, 0.3102101127, 0.3501521632, 0.7904605886 }, + { 0.4878899777, 0.8559411265, 0.0119019028, 0.1564643482, 0.7290748294, 0.7502910504, 0.4800356656, 0.7658559982, 0.8119042974, 0.1093265026, 0.6827511503, 0.9714210656, 0.8196269061, 0.3690336421, 0.4089756926, 0.8492841180 }, + { 0.5467135071, 0.9147646559, 0.0707254322, 0.2152878776, 0.7878983588, 0.8091145798, 0.5388591950, 0.8246795276, 0.8707278268, 0.1681500320, 0.7415746797, 0.0302445951, 0.8784504355, 0.4278571715, 0.4677992220, 0.9081076475 }, + { 0.6055370365, 0.9735881853, 0.1295489616, 0.2741114070, 0.8467218882, 0.8679381093, 0.5976827244, 0.8835030570, 0.9295513562, 0.2269735614, 0.8003982091, 0.0890681245, 0.9372739649, 0.4866807009, 0.5266227514, 0.9669311769 }, + { 0.6643605659, 0.0324117147, 0.1883724910, 0.3329349364, 0.9055454176, 0.9267616387, 0.6565062538, 0.9423265864, 0.9883748856, 0.2857970908, 0.8592217385, 0.1478916539, 0.9960974943, 0.5455042304, 0.5854462809, 0.0257547063 }, + { 0.7231840953, 0.0912352441, 0.2471960204, 0.3917584658, 0.9643689470, 0.9855851681, 0.7153297832, 0.0011501158, 0.0471984151, 0.3446206202, 0.9180452679, 0.2067151833, 0.0549210237, 0.6043277598, 0.6442698103, 0.0845782357 }, + { 0.7820076247, 0.1500587735, 0.3060195499, 0.4505819952, 0.0231924764, 0.0444086975, 0.7741533126, 0.0599736452, 0.1060219445, 0.4034441497, 0.9768687974, 0.2655387127, 0.1137445531, 0.6631512892, 0.7030933397, 0.1434017651 } +}; + + +QRNG_VALIDATION_TEST_FUNCTIONS(faure) + + +BOOST_AUTO_TEST_CASE( validate_faure ) +{ + test_faure_values(faure_02_100, 15); + test_faure_values(faure_07_100, 2400); + test_faure_values(faure_16_100, 83520); +} + +BOOST_AUTO_TEST_CASE( validate_faure_seed ) +{ + test_faure_seed(faure_02_100, 15); + test_faure_seed(faure_07_100, 2400); + test_faure_seed(faure_16_100, 83520); +} + +BOOST_AUTO_TEST_CASE( validate_faure_discard ) +{ + test_faure_discard(faure_02_100, 15); + test_faure_discard(faure_07_100, 2400); + test_faure_discard(faure_16_100, 83520); +} diff --git a/test/niederreiter_base2_validade.cpp b/test/niederreiter_base2_validade.cpp new file mode 100644 index 0000000..7eca8af --- /dev/null +++ b/test/niederreiter_base2_validade.cpp @@ -0,0 +1,372 @@ +// Copyright Justinas Vygintas Daugmaudis, 2010. +// Use, modification and distribution is subject to the +// Boost Software License, Version 1.0. (See accompanying +// file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0) + +#include + +#include + +#define BOOST_TEST_MAIN +#include + +#include "test_qrng_functions.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the faure quasi-random number generator. +// These tests compare our results with values produced by the original +// version of ACM TOMS Algorithm 738, which is available in the +// TOMS subdirectory in http://www.netlib.org +// +// For independently generated datasets look at http://people.sc.fsu.edu/~jburkardt/datasets/niederreiter2/ + + +// Spatial dimension: 2 +// N: 100 +// Vectors skipped: 4096 +static const double niederreiter_base2_02_100[100][2] = +{ + { 0.0003662109, 0.4705810548 }, + { 0.5003662111, 0.9705810549 }, + { 0.7503662111, 0.2205810547 }, + { 0.2503662110, 0.7205810549 }, + { 0.3753662110, 0.0955810547 }, + { 0.8753662111, 0.5955810548 }, + { 0.6253662111, 0.3455810548 }, + { 0.1253662110, 0.8455810549 }, + { 0.1878662110, 0.1580810547 }, + { 0.6878662111, 0.6580810548 }, + { 0.9378662112, 0.4080810548 }, + { 0.4378662110, 0.9080810549 }, + { 0.3128662110, 0.2830810548 }, + { 0.8128662111, 0.7830810549 }, + { 0.5628662111, 0.0330810547 }, + { 0.0628662110, 0.5330810548 }, + { 0.0941162110, 0.0018310547 }, + { 0.5941162111, 0.5018310548 }, + { 0.8441162111, 0.2518310547 }, + { 0.3441162110, 0.7518310549 }, + { 0.4691162110, 0.3768310548 }, + { 0.9691162112, 0.8768310549 }, + { 0.7191162111, 0.1268310547 }, + { 0.2191162110, 0.6268310548 }, + { 0.1566162110, 0.3143310548 }, + { 0.6566162111, 0.8143310549 }, + { 0.9066162111, 0.0643310547 }, + { 0.4066162110, 0.5643310548 }, + { 0.2816162110, 0.1893310547 }, + { 0.7816162111, 0.6893310548 }, + { 0.5316162111, 0.4393310548 }, + { 0.0316162109, 0.9393310549 }, + { 0.0472412109, 0.2362060547 }, + { 0.5472412111, 0.7362060549 }, + { 0.7972412111, 0.4862060548 }, + { 0.2972412110, 0.9862060549 }, + { 0.4222412110, 0.3612060548 }, + { 0.9222412112, 0.8612060549 }, + { 0.6722412111, 0.1112060547 }, + { 0.1722412110, 0.6112060548 }, + { 0.2347412110, 0.4237060548 }, + { 0.7347412111, 0.9237060549 }, + { 0.9847412112, 0.1737060547 }, + { 0.4847412111, 0.6737060548 }, + { 0.3597412110, 0.0487060547 }, + { 0.8597412111, 0.5487060548 }, + { 0.6097412111, 0.2987060548 }, + { 0.1097412110, 0.7987060549 }, + { 0.0784912110, 0.2674560547 }, + { 0.5784912111, 0.7674560549 }, + { 0.8284912111, 0.0174560547 }, + { 0.3284912110, 0.5174560548 }, + { 0.4534912110, 0.1424560547 }, + { 0.9534912112, 0.6424560548 }, + { 0.7034912111, 0.3924560548 }, + { 0.2034912110, 0.8924560549 }, + { 0.1409912110, 0.0799560547 }, + { 0.6409912111, 0.5799560548 }, + { 0.8909912111, 0.3299560548 }, + { 0.3909912110, 0.8299560549 }, + { 0.2659912110, 0.4549560548 }, + { 0.7659912111, 0.9549560549 }, + { 0.5159912111, 0.2049560547 }, + { 0.0159912109, 0.7049560549 }, + { 0.0238037109, 0.1190185547 }, + { 0.5238037111, 0.6190185548 }, + { 0.7738037111, 0.3690185548 }, + { 0.2738037110, 0.8690185549 }, + { 0.3988037110, 0.4940185548 }, + { 0.8988037111, 0.9940185549 }, + { 0.6488037111, 0.2440185547 }, + { 0.1488037110, 0.7440185549 }, + { 0.2113037110, 0.3065185548 }, + { 0.7113037111, 0.8065185549 }, + { 0.9613037112, 0.0565185547 }, + { 0.4613037110, 0.5565185548 }, + { 0.3363037110, 0.1815185547 }, + { 0.8363037111, 0.6815185548 }, + { 0.5863037111, 0.4315185548 }, + { 0.0863037110, 0.9315185549 }, + { 0.1175537110, 0.4002685548 }, + { 0.6175537111, 0.9002685549 }, + { 0.8675537111, 0.1502685547 }, + { 0.3675537110, 0.6502685548 }, + { 0.4925537111, 0.0252685547 }, + { 0.9925537112, 0.5252685548 }, + { 0.7425537111, 0.2752685548 }, + { 0.2425537110, 0.7752685549 }, + { 0.1800537110, 0.2127685547 }, + { 0.6800537111, 0.7127685549 }, + { 0.9300537112, 0.4627685548 }, + { 0.4300537110, 0.9627685549 }, + { 0.3050537110, 0.3377685548 }, + { 0.8050537111, 0.8377685549 }, + { 0.5550537111, 0.0877685547 }, + { 0.0550537110, 0.5877685548 }, + { 0.0394287109, 0.3533935548 }, + { 0.5394287111, 0.8533935549 }, + { 0.7894287111, 0.1033935547 }, + { 0.2894287110, 0.6033935548 } +}; + +// Spatial dimension: 7 +// N: 100 +// Vectors skipped: 4096 +static const double niederreiter_base2_07_100[100][7] = +{ + { 0.0003662109, 0.4705810548, 0.6358642580, 0.9561767580, 0.6715087892, 0.9793701174, 0.6053466798 }, + { 0.5003662111, 0.9705810549, 0.3858642579, 0.0811767578, 0.2965087891, 0.0418701172, 0.4178466798 }, + { 0.7503662111, 0.2205810547, 0.9483642580, 0.8155517580, 0.5621337892, 0.9207763674, 0.5467529298 }, + { 0.2503662110, 0.7205810549, 0.1983642579, 0.1905517579, 0.4371337892, 0.1082763672, 0.4842529298 }, + { 0.3753662110, 0.0955810547, 0.2608642579, 0.7374267580, 0.7652587892, 0.8465576174, 0.6600341798 }, + { 0.8753662111, 0.5955810548, 0.5108642579, 0.3624267579, 0.1402587891, 0.1590576172, 0.3475341798 }, + { 0.6253662111, 0.3455810548, 0.0733642578, 0.5968017580, 0.9058837893, 0.7879638674, 0.7264404299 }, + { 0.1253662110, 0.8455810549, 0.8233642580, 0.4718017579, 0.0308837891, 0.2254638672, 0.2889404298 }, + { 0.1878662110, 0.1580810547, 0.1514892578, 0.2686767579, 0.3590087891, 0.7449951174, 0.9334716799 }, + { 0.6878662111, 0.6580810548, 0.9014892580, 0.6436767580, 0.7340087892, 0.3074951173, 0.1209716797 }, + { 0.9378662112, 0.4080810548, 0.4639892579, 0.3780517579, 0.4996337892, 0.6864013673, 0.9998779299 }, + { 0.4378662110, 0.9080810549, 0.7139892580, 0.5030517579, 0.6246337892, 0.3739013673, 0.0623779297 }, + { 0.3128662110, 0.2830810548, 0.7764892580, 0.0499267578, 0.2027587891, 0.6121826173, 0.8631591799 }, + { 0.8128662111, 0.7830810549, 0.0264892578, 0.9249267580, 0.8277587893, 0.4246826173, 0.1756591797 }, + { 0.5628662111, 0.0330810547, 0.5889892579, 0.1593017578, 0.0933837891, 0.5535888673, 0.8045654299 }, + { 0.0628662110, 0.5330810548, 0.3389892579, 0.7843017580, 0.9683837893, 0.4910888673, 0.2420654297 }, + { 0.0941162110, 0.0018310547, 0.9171142580, 0.5635986329, 0.4195556642, 0.3856201173, 0.3865966798 }, + { 0.5941162111, 0.5018310548, 0.1671142579, 0.4385986329, 0.5445556642, 0.5731201173, 0.5740966798 }, + { 0.8441162111, 0.2518310547, 0.7296142580, 0.7042236330, 0.3101806641, 0.4520263673, 0.4530029298 }, + { 0.3441162110, 0.7518310549, 0.4796142579, 0.3292236329, 0.6851806642, 0.5145263673, 0.5155029298 }, + { 0.4691162110, 0.3768310548, 0.0421142578, 0.8448486330, 0.0133056641, 0.2528076172, 0.3162841798 }, + { 0.9691162112, 0.8768310549, 0.7921142580, 0.2198486329, 0.8883056643, 0.6903076173, 0.6287841798 }, + { 0.7191162111, 0.1268310547, 0.3546142579, 0.9854736330, 0.1539306641, 0.3192138673, 0.2576904297 }, + { 0.2191162110, 0.6268310548, 0.6046142580, 0.1104736328, 0.7789306642, 0.6317138673, 0.6951904298 }, + { 0.1566162110, 0.3143310548, 0.4327392579, 0.1260986328, 0.6070556642, 0.1512451172, 0.0897216797 }, + { 0.6566162111, 0.8143310549, 0.6827392580, 0.7510986330, 0.4820556642, 0.8387451174, 0.9022216799 }, + { 0.9066162111, 0.0643310547, 0.2452392579, 0.0167236328, 0.7476806642, 0.2176513672, 0.0311279297 }, + { 0.4066162110, 0.5643310548, 0.9952392580, 0.8917236330, 0.3726806641, 0.7801513674, 0.9686279299 }, + { 0.2816162110, 0.1893310547, 0.5577392579, 0.4073486329, 0.9508056643, 0.0184326172, 0.1444091797 }, + { 0.7816162111, 0.6893310548, 0.3077392579, 0.5323486329, 0.0758056641, 0.9559326174, 0.8319091799 }, + { 0.5316162111, 0.4393310548, 0.8702392580, 0.2979736329, 0.8414306643, 0.0848388672, 0.2108154297 }, + { 0.0316162109, 0.9393310549, 0.1202392578, 0.6729736330, 0.2164306641, 0.8973388674, 0.7733154299 }, + { 0.0472412109, 0.2362060547, 0.4522705079, 0.1007080078, 0.0426025391, 0.7955322267, 0.4801025392 }, + { 0.5472412111, 0.7362060549, 0.7022705080, 0.9757080080, 0.9176025393, 0.2330322266, 0.5426025392 }, + { 0.7972412111, 0.4862060548, 0.1397705078, 0.2413330079, 0.1832275391, 0.8541259768, 0.4215087892 }, + { 0.2972412110, 0.9862060549, 0.8897705080, 0.8663330080, 0.8082275393, 0.1666259766, 0.6090087892 }, + { 0.4222412110, 0.3612060548, 0.5772705079, 0.3194580079, 0.3863525392, 0.9127197268, 0.2847900391 }, + { 0.9222412112, 0.8612060549, 0.3272705079, 0.6944580080, 0.5113525392, 0.1002197266, 0.7222900392 }, + { 0.6722412111, 0.1112060547, 0.7647705080, 0.4600830079, 0.2769775391, 0.9713134768, 0.3511962891 }, + { 0.1722412110, 0.6112060548, 0.0147705078, 0.5850830079, 0.6519775392, 0.0338134766, 0.6636962892 }, + { 0.2347412110, 0.4237060548, 0.9678955080, 0.6632080080, 0.9801025393, 0.5611572267, 0.0582275391 }, + { 0.7347412111, 0.9237060549, 0.2178955079, 0.2882080079, 0.1051025391, 0.4986572267, 0.9957275393 }, + { 0.9847412112, 0.1737060547, 0.6553955080, 0.5538330079, 0.8707275393, 0.6197509767, 0.1246337891 }, + { 0.4847412111, 0.6737060548, 0.4053955079, 0.4288330079, 0.2457275391, 0.4322509767, 0.9371337893 }, + { 0.3597412110, 0.0487060547, 0.0928955078, 0.8819580080, 0.5738525392, 0.6783447267, 0.2379150391 }, + { 0.8597412111, 0.5487060548, 0.8428955080, 0.0069580078, 0.4488525392, 0.3658447266, 0.8004150392 }, + { 0.6097412111, 0.2987060548, 0.2803955079, 0.7725830080, 0.7144775392, 0.7369384767, 0.1793212891 }, + { 0.1097412110, 0.7987060549, 0.5303955079, 0.1475830078, 0.3394775391, 0.2994384766, 0.8668212893 }, + { 0.0784912110, 0.2674560547, 0.2335205079, 0.4893798829, 0.7906494142, 0.3267822266, 0.5113525392 }, + { 0.5784912111, 0.7674560549, 0.9835205080, 0.6143798830, 0.1656494141, 0.6392822267, 0.4488525392 }, + { 0.8284912111, 0.0174560547, 0.4210205079, 0.3487548829, 0.9312744143, 0.2603759766, 0.5777587892 }, + { 0.3284912110, 0.5174560548, 0.6710205080, 0.7237548830, 0.0562744141, 0.6978759767, 0.3902587892 }, + { 0.4534912110, 0.1424560547, 0.8585205080, 0.2081298829, 0.6343994142, 0.4439697267, 0.6910400392 }, + { 0.9534912112, 0.6424560548, 0.1085205078, 0.8331298830, 0.2593994141, 0.5064697267, 0.2535400391 }, + { 0.7034912111, 0.3924560548, 0.5460205079, 0.0675048828, 0.5250244142, 0.3775634767, 0.6324462892 }, + { 0.2034912110, 0.8924560549, 0.2960205079, 0.9425048830, 0.4000244142, 0.5650634767, 0.3199462891 }, + { 0.1409912110, 0.0799560547, 0.7491455080, 0.8018798830, 0.2281494141, 0.0924072266, 0.9644775393 }, + { 0.6409912111, 0.5799560548, 0.4991455079, 0.1768798829, 0.8531494143, 0.9049072268, 0.0269775391 }, + { 0.8909912111, 0.3299560548, 0.9366455080, 0.9112548830, 0.1187744141, 0.0260009766, 0.9058837893 }, + { 0.3909912110, 0.8299560549, 0.1866455079, 0.0362548828, 0.9937744143, 0.9635009768, 0.0933837891 }, + { 0.2659912110, 0.4549560548, 0.3741455079, 0.5206298829, 0.3218994141, 0.2095947266, 0.7691650392 }, + { 0.7659912111, 0.9549560549, 0.6241455080, 0.3956298829, 0.6968994142, 0.7720947267, 0.2066650391 }, + { 0.5159912111, 0.2049560547, 0.0616455078, 0.6300048830, 0.4625244142, 0.1431884766, 0.8355712893 }, + { 0.0159912109, 0.7049560549, 0.8116455080, 0.2550048829, 0.5875244142, 0.8306884768, 0.1480712891 }, + { 0.0238037109, 0.1190185547, 0.0186767578, 0.1827392579, 0.9136962893, 0.5960693361, 0.2923583985 }, + { 0.5238037111, 0.6190185548, 0.7686767580, 0.8077392580, 0.0386962891, 0.4085693360, 0.7298583986 }, + { 0.7738037111, 0.3690185548, 0.3311767579, 0.0421142578, 0.8043212892, 0.5374755861, 0.3587646485 }, + { 0.2738037110, 0.8690185549, 0.5811767579, 0.9171142580, 0.1793212891, 0.4749755860, 0.6712646486 }, + { 0.3988037110, 0.4940185548, 0.8936767580, 0.4014892579, 0.5074462892, 0.7288818361, 0.4720458985 }, + { 0.8988037111, 0.9940185549, 0.1436767578, 0.5264892579, 0.3824462892, 0.2913818360, 0.5345458986 }, + { 0.6488037111, 0.2440185547, 0.7061767580, 0.2608642579, 0.6480712892, 0.6702880861, 0.4134521485 }, + { 0.1488037110, 0.7440185549, 0.4561767579, 0.6358642580, 0.2730712891, 0.3577880860, 0.6009521486 }, + { 0.2113037110, 0.3065185548, 0.5030517579, 0.6202392580, 0.1011962891, 0.8616943361, 0.2454833985 }, + { 0.7113037111, 0.8065185549, 0.2530517579, 0.4952392579, 0.9761962893, 0.1741943360, 0.8079833986 }, + { 0.9613037112, 0.0565185547, 0.8155517580, 0.7296142580, 0.2418212891, 0.8031005861, 0.1868896485 }, + { 0.4613037110, 0.5565185548, 0.0655517578, 0.3546142579, 0.8668212893, 0.2406005860, 0.8743896486 }, + { 0.3363037110, 0.1815185547, 0.3780517579, 0.8389892580, 0.4449462892, 0.9945068362, 0.0501708984 }, + { 0.8363037111, 0.6815185548, 0.6280517580, 0.2139892579, 0.5699462892, 0.0570068360, 0.9876708987 }, + { 0.5863037111, 0.4315185548, 0.1905517579, 0.9483642580, 0.3355712891, 0.9359130862, 0.1165771485 }, + { 0.0863037110, 0.9315185549, 0.9405517580, 0.0733642578, 0.7105712892, 0.1234130860, 0.9290771487 }, + { 0.1175537110, 0.4002685548, 0.2999267579, 0.2901611329, 0.1617431641, 0.0023193359, 0.6986083986 }, + { 0.6175537111, 0.9002685549, 0.5499267579, 0.6651611330, 0.7867431642, 0.9398193362, 0.2611083985 }, + { 0.8675537111, 0.1502685547, 0.1124267578, 0.4307861329, 0.0523681641, 0.0687255860, 0.6400146486 }, + { 0.3675537110, 0.6502685548, 0.8624267580, 0.5557861329, 0.9273681643, 0.8812255861, 0.3275146485 }, + { 0.4925537111, 0.0252685547, 0.6749267580, 0.0089111328, 0.2554931641, 0.1351318360, 0.5032958986 }, + { 0.9925537112, 0.5252685548, 0.4249267579, 0.8839111330, 0.6304931642, 0.8226318361, 0.4407958985 }, + { 0.7425537111, 0.2752685548, 0.9874267580, 0.1495361328, 0.3961181642, 0.2015380860, 0.5697021486 }, + { 0.2425537110, 0.7752685549, 0.2374267579, 0.7745361330, 0.5211181642, 0.7640380861, 0.3822021485 }, + { 0.1800537110, 0.2127685547, 0.7843017580, 0.9776611330, 0.8492431643, 0.2679443360, 0.7767333986 }, + { 0.6800537111, 0.7127685549, 0.0343017578, 0.1026611328, 0.2242431641, 0.7054443361, 0.2142333985 }, + { 0.9300537112, 0.4627685548, 0.5968017580, 0.8682861330, 0.9898681643, 0.3343505860, 0.8431396486 }, + { 0.4300537110, 0.9627685549, 0.3468017579, 0.2432861329, 0.1148681641, 0.6468505861, 0.1556396485 }, + { 0.3050537110, 0.3377685548, 0.1593017578, 0.6964111330, 0.6929931642, 0.4007568360, 0.9564208987 }, + { 0.8050537111, 0.8377685549, 0.9093017580, 0.3214111329, 0.3179931641, 0.5882568361, 0.0189208984 }, + { 0.5550537111, 0.0877685547, 0.4718017579, 0.5870361329, 0.5836181642, 0.4671630860, 0.8978271486 }, + { 0.0550537110, 0.5877685548, 0.7218017580, 0.4620361329, 0.4586181642, 0.5296630861, 0.0853271485 }, + { 0.0394287109, 0.3533935548, 0.8350830080, 0.7647705080, 0.2847900391, 0.6622314455, 0.6671142580 }, + { 0.5394287111, 0.8533935549, 0.0850830078, 0.1397705078, 0.6597900392, 0.3497314454, 0.3546142579 }, + { 0.7894287111, 0.1033935547, 0.5225830079, 0.9053955080, 0.4254150392, 0.7208251955, 0.7335205080 }, + { 0.2894287110, 0.6033935548, 0.2725830079, 0.0303955078, 0.5504150392, 0.2833251954, 0.2960205079 } +}; + + +// Spatial dimension: 16 +// N: 100 +// Vectors skipped: 4096 +static const double niederreiter_base2_16_100[100][16] = +{ + { 0.0003662109, 0.4705810548, 0.6358642580, 0.9561767580, 0.6715087892, 0.9793701174, 0.6053466798, 0.1983642579, 0.2217731476, 0.3769855500, 0.5390644075, 0.4707050325, 0.2744159699, 0.9942340853, 0.5396728517, 0.0626220703 }, + { 0.5003662111, 0.9705810549, 0.3858642579, 0.0811767578, 0.2965087891, 0.0418701172, 0.4178466798, 0.7608642580, 0.7530231478, 0.5957355501, 0.4453144075, 0.5019550325, 0.7431659700, 0.0254840851, 0.4615478517, 0.9219970705 }, + { 0.7503662111, 0.2205810547, 0.9483642580, 0.8155517580, 0.5621337892, 0.9207763674, 0.5467529298, 0.1397705078, 0.1895465851, 0.4092121125, 0.5087909700, 0.4404315950, 0.3046894074, 0.9639606478, 0.5555419923, 0.0784912110 }, + { 0.2503662110, 0.7205810549, 0.1983642579, 0.1905517579, 0.4371337892, 0.1082763672, 0.4842529298, 0.8272705080, 0.7832965853, 0.5654621126, 0.4775409700, 0.5341815950, 0.7109394075, 0.0577106476, 0.4461669923, 0.9066162111 }, + { 0.3753662110, 0.0955810547, 0.2608642579, 0.7374267580, 0.7652587892, 0.8465576174, 0.6600341798, 0.0030517578, 0.1573200226, 0.4375324250, 0.6035175325, 0.3750019074, 0.3701190949, 0.8985309603, 0.5079345704, 0.0943603516 }, + { 0.8753662111, 0.5955810548, 0.5108642579, 0.3624267579, 0.1402587891, 0.1590576172, 0.3475341798, 0.9405517580, 0.8135700228, 0.5312824251, 0.3847675324, 0.5937519075, 0.6513690950, 0.1172809601, 0.4923095704, 0.8912353518 }, + { 0.6253662111, 0.3455810548, 0.0733642578, 0.5968017580, 0.9058837893, 0.7879638674, 0.7264404299, 0.0694580078, 0.1250934601, 0.4697589875, 0.5732440950, 0.4072284699, 0.3378925324, 0.9307575228, 0.5238037111, 0.1102294922 }, + { 0.1253662110, 0.8455810549, 0.8233642580, 0.4718017579, 0.0308837891, 0.2254638672, 0.2889404298, 0.8819580080, 0.8438434603, 0.5010089875, 0.4169940949, 0.5634784700, 0.6816425325, 0.0870075226, 0.4769287110, 0.8758544924 }, + { 0.1878662110, 0.1580810547, 0.1514892578, 0.2686767579, 0.3590087891, 0.7449951174, 0.9334716799, 0.3389892579, 0.1006793976, 0.2871418000, 0.6367206575, 0.2558612824, 0.4658222200, 0.8106403353, 0.6031494142, 0.0010986328 }, + { 0.6878662111, 0.6580810548, 0.9014892580, 0.6436767580, 0.7340087892, 0.3074951173, 0.1209716797, 0.6514892580, 0.8819293978, 0.6933918001, 0.3554706574, 0.7246112825, 0.5595722200, 0.2168903351, 0.4000244142, 0.9854736330 }, + { 0.9378662112, 0.4080810548, 0.4639892579, 0.3780517579, 0.4996337892, 0.6864013673, 0.9998779299, 0.2803955079, 0.0684528351, 0.2568683625, 0.6689472200, 0.2880878449, 0.4960956575, 0.7803668978, 0.6190185548, 0.0169677734 }, + { 0.4378662110, 0.9080810549, 0.7139892580, 0.5030517579, 0.6246337892, 0.3739013673, 0.0623779297, 0.7178955080, 0.9122028353, 0.7256183626, 0.3251972199, 0.6943378450, 0.5273456575, 0.2491168976, 0.3846435548, 0.9700927737 }, + { 0.3128662110, 0.2830810548, 0.7764892580, 0.0499267578, 0.2027587891, 0.6121826173, 0.8631591799, 0.3936767579, 0.0362262726, 0.3476886750, 0.7011737825, 0.3476581574, 0.4365253450, 0.8399372103, 0.5714111329, 0.0328369141 }, + { 0.8128662111, 0.7830810549, 0.0264892578, 0.9249267580, 0.8277587893, 0.4246826173, 0.1756591797, 0.5811767579, 0.9424762728, 0.6289386751, 0.2949237824, 0.6289081575, 0.5927753450, 0.1836872101, 0.4307861329, 0.9547119143 }, + { 0.5628662111, 0.0330810547, 0.5889892579, 0.1593017578, 0.0933837891, 0.5535888673, 0.8045654299, 0.4600830079, 0.0039997101, 0.3174152375, 0.7334003450, 0.3173847199, 0.4042987824, 0.8721637728, 0.5872802736, 0.0487060547 }, + { 0.0628662110, 0.5330810548, 0.3389892579, 0.7843017580, 0.9683837893, 0.4910888673, 0.2420654297, 0.5225830079, 0.9727497103, 0.6611652376, 0.2646503449, 0.6611347200, 0.6230487825, 0.1534137726, 0.4154052735, 0.9393310549 }, + { 0.0941162110, 0.0018310547, 0.9171142580, 0.5635986329, 0.4195556642, 0.3856201173, 0.3865966798, 0.9796142580, 0.4483356477, 0.1972980500, 0.8125019075, 0.0410175324, 0.1728534699, 0.6114215852, 0.6666259767, 0.2052001954 }, + { 0.5941162111, 0.5018310548, 0.1671142579, 0.4385986329, 0.5445556642, 0.5731201173, 0.5740966798, 0.0421142578, 0.5420856477, 0.7910480501, 0.1562519074, 0.9472675326, 0.8291034700, 0.3926715852, 0.3385009766, 0.7833251955 }, + { 0.8441162111, 0.2518310547, 0.7296142580, 0.7042236330, 0.3101806641, 0.4520263673, 0.4530029298, 0.9210205080, 0.4786090852, 0.2295246125, 0.8447284700, 0.0107440949, 0.1406269074, 0.5811481477, 0.6824951173, 0.1898193360 }, + { 0.3441162110, 0.7518310549, 0.4796142579, 0.3292236329, 0.6851806642, 0.5145263673, 0.5155029298, 0.1085205078, 0.5098590852, 0.7607746126, 0.1259784699, 0.9794940951, 0.8593769075, 0.4248981477, 0.3231201173, 0.7991943361 }, + { 0.4691162110, 0.3768310548, 0.0421142578, 0.8448486330, 0.0133056641, 0.2528076172, 0.3162841798, 0.7843017580, 0.3838825227, 0.1328449250, 0.7519550325, 0.0703144074, 0.2060565949, 0.5157184602, 0.6348876955, 0.2369384766 }, + { 0.9691162112, 0.8768310549, 0.7921142580, 0.2198486329, 0.8883056643, 0.6903076173, 0.6287841798, 0.2218017579, 0.6026325227, 0.8515949251, 0.2207050324, 0.9140644076, 0.7998065950, 0.4844684602, 0.3692626954, 0.7525634767 }, + { 0.7191162111, 0.1268310547, 0.3546142579, 0.9854736330, 0.1539306641, 0.3192138673, 0.2576904297, 0.8507080080, 0.4141559602, 0.1650714875, 0.7841815950, 0.1025409699, 0.2363300324, 0.5479450227, 0.6507568361, 0.2215576172 }, + { 0.2191162110, 0.6268310548, 0.6046142580, 0.1104736328, 0.7789306642, 0.6317138673, 0.6951904298, 0.1632080079, 0.5704059602, 0.8213214876, 0.1904315949, 0.8837909701, 0.7675800325, 0.4541950227, 0.3538818360, 0.7684326174 }, + { 0.1566162110, 0.3143310548, 0.4327392579, 0.1260986328, 0.6070556642, 0.1512451172, 0.0897216797, 0.6202392580, 0.3272418977, 0.1074543000, 0.9726581576, 0.2011737824, 0.1142597199, 0.6778278352, 0.7301025392, 0.1436767578 }, + { 0.6566162111, 0.8143310549, 0.6827392580, 0.7510986330, 0.4820556642, 0.8387451174, 0.9022216799, 0.4327392579, 0.6709918977, 0.8887043001, 0.0039081573, 0.7949237825, 0.8955097201, 0.3340778352, 0.2769775391, 0.8468017580 }, + { 0.9066162111, 0.0643310547, 0.2452392579, 0.0167236328, 0.7476806642, 0.2176513672, 0.0311279297, 0.5616455079, 0.3575153352, 0.0771808624, 0.9423847201, 0.2334003449, 0.0820331574, 0.6475543977, 0.7459716799, 0.1282958985 }, + { 0.4066162110, 0.5643310548, 0.9952392580, 0.8917236330, 0.3726806641, 0.7801513674, 0.9686279299, 0.4991455079, 0.6387653352, 0.9209308626, 0.0361347199, 0.7646503450, 0.9257831576, 0.3663043977, 0.2615966797, 0.8626708986 }, + { 0.2816162110, 0.1893310547, 0.5577392579, 0.4073486329, 0.9508056643, 0.0184326172, 0.1444091797, 0.6749267580, 0.2627887726, 0.0430011749, 0.9121112826, 0.1679706574, 0.0224628449, 0.7071247102, 0.6983642580, 0.1754150391 }, + { 0.7816162111, 0.6893310548, 0.3077392579, 0.5323486329, 0.0758056641, 0.9559326174, 0.8319091799, 0.3624267579, 0.7315387728, 0.9492511751, 0.0683612824, 0.8242206575, 0.9912128451, 0.3008747102, 0.3077392579, 0.8160400393 }, + { 0.5316162111, 0.4393310548, 0.8702392580, 0.2979736329, 0.8414306643, 0.0848388672, 0.2108154297, 0.7413330080, 0.2930622102, 0.0127277374, 0.8818378451, 0.1376972199, 0.0527362824, 0.7393512728, 0.7142333986, 0.1600341797 }, + { 0.0316162109, 0.9393310549, 0.1202392578, 0.6729736330, 0.2164306641, 0.8973388674, 0.7733154299, 0.3038330079, 0.6993122102, 0.9814777377, 0.1005878449, 0.8564472200, 0.9589862826, 0.2706012726, 0.2923583985, 0.8319091799 }, + { 0.0472412109, 0.2362060547, 0.4522705079, 0.1007080078, 0.0426025391, 0.7955322267, 0.4801025392, 0.7025146486, 0.6748981477, 0.7988605501, 0.2421894074, 0.6113300325, 0.5712909700, 0.1973590851, 0.7935791017, 0.3477783204 }, + { 0.5472412111, 0.7362060549, 0.7022705080, 0.9757080080, 0.9176025393, 0.2330322266, 0.5426025392, 0.2650146485, 0.3311481477, 0.2051105500, 0.7734394075, 0.3925800324, 0.4150409699, 0.7911090853, 0.2154541016, 0.6446533205 }, + { 0.7972412111, 0.4862060548, 0.1397705078, 0.2413330079, 0.1832275391, 0.8541259768, 0.4215087892, 0.6361083986, 0.6426715852, 0.7685871126, 0.2119159699, 0.5810565950, 0.6015644075, 0.2295856476, 0.8094482424, 0.3636474610 }, + { 0.2972412110, 0.9862060549, 0.8897705080, 0.8663330080, 0.8082275393, 0.1666259766, 0.6090087892, 0.3236083985, 0.3614215852, 0.2373371125, 0.8056659700, 0.4248065949, 0.3828144074, 0.7608356478, 0.2000732422, 0.6292724611 }, + { 0.4222412110, 0.3612060548, 0.5772705079, 0.3194580079, 0.3863525392, 0.9127197268, 0.2847900391, 0.5072021486, 0.7354450228, 0.8594074251, 0.1816425324, 0.5156269075, 0.5419940950, 0.1641559601, 0.7618408205, 0.3170166016 }, + { 0.9222412112, 0.8612060549, 0.3272705079, 0.6944580080, 0.5113525392, 0.1002197266, 0.7222900392, 0.4447021485, 0.2666950226, 0.1406574250, 0.8378925325, 0.4843769075, 0.4482440950, 0.8204059603, 0.2462158204, 0.6763916017 }, + { 0.6722412111, 0.1112060547, 0.7647705080, 0.4600830079, 0.2769775391, 0.9713134768, 0.3511962891, 0.5657958986, 0.7032184602, 0.8291339876, 0.1513690949, 0.5478534700, 0.5097675325, 0.1338825226, 0.7777099611, 0.3328857423 }, + { 0.1722412110, 0.6112060548, 0.0147705078, 0.5850830079, 0.6519775392, 0.0338134766, 0.6636962892, 0.3782958985, 0.2969684602, 0.1728839875, 0.8701190951, 0.4541034700, 0.4785175325, 0.8526325228, 0.2308349610, 0.6610107423 }, + { 0.2347412110, 0.4237060548, 0.9678955080, 0.6632080080, 0.9801025393, 0.5611572267, 0.0582275391, 0.8431396486, 0.5538043977, 0.8965168001, 0.0898456574, 0.6464862825, 0.6376972200, 0.0137653351, 0.8570556643, 0.2862548829 }, + { 0.7347412111, 0.9237060549, 0.2178955079, 0.2882080079, 0.1051025391, 0.4986572267, 0.9957275393, 0.1556396485, 0.4600543977, 0.1152668000, 0.9335956576, 0.3652362824, 0.3564472199, 0.9825153353, 0.1539306641, 0.7081298830 }, + { 0.9847412112, 0.1737060547, 0.6553955080, 0.5538330079, 0.8707275393, 0.6197509767, 0.1246337891, 0.7767333986, 0.5215778352, 0.9287433626, 0.1220722199, 0.6787128450, 0.6679706575, 0.0459918976, 0.8729248049, 0.3021240235 }, + { 0.4847412111, 0.6737060548, 0.4053955079, 0.4288330079, 0.2457275391, 0.4322509767, 0.9371337893, 0.2142333985, 0.4903278352, 0.0849933624, 0.9033222201, 0.3349628449, 0.3242206574, 0.9522418978, 0.1385498047, 0.6927490236 }, + { 0.3597412110, 0.0487060547, 0.0928955078, 0.8819580080, 0.5738525392, 0.6783447267, 0.2379150391, 0.8978271486, 0.6143512727, 0.9570636751, 0.0292987824, 0.7382831575, 0.7334003450, 0.1055622101, 0.8253173830, 0.2554931641 }, + { 0.8597412111, 0.5487060548, 0.8428955080, 0.0069580078, 0.4488525392, 0.3658447266, 0.8004150392, 0.0853271485, 0.3956012727, 0.0508136749, 0.9980487826, 0.2695331574, 0.2646503449, 0.8868122103, 0.1846923829, 0.7398681642 }, + { 0.6097412111, 0.2987060548, 0.2803955079, 0.7725830080, 0.7144775392, 0.7369384767, 0.1793212891, 0.9564208987, 0.5821247102, 0.9892902377, 0.0615253449, 0.7080097200, 0.7011737825, 0.0752887726, 0.8411865236, 0.2713623048 }, + { 0.1097412110, 0.7987060549, 0.5303955079, 0.1475830078, 0.3394775391, 0.2994384766, 0.8668212893, 0.0189208984, 0.4258747102, 0.0205402374, 0.9677753451, 0.3017597199, 0.2949237824, 0.9190387728, 0.1693115235, 0.7244873049 }, + { 0.0784912110, 0.2674560547, 0.2335205079, 0.4893798829, 0.7906494142, 0.3267822266, 0.5113525392, 0.4837646486, 0.9014606478, 0.6191730501, 0.3906269074, 0.9316425326, 0.9697284701, 0.3145465852, 0.9205322268, 0.4903564454 }, + { 0.5784912111, 0.7674560549, 0.9835205080, 0.6143798830, 0.1656494141, 0.6392822267, 0.4488525392, 0.5462646486, 0.1202106476, 0.4004230500, 0.6093769075, 0.0878925324, 0.0009784698, 0.6582965852, 0.0924072266, 0.5059814454 }, + { 0.8284912111, 0.0174560547, 0.4210205079, 0.3487548829, 0.9312744143, 0.2603759766, 0.5777587892, 0.4173583985, 0.9317340853, 0.5888996126, 0.4228534699, 0.9013690951, 0.9375019076, 0.3467731477, 0.9364013674, 0.4749755860 }, + { 0.3284912110, 0.5174560548, 0.6710205080, 0.7237548830, 0.0562744141, 0.6978759767, 0.3902587892, 0.6048583986, 0.0879840851, 0.4326496125, 0.5791034700, 0.1201190949, 0.0312519074, 0.6280231477, 0.0770263672, 0.5218505861 }, + { 0.4534912110, 0.1424560547, 0.8585205080, 0.2081298829, 0.6343994142, 0.4439697267, 0.6910400392, 0.2884521485, 0.9620075228, 0.5547199251, 0.4550800325, 0.9609394076, 0.8779315951, 0.2813434601, 0.8887939455, 0.4595947267 }, + { 0.9534912112, 0.6424560548, 0.1085205078, 0.8331298830, 0.2593994141, 0.5064697267, 0.2535400391, 0.7259521486, 0.0557575226, 0.4609699250, 0.5488300325, 0.0546894074, 0.0966815949, 0.6875934602, 0.1231689453, 0.5377197267 }, + { 0.7034912111, 0.3924560548, 0.5460205079, 0.0675048828, 0.5250244142, 0.3775634767, 0.6324462892, 0.3470458985, 0.9922809603, 0.5244464875, 0.4873065950, 0.9931659701, 0.9082050326, 0.2510700226, 0.9046630861, 0.4442138673 }, + { 0.2034912110, 0.8924560549, 0.2960205079, 0.9425048830, 0.4000244142, 0.5650634767, 0.3199462891, 0.6595458986, 0.0235309601, 0.4931964875, 0.5185565950, 0.0244159699, 0.0644550324, 0.7198200228, 0.1077880860, 0.5535888673 }, + { 0.1409912110, 0.0799560547, 0.7491455080, 0.8018798830, 0.2281494141, 0.0924072266, 0.9644775393, 0.1243896485, 0.7803668978, 0.7168293001, 0.3007831574, 0.8417987825, 0.7861347200, 0.3809528352, 0.9840087893, 0.4288330079 }, + { 0.6409912111, 0.5799560548, 0.4991455079, 0.1768798829, 0.8531494143, 0.9049072268, 0.0269775391, 0.9368896487, 0.2491168976, 0.3105793000, 0.7070331575, 0.1855487824, 0.1923847199, 0.5997028352, 0.0308837891, 0.5694580079 }, + { 0.8909912111, 0.3299560548, 0.9366455080, 0.9112548830, 0.1187744141, 0.0260009766, 0.9058837893, 0.0579833985, 0.8106403353, 0.7490558626, 0.2705097199, 0.8740253451, 0.7539081575, 0.4131793977, 0.9998779299, 0.4134521485 }, + { 0.3909912110, 0.8299560549, 0.1866455079, 0.0362548828, 0.9937744143, 0.9635009768, 0.0933837891, 0.9954833987, 0.2168903351, 0.2803058625, 0.7392597200, 0.1552753449, 0.2226581574, 0.5694293977, 0.0155029297, 0.5853271486 }, + { 0.2659912110, 0.4549560548, 0.3741455079, 0.5206298829, 0.3218994141, 0.2095947266, 0.7691650392, 0.1790771485, 0.8409137728, 0.6523761751, 0.3652362824, 0.8085956575, 0.8193378450, 0.4727497102, 0.9522705080, 0.3980712892 }, + { 0.7659912111, 0.9549560549, 0.6241455080, 0.3956298829, 0.6968994142, 0.7720947267, 0.2066650391, 0.8665771486, 0.1846637726, 0.3711261750, 0.6464862825, 0.2148456574, 0.1630878449, 0.5039997102, 0.0616455078, 0.6011962892 }, + { 0.5159912111, 0.2049560547, 0.0616455078, 0.6300048830, 0.4625244142, 0.1431884766, 0.8355712893, 0.2376708985, 0.8711872103, 0.6846027376, 0.3349628449, 0.7783222200, 0.8496112825, 0.4424762727, 0.9681396487, 0.3826904298 }, + { 0.0159912109, 0.7049560549, 0.8116455080, 0.2550048829, 0.5875244142, 0.8306884768, 0.1480712891, 0.8001708986, 0.1524372101, 0.3408527375, 0.6787128450, 0.2470722199, 0.1308612824, 0.5362262727, 0.0462646484, 0.6170654298 }, + { 0.0238037109, 0.1190185547, 0.0186767578, 0.1827392579, 0.9136962893, 0.5960693361, 0.2923583985, 0.1285400391, 0.0645160675, 0.2207050324, 0.8828449251, 0.6894855501, 0.9297199251, 0.4326801301, 0.0474853516, 0.5079345704 }, + { 0.5238037111, 0.6190185548, 0.7686767580, 0.8077392580, 0.0386962891, 0.4085693360, 0.7298583986, 0.8160400393, 0.9082660677, 0.7519550325, 0.1015949250, 0.2832355500, 0.0859699249, 0.5889301301, 0.9381103518, 0.4923095704 }, + { 0.7738037111, 0.3690185548, 0.3311767579, 0.0421142578, 0.8043212892, 0.5374755861, 0.3587646485, 0.1949462891, 0.0967426300, 0.1904315949, 0.9150714876, 0.7217121126, 0.8994464876, 0.4004535676, 0.0321044922, 0.5238037111 }, + { 0.2738037110, 0.8690185549, 0.5811767579, 0.9171142580, 0.1793212891, 0.4749755860, 0.6712646486, 0.7574462892, 0.8779926302, 0.7841815950, 0.0713214874, 0.2529621125, 0.1181964875, 0.6192035676, 0.9539794924, 0.4769287110 }, + { 0.3988037110, 0.4940185548, 0.8936767580, 0.4014892579, 0.5074462892, 0.7288818361, 0.4720458985, 0.0738525391, 0.0000629425, 0.1562519074, 0.9472980501, 0.6562824251, 0.9629230502, 0.4619770051, 0.0157470703, 0.5396728517 }, + { 0.8988037111, 0.9940185549, 0.1436767578, 0.5264892579, 0.3824462892, 0.2913818360, 0.5345458986, 0.8863525393, 0.9688129427, 0.8125019075, 0.0410480499, 0.3125324250, 0.0566730499, 0.5557270051, 0.9688720705, 0.4615478517 }, + { 0.6488037111, 0.2440185547, 0.7061767580, 0.2608642579, 0.6480712892, 0.6702880861, 0.4134521485, 0.0152587891, 0.0322895050, 0.1259784699, 0.9795246127, 0.6260089876, 0.9951496127, 0.4922504426, 0.0003662109, 0.5555419923 }, + { 0.1488037110, 0.7440185549, 0.4561767579, 0.6358642580, 0.2730712891, 0.3577880860, 0.6009521486, 0.9527587893, 0.9385395052, 0.8447284700, 0.0107746124, 0.3447589875, 0.0263996124, 0.5235004426, 0.9847412112, 0.4461669923 }, + { 0.2113037110, 0.3065185548, 0.5030517579, 0.6202392580, 0.1011962891, 0.8616943361, 0.2454833985, 0.2691650391, 0.1934223175, 0.0683612824, 0.7930011751, 0.5371418001, 0.8711261751, 0.3740863801, 0.1109619141, 0.5714111329 }, + { 0.7113037111, 0.8065185549, 0.2530517579, 0.4952392579, 0.9761962893, 0.1741943360, 0.8079833986, 0.7066650392, 0.7871723177, 0.9121112826, 0.1992511750, 0.4433918000, 0.1523761750, 0.6553363802, 0.8765869143, 0.4307861329 }, + { 0.9613037112, 0.0565185547, 0.8155517580, 0.7296142580, 0.2418212891, 0.8031005861, 0.1868896485, 0.3355712891, 0.2256488801, 0.1005878449, 0.7627277376, 0.5068683625, 0.8408527376, 0.3418598176, 0.0955810547, 0.5872802736 }, + { 0.4613037110, 0.5565185548, 0.0655517578, 0.3546142579, 0.8668212893, 0.2406005860, 0.8743896486, 0.6480712892, 0.7568988802, 0.8818378451, 0.2314777375, 0.4756183625, 0.1846027375, 0.6856098177, 0.8924560549, 0.4154052735 }, + { 0.3363037110, 0.1815185547, 0.3780517579, 0.8389892580, 0.4449462892, 0.9945068362, 0.0501708984, 0.4644775392, 0.1289691925, 0.0039081573, 0.8574543001, 0.5664386751, 0.7793293001, 0.2783832551, 0.0792236328, 0.6031494142 }, + { 0.8363037111, 0.6815185548, 0.6280517580, 0.2139892579, 0.5699462892, 0.0570068360, 0.9876708987, 0.5269775392, 0.8477191927, 0.9726581576, 0.1387043000, 0.4101886750, 0.2480793000, 0.7471332552, 0.9073486330, 0.4000244142 }, + { 0.5863037111, 0.4315185548, 0.1905517579, 0.9483642580, 0.3355712891, 0.9359130862, 0.1165771485, 0.4058837892, 0.1611957550, 0.0361347199, 0.8271808626, 0.5986652376, 0.8115558626, 0.3086566926, 0.0638427735, 0.6190185548 }, + { 0.0863037110, 0.9315185549, 0.9405517580, 0.0733642578, 0.7105712892, 0.1234130860, 0.9290771487, 0.5933837892, 0.8174457552, 0.9423847201, 0.1709308625, 0.3799152375, 0.2178058625, 0.7149066927, 0.9232177737, 0.3846435548 }, + { 0.1175537110, 0.4002685548, 0.2999267579, 0.2901611329, 0.1617431641, 0.0023193359, 0.6986083986, 0.9097900393, 0.3535785676, 0.4160175324, 0.7187824251, 0.7597980501, 0.5156574250, 0.0498676300, 0.1744384766, 0.6505126955 }, + { 0.6175537111, 0.9002685549, 0.5499267579, 0.6651611330, 0.7867431642, 0.9398193362, 0.2611083985, 0.0972900391, 0.6348285677, 0.5722675325, 0.2500324250, 0.2285480500, 0.4844074250, 0.9561176302, 0.8150634768, 0.3536376954 }, + { 0.8675537111, 0.1502685547, 0.1124267578, 0.4307861329, 0.0523681641, 0.0687255860, 0.6400146486, 0.9761962893, 0.3233051301, 0.3857440949, 0.6885089876, 0.7920246126, 0.5478839876, 0.0176410675, 0.1590576172, 0.6351318361 }, + { 0.3675537110, 0.6502685548, 0.8624267580, 0.5557861329, 0.9273681643, 0.8812255861, 0.3275146485, 0.0386962891, 0.6670551302, 0.6044940950, 0.2822589875, 0.1982746125, 0.4541339875, 0.9863910677, 0.8309326174, 0.3695068360 }, + { 0.4925537111, 0.0252685547, 0.6749267580, 0.0089111328, 0.2554931641, 0.1351318360, 0.5032958986, 0.8551025393, 0.2891254426, 0.4765644075, 0.6582355501, 0.8515949251, 0.6113605501, 0.0791645050, 0.1427001953, 0.6822509767 }, + { 0.9925537112, 0.5252685548, 0.4249267579, 0.8839111330, 0.6304931642, 0.8226318361, 0.4407958985, 0.1676025391, 0.6953754427, 0.5078144075, 0.3144855500, 0.1328449250, 0.3926105500, 0.9229145052, 0.8458251955, 0.3228759766 }, + { 0.7425537111, 0.2752685548, 0.9874267580, 0.1495361328, 0.3961181642, 0.2015380860, 0.5697021486, 0.7965087892, 0.2588520051, 0.4462909700, 0.6279621126, 0.8213214876, 0.5810871126, 0.1094379425, 0.1273193360, 0.6668701173 }, + { 0.2425537110, 0.7752685549, 0.2374267579, 0.7745361330, 0.5211181642, 0.7640380861, 0.3822021485, 0.2340087891, 0.7276020052, 0.5400409700, 0.3467121125, 0.1650714875, 0.4248371125, 0.8906879427, 0.8616943361, 0.3387451173 }, + { 0.1800537110, 0.2127685547, 0.7843017580, 0.9776611330, 0.8492431643, 0.2679443360, 0.7767333986, 0.5504150392, 0.4824848176, 0.2636737824, 0.5664386751, 0.9824543002, 0.7070636751, 0.2412738801, 0.2379150391, 0.7139892580 }, + { 0.6800537111, 0.7127685549, 0.0343017578, 0.1026611328, 0.2242431641, 0.7054443361, 0.2142333985, 0.4879150392, 0.5137348176, 0.7324237825, 0.4101886750, 0.0137042999, 0.3008136750, 0.7725238802, 0.7535400392, 0.2921142579 }, + { 0.9300537112, 0.4627685548, 0.5968017580, 0.8682861330, 0.9898681643, 0.3343505860, 0.8431396486, 0.6168212892, 0.4522113801, 0.2959003449, 0.5986652376, 0.9521808626, 0.7392902376, 0.2090473176, 0.2225341797, 0.6986083986 }, + { 0.4300537110, 0.9627685549, 0.3468017579, 0.2432861329, 0.1148681641, 0.6468505861, 0.1556396485, 0.4293212892, 0.5459613801, 0.7021503450, 0.3799152375, 0.0459308624, 0.2705402375, 0.8027973177, 0.7694091799, 0.3079833985 }, + { 0.3050537110, 0.3377685548, 0.1593017578, 0.6964111330, 0.6929931642, 0.4007568360, 0.9564208987, 0.7457275392, 0.4180316926, 0.3242206574, 0.5058918000, 0.8867511751, 0.6777668001, 0.1455707550, 0.2061767579, 0.7457275392 }, + { 0.8050537111, 0.8377685549, 0.9093017580, 0.3214111329, 0.3179931641, 0.5882568361, 0.0189208984, 0.3082275391, 0.5742816926, 0.6679706575, 0.4746418000, 0.1055011750, 0.3340168000, 0.8643207552, 0.7843017580, 0.2613525391 }, + { 0.5550537111, 0.0877685547, 0.4718017579, 0.5870361329, 0.5836181642, 0.4671630860, 0.8978271486, 0.6871337892, 0.3877582551, 0.3564472199, 0.5381183626, 0.9189777376, 0.6474933626, 0.1758441925, 0.1907958985, 0.7303466799 }, + { 0.0550537110, 0.5877685548, 0.7218017580, 0.4620361329, 0.4586181642, 0.5296630861, 0.0853271485, 0.3746337891, 0.6065082551, 0.6376972200, 0.4443683625, 0.0752277374, 0.3662433625, 0.8320941927, 0.8001708986, 0.2772216798 }, + { 0.0394287109, 0.3533935548, 0.8350830080, 0.7647705080, 0.2847900391, 0.6622314455, 0.6671142580, 0.6326904298, 0.5176410676, 0.5800800325, 0.3359699250, 0.3301105500, 0.2265949250, 0.6358051302, 0.3013916016, 0.7930908205 }, + { 0.5394287111, 0.8533935549, 0.0850830078, 0.1397705078, 0.6597900392, 0.3497314454, 0.3546142579, 0.3201904298, 0.4863910676, 0.4238300324, 0.6797199251, 0.6738605501, 0.7578449251, 0.3545551301, 0.6920166017, 0.2149658204 }, + { 0.7894287111, 0.1033935547, 0.5225830079, 0.9053955080, 0.4254150392, 0.7208251955, 0.7335205080, 0.6912841798, 0.5498676301, 0.6123065950, 0.3681964875, 0.3623371125, 0.1963214875, 0.6660785677, 0.2860107423, 0.8089599611 }, + { 0.2894287110, 0.6033935548, 0.2725830079, 0.0303955078, 0.5504150392, 0.2833251954, 0.2960205079, 0.2537841797, 0.4561176301, 0.3935565949, 0.6494464876, 0.6435871126, 0.7900714876, 0.3223285676, 0.7078857424, 0.1995849610 } +}; + + +QRNG_VALIDATION_TEST_FUNCTIONS(niederreiter_base2) + + +BOOST_AUTO_TEST_CASE( validate_niederreiter_base2 ) +{ + test_niederreiter_base2_values(niederreiter_base2_02_100, 4096); + test_niederreiter_base2_values(niederreiter_base2_07_100, 4096); + test_niederreiter_base2_values(niederreiter_base2_16_100, 4096); +} + +BOOST_AUTO_TEST_CASE( validate_niederreiter_base2_seed ) +{ + test_niederreiter_base2_seed(niederreiter_base2_02_100, 4096); + test_niederreiter_base2_seed(niederreiter_base2_07_100, 4096); + test_niederreiter_base2_seed(niederreiter_base2_16_100, 4096); +} + +BOOST_AUTO_TEST_CASE( validate_niederreiter_base2_discard ) +{ + test_niederreiter_base2_discard(niederreiter_base2_02_100, 4096); + test_niederreiter_base2_discard(niederreiter_base2_07_100, 4096); + test_niederreiter_base2_discard(niederreiter_base2_16_100, 4096); +} diff --git a/test/sobol_validate.cpp b/test/sobol_validate.cpp new file mode 100644 index 0000000..b2c0a4c --- /dev/null +++ b/test/sobol_validate.cpp @@ -0,0 +1,371 @@ +// Copyright Justinas Vygintas Daugmaudis, 2010. +// Use, modification and distribution is subject to the +// Boost Software License, Version 1.0. (See accompanying +// file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0) + +#include + +#include + +#define BOOST_TEST_MAIN +#include + +#include "test_qrng_functions.hpp" + + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the sobol quasi-random number generator. +// These tests compare our results with values produced by the original +// version of ACM TOMS Algorithm 659, which is available in the +// TOMS subdirectory in http://www.netlib.org +// +// For independently generated datasets look at http://people.sc.fsu.edu/~jburkardt/datasets/sobol/ + + +// Spatial dimension: 2 +// N: 100 +// Vectors skipped: 0 +static const double sobol_02_100[100][2] = +{ + { 0.0000000000, 0.0000000000 }, + { 0.5000000002, 0.5000000002 }, + { 0.7500000003, 0.2500000001 }, + { 0.2500000001, 0.7500000003 }, + { 0.3750000002, 0.3750000002 }, + { 0.8750000004, 0.8750000004 }, + { 0.6250000003, 0.1250000001 }, + { 0.1250000001, 0.6250000003 }, + { 0.1875000001, 0.3125000001 }, + { 0.6875000003, 0.8125000004 }, + { 0.9375000004, 0.0625000000 }, + { 0.4375000002, 0.5625000003 }, + { 0.3125000001, 0.1875000001 }, + { 0.8125000004, 0.6875000003 }, + { 0.5625000003, 0.4375000002 }, + { 0.0625000000, 0.9375000004 }, + { 0.0937500000, 0.4687500002 }, + { 0.5937500003, 0.9687500005 }, + { 0.8437500004, 0.2187500001 }, + { 0.3437500002, 0.7187500003 }, + { 0.4687500002, 0.0937500000 }, + { 0.9687500005, 0.5937500003 }, + { 0.7187500003, 0.3437500002 }, + { 0.2187500001, 0.8437500004 }, + { 0.1562500001, 0.1562500001 }, + { 0.6562500003, 0.6562500003 }, + { 0.9062500004, 0.4062500002 }, + { 0.4062500002, 0.9062500004 }, + { 0.2812500001, 0.2812500001 }, + { 0.7812500004, 0.7812500004 }, + { 0.5312500002, 0.0312500000 }, + { 0.0312500000, 0.5312500002 }, + { 0.0468750000, 0.2656250001 }, + { 0.5468750003, 0.7656250004 }, + { 0.7968750004, 0.0156250000 }, + { 0.2968750001, 0.5156250002 }, + { 0.4218750002, 0.1406250001 }, + { 0.9218750004, 0.6406250003 }, + { 0.6718750003, 0.3906250002 }, + { 0.1718750001, 0.8906250004 }, + { 0.2343750001, 0.0781250000 }, + { 0.7343750003, 0.5781250003 }, + { 0.9843750005, 0.3281250002 }, + { 0.4843750002, 0.8281250004 }, + { 0.3593750002, 0.4531250002 }, + { 0.8593750004, 0.9531250004 }, + { 0.6093750003, 0.2031250001 }, + { 0.1093750001, 0.7031250003 }, + { 0.0781250000, 0.2343750001 }, + { 0.5781250003, 0.7343750003 }, + { 0.8281250004, 0.4843750002 }, + { 0.3281250002, 0.9843750005 }, + { 0.4531250002, 0.3593750002 }, + { 0.9531250004, 0.8593750004 }, + { 0.7031250003, 0.1093750001 }, + { 0.2031250001, 0.6093750003 }, + { 0.1406250001, 0.4218750002 }, + { 0.6406250003, 0.9218750004 }, + { 0.8906250004, 0.1718750001 }, + { 0.3906250002, 0.6718750003 }, + { 0.2656250001, 0.0468750000 }, + { 0.7656250004, 0.5468750003 }, + { 0.5156250002, 0.2968750001 }, + { 0.0156250000, 0.7968750004 }, + { 0.0234375000, 0.3984375002 }, + { 0.5234375002, 0.8984375004 }, + { 0.7734375004, 0.1484375001 }, + { 0.2734375001, 0.6484375003 }, + { 0.3984375002, 0.0234375000 }, + { 0.8984375004, 0.5234375002 }, + { 0.6484375003, 0.2734375001 }, + { 0.1484375001, 0.7734375004 }, + { 0.2109375001, 0.2109375001 }, + { 0.7109375003, 0.7109375003 }, + { 0.9609375004, 0.4609375002 }, + { 0.4609375002, 0.9609375004 }, + { 0.3359375002, 0.3359375002 }, + { 0.8359375004, 0.8359375004 }, + { 0.5859375003, 0.0859375000 }, + { 0.0859375000, 0.5859375003 }, + { 0.1171875001, 0.1171875001 }, + { 0.6171875003, 0.6171875003 }, + { 0.8671875004, 0.3671875002 }, + { 0.3671875002, 0.8671875004 }, + { 0.4921875002, 0.4921875002 }, + { 0.9921875005, 0.9921875005 }, + { 0.7421875003, 0.2421875001 }, + { 0.2421875001, 0.7421875003 }, + { 0.1796875001, 0.3046875001 }, + { 0.6796875003, 0.8046875004 }, + { 0.9296875004, 0.0546875000 }, + { 0.4296875002, 0.5546875003 }, + { 0.3046875001, 0.1796875001 }, + { 0.8046875004, 0.6796875003 }, + { 0.5546875003, 0.4296875002 }, + { 0.0546875000, 0.9296875004 }, + { 0.0390625000, 0.1328125001 }, + { 0.5390625003, 0.6328125003 }, + { 0.7890625004, 0.3828125002 }, + { 0.2890625001, 0.8828125004 } +}; + +// Spatial dimension: 7 +// N: 100 +// Vectors skipped: 128 +static const double sobol_07_100[100][7] = +{ + { 0.0117187500, 0.3320312502, 0.7851562504, 0.9414062504, 0.4648437502, 0.4179687502, 0.4648437502 }, + { 0.5117187502, 0.8320312504, 0.2851562501, 0.4414062502, 0.9648437504, 0.9179687504, 0.9648437504 }, + { 0.7617187504, 0.0820312500, 0.0351562500, 0.6914062503, 0.7148437503, 0.1679687501, 0.7148437503 }, + { 0.2617187501, 0.5820312503, 0.5351562502, 0.1914062501, 0.2148437501, 0.6679687503, 0.2148437501 }, + { 0.3867187502, 0.2070312501, 0.4101562502, 0.8164062504, 0.5898437503, 0.5429687503, 0.3398437502 }, + { 0.8867187504, 0.7070312503, 0.9101562504, 0.3164062501, 0.0898437500, 0.0429687500, 0.8398437504 }, + { 0.6367187503, 0.4570312502, 0.6601562503, 0.5664062503, 0.3398437502, 0.7929687504, 0.5898437503 }, + { 0.1367187501, 0.9570312504, 0.1601562501, 0.0664062500, 0.8398437504, 0.2929687501, 0.0898437500 }, + { 0.1992187501, 0.0195312500, 0.5976562503, 0.2539062501, 0.9023437504, 0.3554687502, 0.4023437502 }, + { 0.6992187503, 0.5195312502, 0.0976562500, 0.7539062504, 0.4023437502, 0.8554687504, 0.9023437504 }, + { 0.9492187504, 0.2695312501, 0.3476562502, 0.0039062500, 0.1523437501, 0.1054687500, 0.6523437503 }, + { 0.4492187502, 0.7695312504, 0.8476562504, 0.5039062502, 0.6523437503, 0.6054687503, 0.1523437501 }, + { 0.3242187502, 0.3945312502, 0.2226562501, 0.3789062502, 0.0273437500, 0.7304687503, 0.2773437501 }, + { 0.8242187504, 0.8945312504, 0.7226562503, 0.8789062504, 0.5273437502, 0.2304687501, 0.7773437504 }, + { 0.5742187503, 0.1445312501, 0.9726562505, 0.1289062501, 0.7773437504, 0.9804687505, 0.5273437502 }, + { 0.0742187500, 0.6445312503, 0.4726562502, 0.6289062503, 0.2773437501, 0.4804687502, 0.0273437500 }, + { 0.1054687500, 0.1757812501, 0.0664062500, 0.5976562503, 0.2460937501, 0.1992187501, 0.9960937505 }, + { 0.6054687503, 0.6757812503, 0.5664062503, 0.0976562500, 0.7460937503, 0.6992187503, 0.4960937502 }, + { 0.8554687504, 0.4257812502, 0.8164062504, 0.8476562504, 0.9960937505, 0.4492187502, 0.2460937501 }, + { 0.3554687502, 0.9257812504, 0.3164062501, 0.3476562502, 0.4960937502, 0.9492187504, 0.7460937503 }, + { 0.4804687502, 0.3007812501, 0.6914062503, 0.7226562503, 0.8710937504, 0.8242187504, 0.8710937504 }, + { 0.9804687505, 0.8007812504, 0.1914062501, 0.2226562501, 0.3710937502, 0.3242187502, 0.3710937502 }, + { 0.7304687503, 0.0507812500, 0.4414062502, 0.9726562505, 0.1210937501, 0.5742187503, 0.1210937501 }, + { 0.2304687501, 0.5507812503, 0.9414062504, 0.4726562502, 0.6210937503, 0.0742187500, 0.6210937503 }, + { 0.1679687501, 0.4882812502, 0.2539062501, 0.1601562501, 0.6835937503, 0.0117187500, 0.9335937504 }, + { 0.6679687503, 0.9882812505, 0.7539062504, 0.6601562503, 0.1835937501, 0.5117187502, 0.4335937502 }, + { 0.9179687504, 0.2382812501, 0.5039062502, 0.4101562502, 0.4335937502, 0.2617187501, 0.1835937501 }, + { 0.4179687502, 0.7382812503, 0.0039062500, 0.9101562504, 0.9335937504, 0.7617187504, 0.6835937503 }, + { 0.2929687501, 0.1132812501, 0.8789062504, 0.0351562500, 0.3085937501, 0.8867187504, 0.8085937504 }, + { 0.7929687504, 0.6132812503, 0.3789062502, 0.5351562502, 0.8085937504, 0.3867187502, 0.3085937501 }, + { 0.5429687503, 0.3632812502, 0.1289062501, 0.2851562501, 0.5585937503, 0.6367187503, 0.0585937500 }, + { 0.0429687500, 0.8632812504, 0.6289062503, 0.7851562504, 0.0585937500, 0.1367187501, 0.5585937503 }, + { 0.0585937500, 0.0664062500, 0.3320312502, 0.3945312502, 0.7617187504, 0.8085937504, 0.1992187501 }, + { 0.5585937503, 0.5664062503, 0.8320312504, 0.8945312504, 0.2617187501, 0.3085937501, 0.6992187503 }, + { 0.8085937504, 0.3164062501, 0.5820312503, 0.1445312501, 0.0117187500, 0.5585937503, 0.9492187504 }, + { 0.3085937501, 0.8164062504, 0.0820312500, 0.6445312503, 0.5117187502, 0.0585937500, 0.4492187502 }, + { 0.4335937502, 0.4414062502, 0.9570312504, 0.2695312501, 0.1367187501, 0.1835937501, 0.0742187500 }, + { 0.9335937504, 0.9414062504, 0.4570312502, 0.7695312504, 0.6367187503, 0.6835937503, 0.5742187503 }, + { 0.6835937503, 0.1914062501, 0.2070312501, 0.0195312500, 0.8867187504, 0.4335937502, 0.8242187504 }, + { 0.1835937501, 0.6914062503, 0.7070312503, 0.5195312502, 0.3867187502, 0.9335937504, 0.3242187502 }, + { 0.2460937501, 0.2539062501, 0.0195312500, 0.8320312504, 0.3242187502, 0.9960937505, 0.1367187501 }, + { 0.7460937503, 0.7539062504, 0.5195312502, 0.3320312502, 0.8242187504, 0.4960937502, 0.6367187503 }, + { 0.9960937505, 0.0039062500, 0.7695312504, 0.5820312503, 0.5742187503, 0.7460937503, 0.8867187504 }, + { 0.4960937502, 0.5039062502, 0.2695312501, 0.0820312500, 0.0742187500, 0.2460937501, 0.3867187502 }, + { 0.3710937502, 0.1289062501, 0.6445312503, 0.9570312504, 0.6992187503, 0.1210937501, 0.0117187500 }, + { 0.8710937504, 0.6289062503, 0.1445312501, 0.4570312502, 0.1992187501, 0.6210937503, 0.5117187502 }, + { 0.6210937503, 0.3789062502, 0.3945312502, 0.7070312503, 0.4492187502, 0.3710937502, 0.7617187504 }, + { 0.1210937501, 0.8789062504, 0.8945312504, 0.2070312501, 0.9492187504, 0.8710937504, 0.2617187501 }, + { 0.0898437500, 0.4101562502, 0.5507812503, 0.0507812500, 0.5429687503, 0.5898437503, 0.7304687503 }, + { 0.5898437503, 0.9101562504, 0.0507812500, 0.5507812503, 0.0429687500, 0.0898437500, 0.2304687501 }, + { 0.8398437504, 0.1601562501, 0.3007812501, 0.3007812501, 0.2929687501, 0.8398437504, 0.4804687502 }, + { 0.3398437502, 0.6601562503, 0.8007812504, 0.8007812504, 0.7929687504, 0.3398437502, 0.9804687505 }, + { 0.4648437502, 0.0351562500, 0.1757812501, 0.1757812501, 0.4179687502, 0.4648437502, 0.6054687503 }, + { 0.9648437504, 0.5351562502, 0.6757812503, 0.6757812503, 0.9179687504, 0.9648437504, 0.1054687500 }, + { 0.7148437503, 0.2851562501, 0.9257812504, 0.4257812502, 0.6679687503, 0.2148437501, 0.3554687502 }, + { 0.2148437501, 0.7851562504, 0.4257812502, 0.9257812504, 0.1679687501, 0.7148437503, 0.8554687504 }, + { 0.1523437501, 0.2226562501, 0.8632812504, 0.7382812503, 0.1054687500, 0.6523437503, 0.6679687503 }, + { 0.6523437503, 0.7226562503, 0.3632812502, 0.2382812501, 0.6054687503, 0.1523437501, 0.1679687501 }, + { 0.9023437504, 0.4726562502, 0.1132812501, 0.9882812505, 0.8554687504, 0.9023437504, 0.4179687502 }, + { 0.4023437502, 0.9726562505, 0.6132812503, 0.4882812502, 0.3554687502, 0.4023437502, 0.9179687504 }, + { 0.2773437501, 0.3476562502, 0.4882812502, 0.6132812503, 0.9804687505, 0.2773437501, 0.5429687503 }, + { 0.7773437504, 0.8476562504, 0.9882812505, 0.1132812501, 0.4804687502, 0.7773437504, 0.0429687500 }, + { 0.5273437502, 0.0976562500, 0.7382812503, 0.8632812504, 0.2304687501, 0.0273437500, 0.2929687501 }, + { 0.0273437500, 0.5976562503, 0.2382812501, 0.3632812502, 0.7304687503, 0.5273437502, 0.7929687504 }, + { 0.0195312500, 0.1992187501, 0.7304687503, 0.2460937501, 0.2539062501, 0.7070312503, 0.0664062500 }, + { 0.5195312502, 0.6992187503, 0.2304687501, 0.7460937503, 0.7539062504, 0.2070312501, 0.5664062503 }, + { 0.7695312504, 0.4492187502, 0.4804687502, 0.4960937502, 0.5039062502, 0.9570312504, 0.8164062504 }, + { 0.2695312501, 0.9492187504, 0.9804687505, 0.9960937505, 0.0039062500, 0.4570312502, 0.3164062501 }, + { 0.3945312502, 0.3242187502, 0.1054687500, 0.1210937501, 0.6289062503, 0.3320312502, 0.1914062501 }, + { 0.8945312504, 0.8242187504, 0.6054687503, 0.6210937503, 0.1289062501, 0.8320312504, 0.6914062503 }, + { 0.6445312503, 0.0742187500, 0.8554687504, 0.3710937502, 0.3789062502, 0.0820312500, 0.9414062504 }, + { 0.1445312501, 0.5742187503, 0.3554687502, 0.8710937504, 0.8789062504, 0.5820312503, 0.4414062502 }, + { 0.2070312501, 0.3867187502, 0.9179687504, 0.5585937503, 0.8164062504, 0.5195312502, 0.0039062500 }, + { 0.7070312503, 0.8867187504, 0.4179687502, 0.0585937500, 0.3164062501, 0.0195312500, 0.5039062502 }, + { 0.9570312504, 0.1367187501, 0.1679687501, 0.8085937504, 0.0664062500, 0.7695312504, 0.7539062504 }, + { 0.4570312502, 0.6367187503, 0.6679687503, 0.3085937501, 0.5664062503, 0.2695312501, 0.2539062501 }, + { 0.3320312502, 0.0117187500, 0.2929687501, 0.6835937503, 0.1914062501, 0.3945312502, 0.1289062501 }, + { 0.8320312504, 0.5117187502, 0.7929687504, 0.1835937501, 0.6914062503, 0.8945312504, 0.6289062503 }, + { 0.5820312503, 0.2617187501, 0.5429687503, 0.9335937504, 0.9414062504, 0.1445312501, 0.8789062504 }, + { 0.0820312500, 0.7617187504, 0.0429687500, 0.4335937502, 0.4414062502, 0.6445312503, 0.3789062502 }, + { 0.1132812501, 0.2929687501, 0.3867187502, 0.3398437502, 0.0351562500, 0.9257812504, 0.5976562503 }, + { 0.6132812503, 0.7929687504, 0.8867187504, 0.8398437504, 0.5351562502, 0.4257812502, 0.0976562500 }, + { 0.8632812504, 0.0429687500, 0.6367187503, 0.0898437500, 0.7851562504, 0.6757812503, 0.3476562502 }, + { 0.3632812502, 0.5429687503, 0.1367187501, 0.5898437503, 0.2851562501, 0.1757812501, 0.8476562504 }, + { 0.4882812502, 0.1679687501, 0.7617187504, 0.4648437502, 0.9101562504, 0.0507812500, 0.7226562503 }, + { 0.9882812505, 0.6679687503, 0.2617187501, 0.9648437504, 0.4101562502, 0.5507812503, 0.2226562501 }, + { 0.7382812503, 0.4179687502, 0.0117187500, 0.2148437501, 0.1601562501, 0.3007812501, 0.4726562502 }, + { 0.2382812501, 0.9179687504, 0.5117187502, 0.7148437503, 0.6601562503, 0.8007812504, 0.9726562505 }, + { 0.1757812501, 0.1054687500, 0.1992187501, 0.9023437504, 0.5976562503, 0.8632812504, 0.5351562502 }, + { 0.6757812503, 0.6054687503, 0.6992187503, 0.4023437502, 0.0976562500, 0.3632812502, 0.0351562500 }, + { 0.9257812504, 0.3554687502, 0.9492187504, 0.6523437503, 0.3476562502, 0.6132812503, 0.2851562501 }, + { 0.4257812502, 0.8554687504, 0.4492187502, 0.1523437501, 0.8476562504, 0.1132812501, 0.7851562504 }, + { 0.3007812501, 0.4804687502, 0.5742187503, 0.7773437504, 0.4726562502, 0.2382812501, 0.6601562503 }, + { 0.8007812504, 0.9804687505, 0.0742187500, 0.2773437501, 0.9726562505, 0.7382812503, 0.1601562501 }, + { 0.5507812503, 0.2304687501, 0.3242187502, 0.5273437502, 0.7226562503, 0.4882812502, 0.4101562502 }, + { 0.0507812500, 0.7304687503, 0.8242187504, 0.0273437500, 0.2226562501, 0.9882812505, 0.9101562504 }, + { 0.0351562500, 0.4648437502, 0.1523437501, 0.6679687503, 0.9570312504, 0.0664062500, 0.3320312502 }, + { 0.5351562502, 0.9648437504, 0.6523437503, 0.1679687501, 0.4570312502, 0.5664062503, 0.8320312504 }, + { 0.7851562504, 0.2148437501, 0.9023437504, 0.9179687504, 0.2070312501, 0.3164062501, 0.5820312503 }, + { 0.2851562501, 0.7148437503, 0.4023437502, 0.4179687502, 0.7070312503, 0.8164062504, 0.0820312500 } +}; + +// Spatial dimension: 16 +// N: 100 +// Vectors skipped: 128 +static const double sobol_16_100[100][16] = +{ + { 0.0117187500, 0.3320312502, 0.7851562504, 0.9414062504, 0.4648437502, 0.4179687502, 0.4648437502, 0.4882812502, 0.7304687503, 0.5742187503, 0.5664062503, 0.2460937501, 0.4882812502, 0.6367187503, 0.7617187504, 0.1835937501 }, + { 0.5117187502, 0.8320312504, 0.2851562501, 0.4414062502, 0.9648437504, 0.9179687504, 0.9648437504, 0.9882812505, 0.2304687501, 0.0742187500, 0.0664062500, 0.7460937503, 0.9882812505, 0.1367187501, 0.2617187501, 0.6835937503 }, + { 0.7617187504, 0.0820312500, 0.0351562500, 0.6914062503, 0.7148437503, 0.1679687501, 0.7148437503, 0.2382812501, 0.9804687505, 0.3242187502, 0.8164062504, 0.9960937505, 0.2382812501, 0.3867187502, 0.5117187502, 0.9335937504 }, + { 0.2617187501, 0.5820312503, 0.5351562502, 0.1914062501, 0.2148437501, 0.6679687503, 0.2148437501, 0.7382812503, 0.4804687502, 0.8242187504, 0.3164062501, 0.4960937502, 0.7382812503, 0.8867187504, 0.0117187500, 0.4335937502 }, + { 0.3867187502, 0.2070312501, 0.4101562502, 0.8164062504, 0.5898437503, 0.5429687503, 0.3398437502, 0.8632812504, 0.6054687503, 0.4492187502, 0.9414062504, 0.6210937503, 0.3632812502, 0.7617187504, 0.3867187502, 0.0585937500 }, + { 0.8867187504, 0.7070312503, 0.9101562504, 0.3164062501, 0.0898437500, 0.0429687500, 0.8398437504, 0.3632812502, 0.1054687500, 0.9492187504, 0.4414062502, 0.1210937501, 0.8632812504, 0.2617187501, 0.8867187504, 0.5585937503 }, + { 0.6367187503, 0.4570312502, 0.6601562503, 0.5664062503, 0.3398437502, 0.7929687504, 0.5898437503, 0.6132812503, 0.8554687504, 0.6992187503, 0.6914062503, 0.3710937502, 0.1132812501, 0.0117187500, 0.1367187501, 0.8085937504 }, + { 0.1367187501, 0.9570312504, 0.1601562501, 0.0664062500, 0.8398437504, 0.2929687501, 0.0898437500, 0.1132812501, 0.3554687502, 0.1992187501, 0.1914062501, 0.8710937504, 0.6132812503, 0.5117187502, 0.6367187503, 0.3085937501 }, + { 0.1992187501, 0.0195312500, 0.5976562503, 0.2539062501, 0.9023437504, 0.3554687502, 0.4023437502, 0.5507812503, 0.5429687503, 0.5117187502, 0.1289062501, 0.9335937504, 0.9257812504, 0.0742187500, 0.9492187504, 0.6210937503 }, + { 0.6992187503, 0.5195312502, 0.0976562500, 0.7539062504, 0.4023437502, 0.8554687504, 0.9023437504, 0.0507812500, 0.0429687500, 0.0117187500, 0.6289062503, 0.4335937502, 0.4257812502, 0.5742187503, 0.4492187502, 0.1210937501 }, + { 0.9492187504, 0.2695312501, 0.3476562502, 0.0039062500, 0.1523437501, 0.1054687500, 0.6523437503, 0.8007812504, 0.7929687504, 0.2617187501, 0.3789062502, 0.1835937501, 0.6757812503, 0.8242187504, 0.6992187503, 0.3710937502 }, + { 0.4492187502, 0.7695312504, 0.8476562504, 0.5039062502, 0.6523437503, 0.6054687503, 0.1523437501, 0.3007812501, 0.2929687501, 0.7617187504, 0.8789062504, 0.6835937503, 0.1757812501, 0.3242187502, 0.1992187501, 0.8710937504 }, + { 0.3242187502, 0.3945312502, 0.2226562501, 0.3789062502, 0.0273437500, 0.7304687503, 0.2773437501, 0.1757812501, 0.6679687503, 0.3867187502, 0.2539062501, 0.3085937501, 0.8007812504, 0.4492187502, 0.3242187502, 0.7460937503 }, + { 0.8242187504, 0.8945312504, 0.7226562503, 0.8789062504, 0.5273437502, 0.2304687501, 0.7773437504, 0.6757812503, 0.1679687501, 0.8867187504, 0.7539062504, 0.8085937504, 0.3007812501, 0.9492187504, 0.8242187504, 0.2460937501 }, + { 0.5742187503, 0.1445312501, 0.9726562505, 0.1289062501, 0.7773437504, 0.9804687505, 0.5273437502, 0.4257812502, 0.9179687504, 0.6367187503, 0.0039062500, 0.5585937503, 0.5507812503, 0.6992187503, 0.0742187500, 0.4960937502 }, + { 0.0742187500, 0.6445312503, 0.4726562502, 0.6289062503, 0.2773437501, 0.4804687502, 0.0273437500, 0.9257812504, 0.4179687502, 0.1367187501, 0.5039062502, 0.0585937500, 0.0507812500, 0.1992187501, 0.5742187503, 0.9960937505 }, + { 0.1054687500, 0.1757812501, 0.0664062500, 0.5976562503, 0.2460937501, 0.1992187501, 0.9960937505, 0.6445312503, 0.4492187502, 0.9804687505, 0.9726562505, 0.9023437504, 0.6445312503, 0.5429687503, 0.0429687500, 0.6523437503 }, + { 0.6054687503, 0.6757812503, 0.5664062503, 0.0976562500, 0.7460937503, 0.6992187503, 0.4960937502, 0.1445312501, 0.9492187504, 0.4804687502, 0.4726562502, 0.4023437502, 0.1445312501, 0.0429687500, 0.5429687503, 0.1523437501 }, + { 0.8554687504, 0.4257812502, 0.8164062504, 0.8476562504, 0.9960937505, 0.4492187502, 0.2460937501, 0.8945312504, 0.1992187501, 0.2304687501, 0.7226562503, 0.1523437501, 0.8945312504, 0.2929687501, 0.2929687501, 0.4023437502 }, + { 0.3554687502, 0.9257812504, 0.3164062501, 0.3476562502, 0.4960937502, 0.9492187504, 0.7460937503, 0.3945312502, 0.6992187503, 0.7304687503, 0.2226562501, 0.6523437503, 0.3945312502, 0.7929687504, 0.7929687504, 0.9023437504 }, + { 0.4804687502, 0.3007812501, 0.6914062503, 0.7226562503, 0.8710937504, 0.8242187504, 0.8710937504, 0.0195312500, 0.3242187502, 0.1054687500, 0.5976562503, 0.2773437501, 0.5195312502, 0.9179687504, 0.6679687503, 0.5273437502 }, + { 0.9804687505, 0.8007812504, 0.1914062501, 0.2226562501, 0.3710937502, 0.3242187502, 0.3710937502, 0.5195312502, 0.8242187504, 0.6054687503, 0.0976562500, 0.7773437504, 0.0195312500, 0.4179687502, 0.1679687501, 0.0273437500 }, + { 0.7304687503, 0.0507812500, 0.4414062502, 0.9726562505, 0.1210937501, 0.5742187503, 0.1210937501, 0.2695312501, 0.0742187500, 0.8554687504, 0.8476562504, 0.5273437502, 0.7695312504, 0.1679687501, 0.9179687504, 0.2773437501 }, + { 0.2304687501, 0.5507812503, 0.9414062504, 0.4726562502, 0.6210937503, 0.0742187500, 0.6210937503, 0.7695312504, 0.5742187503, 0.3554687502, 0.3476562502, 0.0273437500, 0.2695312501, 0.6679687503, 0.4179687502, 0.7773437504 }, + { 0.1679687501, 0.4882812502, 0.2539062501, 0.1601562501, 0.6835937503, 0.0117187500, 0.9335937504, 0.3320312502, 0.2617187501, 0.9179687504, 0.2851562501, 0.2148437501, 0.2070312501, 0.2304687501, 0.2304687501, 0.0898437500 }, + { 0.6679687503, 0.9882812505, 0.7539062504, 0.6601562503, 0.1835937501, 0.5117187502, 0.4335937502, 0.8320312504, 0.7617187504, 0.4179687502, 0.7851562504, 0.7148437503, 0.7070312503, 0.7304687503, 0.7304687503, 0.5898437503 }, + { 0.9179687504, 0.2382812501, 0.5039062502, 0.4101562502, 0.4335937502, 0.2617187501, 0.1835937501, 0.0820312500, 0.0117187500, 0.1679687501, 0.0351562500, 0.9648437504, 0.4570312502, 0.9804687505, 0.4804687502, 0.8398437504 }, + { 0.4179687502, 0.7382812503, 0.0039062500, 0.9101562504, 0.9335937504, 0.7617187504, 0.6835937503, 0.5820312503, 0.5117187502, 0.6679687503, 0.5351562502, 0.4648437502, 0.9570312504, 0.4804687502, 0.9804687505, 0.3398437502 }, + { 0.2929687501, 0.1132812501, 0.8789062504, 0.0351562500, 0.3085937501, 0.8867187504, 0.8085937504, 0.9570312504, 0.3867187502, 0.0429687500, 0.1601562501, 0.5898437503, 0.0820312500, 0.3554687502, 0.6054687503, 0.2148437501 }, + { 0.7929687504, 0.6132812503, 0.3789062502, 0.5351562502, 0.8085937504, 0.3867187502, 0.3085937501, 0.4570312502, 0.8867187504, 0.5429687503, 0.6601562503, 0.0898437500, 0.5820312503, 0.8554687504, 0.1054687500, 0.7148437503 }, + { 0.5429687503, 0.3632812502, 0.1289062501, 0.2851562501, 0.5585937503, 0.6367187503, 0.0585937500, 0.7070312503, 0.1367187501, 0.7929687504, 0.4101562502, 0.3398437502, 0.3320312502, 0.6054687503, 0.8554687504, 0.9648437504 }, + { 0.0429687500, 0.8632812504, 0.6289062503, 0.7851562504, 0.0585937500, 0.1367187501, 0.5585937503, 0.2070312501, 0.6367187503, 0.2929687501, 0.9101562504, 0.8398437504, 0.8320312504, 0.1054687500, 0.3554687502, 0.4648437502 }, + { 0.0585937500, 0.0664062500, 0.3320312502, 0.3945312502, 0.7617187504, 0.8085937504, 0.1992187501, 0.8164062504, 0.1835937501, 0.6210937503, 0.6445312503, 0.1054687500, 0.1289062501, 0.5585937503, 0.8710937504, 0.4179687502 }, + { 0.5585937503, 0.5664062503, 0.8320312504, 0.8945312504, 0.2617187501, 0.3085937501, 0.6992187503, 0.3164062501, 0.6835937503, 0.1210937501, 0.1445312501, 0.6054687503, 0.6289062503, 0.0585937500, 0.3710937502, 0.9179687504 }, + { 0.8085937504, 0.3164062501, 0.5820312503, 0.1445312501, 0.0117187500, 0.5585937503, 0.9492187504, 0.5664062503, 0.4335937502, 0.3710937502, 0.8945312504, 0.8554687504, 0.3789062502, 0.3085937501, 0.6210937503, 0.6679687503 }, + { 0.3085937501, 0.8164062504, 0.0820312500, 0.6445312503, 0.5117187502, 0.0585937500, 0.4492187502, 0.0664062500, 0.9335937504, 0.8710937504, 0.3945312502, 0.3554687502, 0.8789062504, 0.8085937504, 0.1210937501, 0.1679687501 }, + { 0.4335937502, 0.4414062502, 0.9570312504, 0.2695312501, 0.1367187501, 0.1835937501, 0.0742187500, 0.4414062502, 0.0585937500, 0.4960937502, 0.7695312504, 0.7304687503, 0.0039062500, 0.9335937504, 0.4960937502, 0.2929687501 }, + { 0.9335937504, 0.9414062504, 0.4570312502, 0.7695312504, 0.6367187503, 0.6835937503, 0.5742187503, 0.9414062504, 0.5585937503, 0.9960937505, 0.2695312501, 0.2304687501, 0.5039062502, 0.4335937502, 0.9960937505, 0.7929687504 }, + { 0.6835937503, 0.1914062501, 0.2070312501, 0.0195312500, 0.8867187504, 0.4335937502, 0.8242187504, 0.1914062501, 0.3085937501, 0.7460937503, 0.5195312502, 0.4804687502, 0.2539062501, 0.1835937501, 0.2460937501, 0.5429687503 }, + { 0.1835937501, 0.6914062503, 0.7070312503, 0.5195312502, 0.3867187502, 0.9335937504, 0.3242187502, 0.6914062503, 0.8085937504, 0.2460937501, 0.0195312500, 0.9804687505, 0.7539062504, 0.6835937503, 0.7460937503, 0.0429687500 }, + { 0.2460937501, 0.2539062501, 0.0195312500, 0.8320312504, 0.3242187502, 0.9960937505, 0.1367187501, 0.1289062501, 0.1210937501, 0.5585937503, 0.0820312500, 0.7929687504, 0.6914062503, 0.2460937501, 0.9335937504, 0.8554687504 }, + { 0.7460937503, 0.7539062504, 0.5195312502, 0.3320312502, 0.8242187504, 0.4960937502, 0.6367187503, 0.6289062503, 0.6210937503, 0.0585937500, 0.5820312503, 0.2929687501, 0.1914062501, 0.7460937503, 0.4335937502, 0.3554687502 }, + { 0.9960937505, 0.0039062500, 0.7695312504, 0.5820312503, 0.5742187503, 0.7460937503, 0.8867187504, 0.3789062502, 0.3710937502, 0.3085937501, 0.3320312502, 0.0429687500, 0.9414062504, 0.9960937505, 0.6835937503, 0.1054687500 }, + { 0.4960937502, 0.5039062502, 0.2695312501, 0.0820312500, 0.0742187500, 0.2460937501, 0.3867187502, 0.8789062504, 0.8710937504, 0.8085937504, 0.8320312504, 0.5429687503, 0.4414062502, 0.4960937502, 0.1835937501, 0.6054687503 }, + { 0.3710937502, 0.1289062501, 0.6445312503, 0.9570312504, 0.6992187503, 0.1210937501, 0.0117187500, 0.5039062502, 0.2460937501, 0.4335937502, 0.4570312502, 0.4179687502, 0.5664062503, 0.3710937502, 0.3085937501, 0.9804687505 }, + { 0.8710937504, 0.6289062503, 0.1445312501, 0.4570312502, 0.1992187501, 0.6210937503, 0.5117187502, 0.0039062500, 0.7460937503, 0.9335937504, 0.9570312504, 0.9179687504, 0.0664062500, 0.8710937504, 0.8085937504, 0.4804687502 }, + { 0.6210937503, 0.3789062502, 0.3945312502, 0.7070312503, 0.4492187502, 0.3710937502, 0.7617187504, 0.7539062504, 0.4960937502, 0.6835937503, 0.2070312501, 0.6679687503, 0.8164062504, 0.6210937503, 0.0585937500, 0.2304687501 }, + { 0.1210937501, 0.8789062504, 0.8945312504, 0.2070312501, 0.9492187504, 0.8710937504, 0.2617187501, 0.2539062501, 0.9960937505, 0.1835937501, 0.7070312503, 0.1679687501, 0.3164062501, 0.1210937501, 0.5585937503, 0.7304687503 }, + { 0.0898437500, 0.4101562502, 0.5507812503, 0.0507812500, 0.5429687503, 0.5898437503, 0.7304687503, 0.0351562500, 0.9023437504, 0.9648437504, 0.8007812504, 0.7617187504, 0.9726562505, 0.6523437503, 0.0898437500, 0.8867187504 }, + { 0.5898437503, 0.9101562504, 0.0507812500, 0.5507812503, 0.0429687500, 0.0898437500, 0.2304687501, 0.5351562502, 0.4023437502, 0.4648437502, 0.3007812501, 0.2617187501, 0.4726562502, 0.1523437501, 0.5898437503, 0.3867187502 }, + { 0.8398437504, 0.1601562501, 0.3007812501, 0.3007812501, 0.2929687501, 0.8398437504, 0.4804687502, 0.2851562501, 0.6523437503, 0.2148437501, 0.5507812503, 0.0117187500, 0.7226562503, 0.4023437502, 0.3398437502, 0.1367187501 }, + { 0.3398437502, 0.6601562503, 0.8007812504, 0.8007812504, 0.7929687504, 0.3398437502, 0.9804687505, 0.7851562504, 0.1523437501, 0.7148437503, 0.0507812500, 0.5117187502, 0.2226562501, 0.9023437504, 0.8398437504, 0.6367187503 }, + { 0.4648437502, 0.0351562500, 0.1757812501, 0.1757812501, 0.4179687502, 0.4648437502, 0.6054687503, 0.6601562503, 0.7773437504, 0.0898437500, 0.6757812503, 0.3867187502, 0.8476562504, 0.7773437504, 0.7148437503, 0.7617187504 }, + { 0.9648437504, 0.5351562502, 0.6757812503, 0.6757812503, 0.9179687504, 0.9648437504, 0.1054687500, 0.1601562501, 0.2773437501, 0.5898437503, 0.1757812501, 0.8867187504, 0.3476562502, 0.2773437501, 0.2148437501, 0.2617187501 }, + { 0.7148437503, 0.2851562501, 0.9257812504, 0.4257812502, 0.6679687503, 0.2148437501, 0.3554687502, 0.9101562504, 0.5273437502, 0.8398437504, 0.9257812504, 0.6367187503, 0.5976562503, 0.0273437500, 0.9648437504, 0.0117187500 }, + { 0.2148437501, 0.7851562504, 0.4257812502, 0.9257812504, 0.1679687501, 0.7148437503, 0.8554687504, 0.4101562502, 0.0273437500, 0.3398437502, 0.4257812502, 0.1367187501, 0.0976562500, 0.5273437502, 0.4648437502, 0.5117187502 }, + { 0.1523437501, 0.2226562501, 0.8632812504, 0.7382812503, 0.1054687500, 0.6523437503, 0.6679687503, 0.9726562505, 0.8398437504, 0.9023437504, 0.4882812502, 0.0742187500, 0.4101562502, 0.0898437500, 0.1523437501, 0.3242187502 }, + { 0.6523437503, 0.7226562503, 0.3632812502, 0.2382812501, 0.6054687503, 0.1523437501, 0.1679687501, 0.4726562502, 0.3398437502, 0.4023437502, 0.9882812505, 0.5742187503, 0.9101562504, 0.5898437503, 0.6523437503, 0.8242187504 }, + { 0.9023437504, 0.4726562502, 0.1132812501, 0.9882812505, 0.8554687504, 0.9023437504, 0.4179687502, 0.7226562503, 0.5898437503, 0.1523437501, 0.2382812501, 0.8242187504, 0.1601562501, 0.8398437504, 0.4023437502, 0.5742187503 }, + { 0.4023437502, 0.9726562505, 0.6132812503, 0.4882812502, 0.3554687502, 0.4023437502, 0.9179687504, 0.2226562501, 0.0898437500, 0.6523437503, 0.7382812503, 0.3242187502, 0.6601562503, 0.3398437502, 0.9023437504, 0.0742187500 }, + { 0.2773437501, 0.3476562502, 0.4882812502, 0.6132812503, 0.9804687505, 0.2773437501, 0.5429687503, 0.3476562502, 0.9648437504, 0.0273437500, 0.1132812501, 0.6992187503, 0.2851562501, 0.4648437502, 0.5273437502, 0.4492187502 }, + { 0.7773437504, 0.8476562504, 0.9882812505, 0.1132812501, 0.4804687502, 0.7773437504, 0.0429687500, 0.8476562504, 0.4648437502, 0.5273437502, 0.6132812503, 0.1992187501, 0.7851562504, 0.9648437504, 0.0273437500, 0.9492187504 }, + { 0.5273437502, 0.0976562500, 0.7382812503, 0.8632812504, 0.2304687501, 0.0273437500, 0.2929687501, 0.0976562500, 0.7148437503, 0.7773437504, 0.3632812502, 0.4492187502, 0.0351562500, 0.7148437503, 0.7773437504, 0.6992187503 }, + { 0.0273437500, 0.5976562503, 0.2382812501, 0.3632812502, 0.7304687503, 0.5273437502, 0.7929687504, 0.5976562503, 0.2148437501, 0.2773437501, 0.8632812504, 0.9492187504, 0.5351562502, 0.2148437501, 0.2773437501, 0.1992187501 }, + { 0.0195312500, 0.1992187501, 0.7304687503, 0.2460937501, 0.2539062501, 0.7070312503, 0.0664062500, 0.8085937504, 0.5195312502, 0.8007812504, 0.2460937501, 0.6757812503, 0.9023437504, 0.9570312504, 0.2539062501, 0.4726562502 }, + { 0.5195312502, 0.6992187503, 0.2304687501, 0.7460937503, 0.7539062504, 0.2070312501, 0.5664062503, 0.3085937501, 0.0195312500, 0.3007812501, 0.7460937503, 0.1757812501, 0.4023437502, 0.4570312502, 0.7539062504, 0.9726562505 }, + { 0.7695312504, 0.4492187502, 0.4804687502, 0.4960937502, 0.5039062502, 0.9570312504, 0.8164062504, 0.5585937503, 0.7695312504, 0.0507812500, 0.4960937502, 0.4257812502, 0.6523437503, 0.2070312501, 0.0039062500, 0.7226562503 }, + { 0.2695312501, 0.9492187504, 0.9804687505, 0.9960937505, 0.0039062500, 0.4570312502, 0.3164062501, 0.0585937500, 0.2695312501, 0.5507812503, 0.9960937505, 0.9257812504, 0.1523437501, 0.7070312503, 0.5039062502, 0.2226562501 }, + { 0.3945312502, 0.3242187502, 0.1054687500, 0.1210937501, 0.6289062503, 0.3320312502, 0.1914062501, 0.4335937502, 0.6445312503, 0.1757812501, 0.3710937502, 0.0507812500, 0.7773437504, 0.5820312503, 0.8789062504, 0.3476562502 }, + { 0.8945312504, 0.8242187504, 0.6054687503, 0.6210937503, 0.1289062501, 0.8320312504, 0.6914062503, 0.9335937504, 0.1445312501, 0.6757812503, 0.8710937504, 0.5507812503, 0.2773437501, 0.0820312500, 0.3789062502, 0.8476562504 }, + { 0.6445312503, 0.0742187500, 0.8554687504, 0.3710937502, 0.3789062502, 0.0820312500, 0.9414062504, 0.1835937501, 0.8945312504, 0.9257812504, 0.1210937501, 0.8007812504, 0.5273437502, 0.3320312502, 0.6289062503, 0.5976562503 }, + { 0.1445312501, 0.5742187503, 0.3554687502, 0.8710937504, 0.8789062504, 0.5820312503, 0.4414062502, 0.6835937503, 0.3945312502, 0.4257812502, 0.6210937503, 0.3007812501, 0.0273437500, 0.8320312504, 0.1289062501, 0.0976562500 }, + { 0.2070312501, 0.3867187502, 0.9179687504, 0.5585937503, 0.8164062504, 0.5195312502, 0.0039062500, 0.2460937501, 0.7070312503, 0.8632812504, 0.5585937503, 0.4882812502, 0.4648437502, 0.2695312501, 0.4414062502, 0.7851562504 }, + { 0.7070312503, 0.8867187504, 0.4179687502, 0.0585937500, 0.3164062501, 0.0195312500, 0.5039062502, 0.7460937503, 0.2070312501, 0.3632812502, 0.0585937500, 0.9882812505, 0.9648437504, 0.7695312504, 0.9414062504, 0.2851562501 }, + { 0.9570312504, 0.1367187501, 0.1679687501, 0.8085937504, 0.0664062500, 0.7695312504, 0.7539062504, 0.4960937502, 0.9570312504, 0.1132812501, 0.8085937504, 0.7382812503, 0.2148437501, 0.5195312502, 0.1914062501, 0.0351562500 }, + { 0.4570312502, 0.6367187503, 0.6679687503, 0.3085937501, 0.5664062503, 0.2695312501, 0.2539062501, 0.9960937505, 0.4570312502, 0.6132812503, 0.3085937501, 0.2382812501, 0.7148437503, 0.0195312500, 0.6914062503, 0.5351562502 }, + { 0.3320312502, 0.0117187500, 0.2929687501, 0.6835937503, 0.1914062501, 0.3945312502, 0.1289062501, 0.6210937503, 0.5820312503, 0.2382812501, 0.9335937504, 0.8632812504, 0.3398437502, 0.1445312501, 0.8164062504, 0.9101562504 }, + { 0.8320312504, 0.5117187502, 0.7929687504, 0.1835937501, 0.6914062503, 0.8945312504, 0.6289062503, 0.1210937501, 0.0820312500, 0.7382812503, 0.4335937502, 0.3632812502, 0.8398437504, 0.6445312503, 0.3164062501, 0.4101562502 }, + { 0.5820312503, 0.2617187501, 0.5429687503, 0.9335937504, 0.9414062504, 0.1445312501, 0.8789062504, 0.8710937504, 0.8320312504, 0.9882812505, 0.6835937503, 0.1132812501, 0.0898437500, 0.8945312504, 0.5664062503, 0.1601562501 }, + { 0.0820312500, 0.7617187504, 0.0429687500, 0.4335937502, 0.4414062502, 0.6445312503, 0.3789062502, 0.3710937502, 0.3320312502, 0.4882812502, 0.1835937501, 0.6132812503, 0.5898437503, 0.3945312502, 0.0664062500, 0.6601562503 }, + { 0.1132812501, 0.2929687501, 0.3867187502, 0.3398437502, 0.0351562500, 0.9257812504, 0.5976562503, 0.0898437500, 0.3007812501, 0.6445312503, 0.3398437502, 0.4570312502, 0.2460937501, 0.8632812504, 0.5351562502, 0.9414062504 }, + { 0.6132812503, 0.7929687504, 0.8867187504, 0.8398437504, 0.5351562502, 0.4257812502, 0.0976562500, 0.5898437503, 0.8007812504, 0.1445312501, 0.8398437504, 0.9570312504, 0.7460937503, 0.3632812502, 0.0351562500, 0.4414062502 }, + { 0.8632812504, 0.0429687500, 0.6367187503, 0.0898437500, 0.7851562504, 0.6757812503, 0.3476562502, 0.3398437502, 0.0507812500, 0.3945312502, 0.0898437500, 0.7070312503, 0.4960937502, 0.1132812501, 0.7851562504, 0.1914062501 }, + { 0.3632812502, 0.5429687503, 0.1367187501, 0.5898437503, 0.2851562501, 0.1757812501, 0.8476562504, 0.8398437504, 0.5507812503, 0.8945312504, 0.5898437503, 0.2070312501, 0.9960937505, 0.6132812503, 0.2851562501, 0.6914062503 }, + { 0.4882812502, 0.1679687501, 0.7617187504, 0.4648437502, 0.9101562504, 0.0507812500, 0.7226562503, 0.7148437503, 0.4257812502, 0.2695312501, 0.2148437501, 0.8320312504, 0.1210937501, 0.7382812503, 0.1601562501, 0.8164062504 }, + { 0.9882812505, 0.6679687503, 0.2617187501, 0.9648437504, 0.4101562502, 0.5507812503, 0.2226562501, 0.2148437501, 0.9257812504, 0.7695312504, 0.7148437503, 0.3320312502, 0.6210937503, 0.2382812501, 0.6601562503, 0.3164062501 }, + { 0.7382812503, 0.4179687502, 0.0117187500, 0.2148437501, 0.1601562501, 0.3007812501, 0.4726562502, 0.9648437504, 0.1757812501, 0.5195312502, 0.4648437502, 0.0820312500, 0.3710937502, 0.4882812502, 0.4101562502, 0.0664062500 }, + { 0.2382812501, 0.9179687504, 0.5117187502, 0.7148437503, 0.6601562503, 0.8007812504, 0.9726562505, 0.4648437502, 0.6757812503, 0.0195312500, 0.9648437504, 0.5820312503, 0.8710937504, 0.9882812505, 0.9101562504, 0.5664062503 }, + { 0.1757812501, 0.1054687500, 0.1992187501, 0.9023437504, 0.5976562503, 0.8632812504, 0.5351562502, 0.9023437504, 0.4882812502, 0.7070312503, 0.9023437504, 0.6445312503, 0.6835937503, 0.4257812502, 0.7226562503, 0.2539062501 }, + { 0.6757812503, 0.6054687503, 0.6992187503, 0.4023437502, 0.0976562500, 0.3632812502, 0.0351562500, 0.4023437502, 0.9882812505, 0.2070312501, 0.4023437502, 0.1445312501, 0.1835937501, 0.9257812504, 0.2226562501, 0.7539062504 }, + { 0.9257812504, 0.3554687502, 0.9492187504, 0.6523437503, 0.3476562502, 0.6132812503, 0.2851562501, 0.6523437503, 0.2382812501, 0.4570312502, 0.6523437503, 0.3945312502, 0.9335937504, 0.6757812503, 0.9726562505, 0.5039062502 }, + { 0.4257812502, 0.8554687504, 0.4492187502, 0.1523437501, 0.8476562504, 0.1132812501, 0.7851562504, 0.1523437501, 0.7382812503, 0.9570312504, 0.1523437501, 0.8945312504, 0.4335937502, 0.1757812501, 0.4726562502, 0.0039062500 }, + { 0.3007812501, 0.4804687502, 0.5742187503, 0.7773437504, 0.4726562502, 0.2382812501, 0.6601562503, 0.2773437501, 0.3632812502, 0.3320312502, 0.5273437502, 0.0195312500, 0.5585937503, 0.0507812500, 0.0976562500, 0.3789062502 }, + { 0.8007812504, 0.9804687505, 0.0742187500, 0.2773437501, 0.9726562505, 0.7382812503, 0.1601562501, 0.7773437504, 0.8632812504, 0.8320312504, 0.0273437500, 0.5195312502, 0.0585937500, 0.5507812503, 0.5976562503, 0.8789062504 }, + { 0.5507812503, 0.2304687501, 0.3242187502, 0.5273437502, 0.7226562503, 0.4882812502, 0.4101562502, 0.0273437500, 0.1132812501, 0.5820312503, 0.7773437504, 0.7695312504, 0.8085937504, 0.8007812504, 0.3476562502, 0.6289062503 }, + { 0.0507812500, 0.7304687503, 0.8242187504, 0.0273437500, 0.2226562501, 0.9882812505, 0.9101562504, 0.5273437502, 0.6132812503, 0.0820312500, 0.2773437501, 0.2695312501, 0.3085937501, 0.3007812501, 0.8476562504, 0.1289062501 }, + { 0.0351562500, 0.4648437502, 0.1523437501, 0.6679687503, 0.9570312504, 0.0664062500, 0.3320312502, 0.3867187502, 0.0664062500, 0.7539062504, 0.0429687500, 0.5351562502, 0.7304687503, 0.8476562504, 0.3632812502, 0.2382812501 }, + { 0.5351562502, 0.9648437504, 0.6523437503, 0.1679687501, 0.4570312502, 0.5664062503, 0.8320312504, 0.8867187504, 0.5664062503, 0.2539062501, 0.5429687503, 0.0351562500, 0.2304687501, 0.3476562502, 0.8632812504, 0.7382812503 }, + { 0.7851562504, 0.2148437501, 0.9023437504, 0.9179687504, 0.2070312501, 0.3164062501, 0.5820312503, 0.1367187501, 0.3164062501, 0.0039062500, 0.2929687501, 0.2851562501, 0.9804687505, 0.0976562500, 0.1132812501, 0.9882812505 }, + { 0.2851562501, 0.7148437503, 0.4023437502, 0.4179687502, 0.7070312503, 0.8164062504, 0.0820312500, 0.6367187503, 0.8164062504, 0.5039062502, 0.7929687504, 0.7851562504, 0.4804687502, 0.5976562503, 0.6132812503, 0.4882812502 } +}; + + +QRNG_VALIDATION_TEST_FUNCTIONS(sobol) + +BOOST_AUTO_TEST_CASE( validate_sobol ) +{ + test_sobol_values(sobol_02_100, 0); + test_sobol_values(sobol_07_100, 128); + test_sobol_values(sobol_16_100, 128); +} + +BOOST_AUTO_TEST_CASE( validate_sobol_seed ) +{ + test_sobol_seed(sobol_02_100, 0); + test_sobol_seed(sobol_07_100, 128); + test_sobol_seed(sobol_16_100, 128); +} + +BOOST_AUTO_TEST_CASE( validate_sobol_discard ) +{ + test_sobol_discard(sobol_02_100, 0); + test_sobol_discard(sobol_07_100, 128); + test_sobol_discard(sobol_16_100, 128); +}