pub struct ErrorPatternReader {
pub vertices: Vec<CodeVertex>,
pub edges: Vec<CodeEdge>,
pub syndrome_patterns: Vec<SyndromePattern>,
pub defect_index: usize,
pub cyclic_syndrome: bool,
}Expand description
read from file, including the error patterns; the point is to avoid bad cache performance, because generating random error requires iterating over a large memory space, invalidating all cache. also, this can reduce the time of decoding by prepare the data before hand and could be shared between different partition configurations
Fields§
§vertices: Vec<CodeVertex>vertices in the code
edges: Vec<CodeEdge>nearest-neighbor edges in the decoding graph
syndrome_patterns: Vec<SyndromePattern>pre-generated syndrome patterns
defect_index: usizecursor of current errors
cyclic_syndrome: boolImplementations§
Trait Implementations§
Source§impl Clone for ErrorPatternReader
impl Clone for ErrorPatternReader
Source§fn clone(&self) -> ErrorPatternReader
fn clone(&self) -> ErrorPatternReader
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorPatternReader
impl Debug for ErrorPatternReader
Source§impl ExampleCode for ErrorPatternReader
impl ExampleCode for ErrorPatternReader
Source§fn vertices_edges(&mut self) -> (&mut Vec<CodeVertex>, &mut Vec<CodeEdge>)
fn vertices_edges(&mut self) -> (&mut Vec<CodeVertex>, &mut Vec<CodeEdge>)
get mutable references to vertices and edges
fn immutable_vertices_edges(&self) -> (&Vec<CodeVertex>, &Vec<CodeEdge>)
Source§fn generate_random_errors(&mut self, _seed: u64) -> SyndromePattern
fn generate_random_errors(&mut self, _seed: u64) -> SyndromePattern
generate random errors based on the edge probabilities and a seed for pseudo number generator
Source§fn vertex_num(&self) -> VertexNum
fn vertex_num(&self) -> VertexNum
get the number of vertices
Source§fn compute_weights(&mut self, max_half_weight: Weight)
fn compute_weights(&mut self, max_half_weight: Weight)
generic method that automatically computes integer weights from probabilities,
scales such that the maximum integer weight is 10000 and the minimum is 1
Source§fn sanity_check(&self) -> Result<(), String>
fn sanity_check(&self) -> Result<(), String>
sanity check to avoid duplicate edges that are hard to debug
Source§fn set_probability(&mut self, p: f64)
fn set_probability(&mut self, p: f64)
set probability of all edges; user can set individual probabilities
Source§fn set_erasure_probability(&mut self, pe: f64)
fn set_erasure_probability(&mut self, pe: f64)
set erasure probability of all edges; user can set individual probabilities
Source§fn fill_vertices(&mut self, vertex_num: VertexNum)
fn fill_vertices(&mut self, vertex_num: VertexNum)
automatically create vertices given edges
Source§fn get_positions(&self) -> Vec<VisualizePosition>
fn get_positions(&self) -> Vec<VisualizePosition>
gather all positions of vertices
Source§fn get_initializer(&self) -> SolverInitializer
fn get_initializer(&self) -> SolverInitializer
generate standard interface to instantiate Fusion blossom solver
Source§fn set_defect_vertices(&mut self, defect_vertices: &[VertexIndex])
fn set_defect_vertices(&mut self, defect_vertices: &[VertexIndex])
set defect vertices (non-trivial measurement result in case of single round of measurement,
or different result from the previous round in case of multiple rounds of measurement)
Source§fn set_erasures(&mut self, erasures: &[EdgeIndex])
fn set_erasures(&mut self, erasures: &[EdgeIndex])
set erasure edges
Source§fn set_syndrome(&mut self, syndrome_pattern: &SyndromePattern)
fn set_syndrome(&mut self, syndrome_pattern: &SyndromePattern)
set syndrome
Source§fn get_defect_vertices(&self) -> Vec<VertexIndex> ⓘ
fn get_defect_vertices(&self) -> Vec<VertexIndex> ⓘ
get current defect vertices
Source§fn get_syndrome(&self) -> SyndromePattern
fn get_syndrome(&self) -> SyndromePattern
get current syndrome
fn generate_errors(&mut self, edge_indices: &[EdgeIndex]) -> SyndromePattern
fn clear_errors(&mut self)
fn is_virtual(&self, vertex_idx: usize) -> bool
fn is_defect(&self, vertex_idx: usize) -> bool
Source§fn reorder_vertices(&mut self, sequential_vertices: &[VertexIndex])
fn reorder_vertices(&mut self, sequential_vertices: &[VertexIndex])
reorder the vertices such that new vertices (the indices of the old order) is sequential
Auto Trait Implementations§
impl Freeze for ErrorPatternReader
impl RefUnwindSafe for ErrorPatternReader
impl Send for ErrorPatternReader
impl Sync for ErrorPatternReader
impl Unpin for ErrorPatternReader
impl UnwindSafe for ErrorPatternReader
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> FusionVisualizer for Twhere
T: ExampleCode,
impl<T> FusionVisualizer for Twhere
T: ExampleCode,
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