Skip to main content

Sampler

Trait Sampler 

Source
pub trait Sampler: Send + Sync {
    // Required methods
    fn sample(&self, rng: &mut DeterministicRng) -> ErrorSet;
    fn sample_single_error(&self, index: usize) -> ErrorSet;
    fn count_single_error(&self) -> usize;
    fn readouts_match(&self, actual: &BitVector, expected: &BitVector) -> bool;
    fn error_tag(&self, marginal_index: usize, error_index: usize) -> &str;

    // Provided method
    fn filtered_count(&self) -> u64 { ... }
}
Expand description

Trait for measurement samplers used by the simulation loop.

Required Methods§

Source

fn sample(&self, rng: &mut DeterministicRng) -> ErrorSet

Sample a set of errors.

Source

fn sample_single_error(&self, index: usize) -> ErrorSet

Return the error set for a specific single error by index.

Source

fn count_single_error(&self) -> usize

Total number of individual errors across all marginals.

Source

fn readouts_match(&self, actual: &BitVector, expected: &BitVector) -> bool

Check if actual readouts match expected, respecting the readout mask.

Source

fn error_tag(&self, marginal_index: usize, error_index: usize) -> &str

Get the tag string for a specific error in a specific marginal.

Provided Methods§

Source

fn filtered_count(&self) -> u64

Number of samples that were filtered out (e.g. due to preselect failures). Returns 0 by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§