pub struct SobolSequence { /* private fields */ }Expand description
Multi-dimensional Sobol sequence (Bratley-Fox 1988 starter set, dimensions 1–6). For higher-dimensional uses, switch to a Joe-Kuo D6 direction-number table (out of scope here).
§Examples
use vrd::quasirandom::SobolSequence;
let mut s = SobolSequence::new(2);
let p = s.next_point::<2>();
assert!(p[0] >= 0.0 && p[0] < 1.0);Implementations§
Source§impl SobolSequence
impl SobolSequence
Sourcepub fn new(d: usize) -> Self
pub fn new(d: usize) -> Self
Builds a d-dimensional Sobol sequence. Panics if d is 0
or exceeds SOBOL_MAX_DIM.
Sourcepub fn next_point<const D: usize>(&mut self) -> [f64; D]
pub fn next_point<const D: usize>(&mut self) -> [f64; D]
Returns the next D-dimensional point.
Sourcepub fn next_point_vec(&mut self) -> Vec<f64>
pub fn next_point_vec(&mut self) -> Vec<f64>
Returns the next point as an allocated Vec. Requires
alloc.
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Returns the dimension count.
Trait Implementations§
Source§impl Clone for SobolSequence
impl Clone for SobolSequence
Source§fn clone(&self) -> SobolSequence
fn clone(&self) -> SobolSequence
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SobolSequence
impl Debug for SobolSequence
impl Copy for SobolSequence
Auto Trait Implementations§
impl Freeze for SobolSequence
impl RefUnwindSafe for SobolSequence
impl Send for SobolSequence
impl Sync for SobolSequence
impl Unpin for SobolSequence
impl UnsafeUnpin for SobolSequence
impl UnwindSafe for SobolSequence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more