gpp_random_test

Contents:

gpp_random_test.hpp

Tests for gpp_random.hpp: PRNG container classes and point sampling.

The tests for domain sampling test that the sampled point sets have the properties promised by the algorithms that computed them (e.g., RandomPointInDomain only promises point in the domain whereas LatinHypercube has a check-able guarantee of more evenly distributed samples).

The PRNG container tests verify that the seeding functions properly generate unique seeds in multithreaded environments, “with high probability.”

namespace optimal_learning

Macro to allow restrict as a keyword for C++ compilation and CUDA/nvcc compilation. See related entry in gpp_common.hpp for more details.

gpp_random_test.cpp

This file contains functions for testing the functions and classes in gpp_random.hpp. There are also a number of simple supporting routines. See header for comments on the general layout of these tests.

namespace optimal_learning

Macro to allow restrict as a keyword for C++ compilation and CUDA/nvcc compilation. See related entry in gpp_common.hpp for more details.

Functions

int RunRandomPointGeneratorTests()

Tests that the various point generator functions available in gpp_random.hpp are working; e.g.,

  • ComputeRandomPointInDomain()
  • ComputeLatinHypercubePointsInDomain()
  • ComputeUniformPointsInUnitSimplex()
Returns:
number of test failures: 0 if all point generator functions are working properly

int RandomNumberGeneratorContainerTest()

Note

only NormalRNG is meant to be used multi-threaded, so UniformRandomGenerator is not tested for generating unique seeds in a multi-threaded environment

Checks that PRNG container is behaving correctly:

  • Tests manual seed setting
  • Tests last_seed and reset
  • Tests that in multithreaded environemnts, each thread gets a different seed
Returns:
number of test failures: 0 if PRNG containers are behaving correctly