pub trait ExampleCode {
Show 22 methods
// Required methods
fn vertices_edges(&mut self) -> (&mut Vec<CodeVertex>, &mut Vec<CodeEdge>);
fn immutable_vertices_edges(&self) -> (&Vec<CodeVertex>, &Vec<CodeEdge>);
// Provided methods
fn vertex_num(&self) -> VertexNum { ... }
fn compute_weights(&mut self, max_half_weight: Weight) { ... }
fn sanity_check(&self) -> Result<(), String> { ... }
fn set_probability(&mut self, p: f64) { ... }
fn set_erasure_probability(&mut self, pe: f64) { ... }
fn fill_vertices(&mut self, vertex_num: VertexNum) { ... }
fn get_positions(&self) -> Vec<VisualizePosition> { ... }
fn get_initializer(&self) -> SolverInitializer { ... }
fn set_defect_vertices(&mut self, defect_vertices: &[VertexIndex]) { ... }
fn set_erasures(&mut self, erasures: &[EdgeIndex]) { ... }
fn set_syndrome(&mut self, syndrome_pattern: &SyndromePattern) { ... }
fn get_defect_vertices(&self) -> Vec<VertexIndex> ⓘ { ... }
fn get_erasures(&self) -> Vec<EdgeIndex> ⓘ { ... }
fn get_syndrome(&self) -> SyndromePattern { ... }
fn generate_random_errors(&mut self, seed: u64) -> SyndromePattern { ... }
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 { ... }
fn reorder_vertices(&mut self, sequential_vertices: &[VertexIndex]) { ... }
}Required Methods§
Sourcefn 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>)
Provided Methods§
Sourcefn vertex_num(&self) -> VertexNum
fn vertex_num(&self) -> VertexNum
get the number of vertices
Sourcefn 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
Sourcefn sanity_check(&self) -> Result<(), String>
fn sanity_check(&self) -> Result<(), String>
sanity check to avoid duplicate edges that are hard to debug
Sourcefn set_probability(&mut self, p: f64)
fn set_probability(&mut self, p: f64)
set probability of all edges; user can set individual probabilities
Sourcefn 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
Sourcefn fill_vertices(&mut self, vertex_num: VertexNum)
fn fill_vertices(&mut self, vertex_num: VertexNum)
automatically create vertices given edges
Sourcefn get_positions(&self) -> Vec<VisualizePosition>
fn get_positions(&self) -> Vec<VisualizePosition>
gather all positions of vertices
Sourcefn get_initializer(&self) -> SolverInitializer
fn get_initializer(&self) -> SolverInitializer
generate standard interface to instantiate Fusion blossom solver
Sourcefn 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)
Sourcefn set_erasures(&mut self, erasures: &[EdgeIndex])
fn set_erasures(&mut self, erasures: &[EdgeIndex])
set erasure edges
Sourcefn set_syndrome(&mut self, syndrome_pattern: &SyndromePattern)
fn set_syndrome(&mut self, syndrome_pattern: &SyndromePattern)
set syndrome
Sourcefn get_defect_vertices(&self) -> Vec<VertexIndex> ⓘ
fn get_defect_vertices(&self) -> Vec<VertexIndex> ⓘ
get current defect vertices
Sourcefn get_erasures(&self) -> Vec<EdgeIndex> ⓘ
fn get_erasures(&self) -> Vec<EdgeIndex> ⓘ
get current erasure edges
Sourcefn get_syndrome(&self) -> SyndromePattern
fn get_syndrome(&self) -> SyndromePattern
get current syndrome
Sourcefn 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
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
Sourcefn 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