sobol-qmc

Crates.iosobol-qmc
lib.rssobol-qmc
version2.5.0
created_at2025-08-07 13:13:59.574569+00
updated_at2025-08-20 12:41:16.707733+00
descriptionA Sobol sequence generator for Rust
homepagehttps://github.com/zao111222333/sobol-qmc
repositoryhttps://github.com/zao111222333/sobol-qmc
max_upload_size
id1785254
size753,218
Junzhuo ZHOU (zao111222333)

documentation

https://docs.rs/sobol-qmc

README

sobol-qmc

crates.io documentation License

A Sobol sequence generator for Rust, forked from sobol-rs

This crate provides Sobol low-discrepancy quasirandom sequences which are useful for integration and other tasks. The sequence can cover a domain evenly with as little as a few points and will continue to progressively fill the space as more points are added.

For efficiency, sobol employs the recursive variant of the gray code optimization proposed by Antonov-Saleev.

Below are examples of 2-dimensional points drawn from Sobol and Uniform generators respectively. See an animated visualization here.

Sobol Uniform

Usage

cargo install sobol

Print the first 100 points from a 3-dimensional sequence:

use sobol_qmc::Sobol;
use sobol_qmc::params::JoeKuoD6;

fn main() {
    let params = JoeKuoD6::STANDARD;
    let seq = Sobol::<f32>::new(3, &params);
    
    for point in seq.take(100) {
        println!("{:?}", point);
    }
}

In this example each component of the sequence is a 32-bit float but sobol also supports Rust's other numeric primitives. Floating point sequences span the unit hypercube (i.e. [0,1)) while integer valued sequences span the natural domain of the selected type. For example, u16 typed sequences will have components between 0 and 65,536.

Initialization Values

Initialization values (aka "parameters") supporting up to 21,201 dimensions are provided courtesy of Stephen Joe and Frances Kuo (source) and are accessible via sobol_qmc::params::JoeKuoD6. Custom initialization values can be used by implementing the sobol_qmc::SobolParams trait.

If imported into your project, the provided JoeKuoD6 parameters are automatically embedded into your project binary. To reduce the amount of data added to your project, JoeKuoD6 provides three otherwise identical parameter sets which can be selected from according to the dimensionality required by your sequences:

Source Supported Dims Approx. Size
JoeKuoD6::MINIMAL 100 1kb
JoeKuoD6::STANDARD 1,000 20kb
JoeKuoD6::EXTENDED 21,201 690kb

See also

  • lobos - A Sobol sequence generator for Scala and Javascript

References

License

Everything in this repo is BSD License unless otherwise specified

sobol-rs (c) 2020 Weston Siegenthaler

Commit count: 45

cargo fmt