Generator

Trait Generator 

Source
pub trait Generator<Dim: Dimension> {
    // Required method
    fn _generate(&self, count: usize, dims: Dim, iteration: u64) -> Trace<Dim>;

    // Provided methods
    fn generate(&self, count: usize, dims: Dim) -> Schedule<Dim> { ... }
    fn generate_with_iter(
        &self,
        count: usize,
        dims: Dim,
        iteration: u64,
    ) -> Schedule<Dim> { ... }
    fn generate_with_trace(&self, count: usize, dims: Dim) -> Trace<Dim> { ... }
    fn generate_with_iter_and_trace(
        &self,
        count: usize,
        dims: Dim,
        iteration: u64,
    ) -> Trace<Dim> { ... }
    fn then<T: Modifier<Dim>>(self, modifier: T) -> T::Output<Self>
       where Self: Sized { ... }
    fn _generate_no_trace(
        &self,
        count: usize,
        dims: Dim,
        iteration: u64,
    ) -> Schedule<Dim> { ... }
}
Expand description

Generates new schedules.

Generators take in the number of samples to generate, the dimensions of the schedule, and an iteration parameter.

The iteration parameter controls implementation-specific arbitrary parameters of the algorithm like random seeds. This allows seed searching using crate::modifiers::Iterate.

Implementations are expected to generate schedules with the dimensions given and the number of samples specified by count. This is verified by assertions in the default implementations of generate, generate_with_trace, and generate_with_iter_and_trace.

Required Methods§

Source

fn _generate(&self, count: usize, dims: Dim, iteration: u64) -> Trace<Dim>

The underlying implementation of a schedule generator. Users should not call this directly because it doesn’t perform correctness assertions.

Implementors should not override any other methods of Generator except possibly Generator::_generate_no_trace.

Implementors must push their trace output value to the top of the trace.

Provided Methods§

Source

fn generate(&self, count: usize, dims: Dim) -> Schedule<Dim>

Generate a schedule where the iteration parameter is set to zero.

Source

fn generate_with_iter( &self, count: usize, dims: Dim, iteration: u64, ) -> Schedule<Dim>

Generate a schedule with a user-defined iteration parameter.

Source

fn generate_with_trace(&self, count: usize, dims: Dim) -> Trace<Dim>

Generate a schedule including trace output from each generation step.

The iteration parameter is set to zero.

Source

fn generate_with_iter_and_trace( &self, count: usize, dims: Dim, iteration: u64, ) -> Trace<Dim>

Generate a schedule with a user-defined iteration parameter while returning a trace.

Source

fn then<T: Modifier<Dim>>(self, modifier: T) -> T::Output<Self>
where Self: Sized,

Apply a modifier to the generator.

You may use a modifier’s builder method instead of this method directly if you do not need to determine the modifier at runtime.

Source

fn _generate_no_trace( &self, count: usize, dims: Dim, iteration: u64, ) -> Schedule<Dim>

This function may be overridden when a generator can be sped up in cases where the trace is not needed. Users should not call this directly because it doesn’t perform correctness assertions.

Implementors§