OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestQuasiRandom.cpp File Reference

Unit tests for quasi-random number generation (replacement for gsl_qrng) More...

#include <gtest/gtest.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include "Utilities/QuasiRandom.h"
Include dependency graph for TestQuasiRandom.cpp:

Go to the source code of this file.

Classes

class  QuasiRandomTest
 

Functions

 TEST_F (QuasiRandomTest, BasicGeneration)
 
 TEST_F (QuasiRandomTest, SequenceUniqueness)
 
 TEST_F (QuasiRandomTest, MultiDimensional)
 
 TEST_F (QuasiRandomTest, Reproducibility)
 
 TEST_F (QuasiRandomTest, Coverage)
 

Detailed Description

Unit tests for quasi-random number generation (replacement for gsl_qrng)

This file contains unit tests for GSL-compatible quasi-random number generation using Sobol sequences. Quasi-random sequences provide better space-filling properties than pseudo-random sequences, making them useful for Monte Carlo integration and similar applications.

Test:
QuasiRandomTest::BasicGeneration Tests basic quasi-random number generation. Verifies that the generator can be allocated, that generated values are in the range \([0, 1)\), and that multi-dimensional sequences are generated correctly.
Test:
QuasiRandomTest::SequenceUniqueness Tests that generated sequences contain unique values and are not all zeros. Generates a sequence of 100 samples and verifies that values are properly distributed and non-trivial.
Test:
QuasiRandomTest::MultiDimensional Tests multi-dimensional quasi-random sequence generation. Verifies that all dimensions of a 5-dimensional sequence are correctly generated and that all values remain within the valid range \([0, 1)\).
Test:
QuasiRandomTest::Reproducibility Tests that quasi-random sequences are deterministic and reproducible. Creates two generators with the same initialization and verifies that they produce identical sequences, confirming deterministic behavior.
Test:
QuasiRandomTest::Coverage Tests space-filling properties of quasi-random sequences. Generates 1000 samples and verifies that the sequence covers a significant portion of the unit interval, demonstrating better coverage than pseudo-random sequences for low-discrepancy sequences.

Definition in file TestQuasiRandom.cpp.

Function Documentation

◆ TEST_F() [1/5]

TEST_F ( QuasiRandomTest  ,
BasicGeneration   
)

Definition at line 50 of file TestQuasiRandom.cpp.

References gsl_qrng_alloc(), gsl_qrng_free(), and gsl_qrng_get().

Here is the call graph for this function:

◆ TEST_F() [2/5]

TEST_F ( QuasiRandomTest  ,
Coverage   
)

Definition at line 128 of file TestQuasiRandom.cpp.

References gsl_qrng_alloc(), gsl_qrng_free(), and gsl_qrng_get().

Here is the call graph for this function:

◆ TEST_F() [3/5]

TEST_F ( QuasiRandomTest  ,
MultiDimensional   
)

Definition at line 95 of file TestQuasiRandom.cpp.

References gsl_qrng_alloc(), gsl_qrng_free(), and gsl_qrng_get().

Here is the call graph for this function:

◆ TEST_F() [4/5]

TEST_F ( QuasiRandomTest  ,
Reproducibility   
)

Definition at line 110 of file TestQuasiRandom.cpp.

References gsl_qrng_alloc(), gsl_qrng_free(), and gsl_qrng_get().

Here is the call graph for this function:

◆ TEST_F() [5/5]

TEST_F ( QuasiRandomTest  ,
SequenceUniqueness   
)

Definition at line 66 of file TestQuasiRandom.cpp.

References gsl_qrng_alloc(), gsl_qrng_free(), and gsl_qrng_get().

Here is the call graph for this function: