Halton

Struct Halton 

Source
pub struct Halton { /* private fields */ }
Expand description

The Halton struct is a generator for the Halton sequence.

Properties:

  • vdc0: An instance of the VdCorput struct used for generating the first dimension of the Halton sequence.
  • vdc1: The vdc1 property is an instance of the VdCorput struct. It is used to generate the Van der Corput sequence for the second dimension of the Halton sequence.

§Examples

use lds_rs::ilds::Halton;

let mut hgen = Halton::new(&[2, 3], &[11, 7]);
hgen.reseed(0);
let result = hgen.pop();

assert_eq!(result[0], 1024);

Implementations§

Source§

impl Halton

Source

pub fn new(base: &[usize], scale: &[u32]) -> Self

Creates a new Halton.

The new function creates a new Halton struct with specified base and scale values for two VdCorput sequences.

Arguments:

  • base: The base parameter is an array of usize values that represents the base for each dimension of the Halton sequence. Each element in the base array corresponds to a dimension in the sequence.
  • scale: The scale parameter is an array of u32 values that determine the scale or precision of the Halton sequence for each dimension. Each element in the scale array corresponds to a dimension in the Halton sequence. The larger the value of scale, the more precise the Halton sequence.

Returns:

The new function is returning an instance of the Halton struct.

Source

pub fn pop(&mut self) -> [usize; 2]

The pop function returns an array containing the pop values of two Halton instances.

Returns:

An array of two usize values is being returned.

Source

pub fn reseed(&mut self, seed: usize)

The below code is a Rust function called reseed that is used to reset the state of a sequence generator to a specific seed value. This allows the sequence generator to start generating the sequence from the beginning or from a specific point in the sequence, depending on the value of the seed.

Trait Implementations§

Source§

impl Debug for Halton

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Halton

§

impl RefUnwindSafe for Halton

§

impl Send for Halton

§

impl Sync for Halton

§

impl Unpin for Halton

§

impl UnwindSafe for Halton

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.