pub struct HaltonEngine {
index: u64,
base: u32,
seed: u64,
}Expand description
Halton quasi-random engine using radical-inverse sequences.
Supports base-2 (Van der Corput) and base-3 for two-dimensional low-discrepancy sequences. Convergence: O(log N / N) — slightly slower than Sobol but requires no direction numbers, making it cheaper in hardware (simple bit-reversal for base-2).
Fields§
§index: u64§base: u32§seed: u64Implementations§
Source§impl HaltonEngine
impl HaltonEngine
Sourcepub fn new(base: u32, seed: u64) -> Self
pub fn new(base: u32, seed: u64) -> Self
Create a new Halton engine with the given base and seed.
base must be a prime ≥ 2. Common choices: 2 (Van der Corput), 3.
Sourcefn radical_inverse(n: u64, base: u32) -> f64
fn radical_inverse(n: u64, base: u32) -> f64
Compute the radical inverse of n in the given base.
For base 2 this is equivalent to bit-reversal of the binary representation — trivially implementable in hardware.
Trait Implementations§
Source§impl Clone for HaltonEngine
impl Clone for HaltonEngine
Source§fn clone(&self) -> HaltonEngine
fn clone(&self) -> HaltonEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HaltonEngine
impl RefUnwindSafe for HaltonEngine
impl Send for HaltonEngine
impl Sync for HaltonEngine
impl Unpin for HaltonEngine
impl UnsafeUnpin for HaltonEngine
impl UnwindSafe for HaltonEngine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.