Skip to main content

sobol_sequence

Function sobol_sequence 

Source
pub fn sobol_sequence(n: usize, d: usize) -> Vec<Vec<f64>>
Expand description

Generate n Sobol points in [0, 1)^d, starting from index 1 (the origin at index 0 is skipped).

§Panics

Panics if d is 0 or exceeds 8.

§Examples

let pts = lowdisc::sobol_sequence(4, 1);
// 1D Sobol (Gray-code order): 0.5, 0.75, 0.25, 0.375
assert!((pts[0][0] - 0.5).abs() < 1e-12);
assert!((pts[1][0] - 0.75).abs() < 1e-12);
assert!((pts[2][0] - 0.25).abs() < 1e-12);
assert!((pts[3][0] - 0.375).abs() < 1e-12);