pub struct TailoredModelGraph {
pub nodes: Vec<Vec<Vec<Option<Box<TripleTailoredModelGraphNode>>>>>,
pub virtual_nodes: Vec<Position>,
pub corner_virtual_nodes: Vec<(Position, Position)>,
pub unfixed_stabilizers: HashMap<Position, (Arc<SparseErrorPattern>, Arc<SparseCorrection>)>,
}Expand description
edges connecting two nontrivial measurements generated by a single error
Fields§
§nodes: Vec<Vec<Vec<Option<Box<TripleTailoredModelGraphNode>>>>>(positive_node, negative_node, neutral_node), where neutral node only contains
virtual_nodes: Vec<Position>virtual nodes in the primary decoding part
corner_virtual_nodes: Vec<(Position, Position)>virtual nodes in the residual decoding part
unfixed_stabilizers: HashMap<Position, (Arc<SparseErrorPattern>, Arc<SparseCorrection>)>unfixed stabilizers
Implementations§
Source§impl TailoredModelGraph
impl TailoredModelGraph
Sourcepub fn new(simulator: &Simulator) -> Self
pub fn new(simulator: &Simulator) -> Self
initialize the structure corresponding to a Simulator
Sourcepub fn get_node(
&self,
position: &Position,
) -> &Option<Box<TripleTailoredModelGraphNode>>
pub fn get_node( &self, position: &Position, ) -> &Option<Box<TripleTailoredModelGraphNode>>
any valid position of the simulator is a valid position in model graph, but only some of these positions corresponds a valid node in model graph
Sourcepub fn is_node_exist(&self, position: &Position) -> bool
pub fn is_node_exist(&self, position: &Position) -> bool
check if a position contains model graph node
Sourcepub fn get_node_unwrap(
&self,
position: &Position,
) -> &TripleTailoredModelGraphNode
pub fn get_node_unwrap( &self, position: &Position, ) -> &TripleTailoredModelGraphNode
get reference self.nodes[t][i][j] and then unwrap
Sourcepub fn get_node_mut_unwrap(
&mut self,
position: &Position,
) -> &mut TripleTailoredModelGraphNode
pub fn get_node_mut_unwrap( &mut self, position: &Position, ) -> &mut TripleTailoredModelGraphNode
get mutable reference self.nodes[t][i][j] and unwrap
Sourcepub fn build(
&mut self,
simulator: &mut Simulator,
noise_model: &NoiseModel,
weight_function: &WeightFunction,
use_combined_probability: bool,
use_unfixed_stabilizer_edges: bool,
)
pub fn build( &mut self, simulator: &mut Simulator, noise_model: &NoiseModel, weight_function: &WeightFunction, use_combined_probability: bool, use_unfixed_stabilizer_edges: bool, )
build model graph given the simulator
pub fn is_state_clean(&self, simulator: &Simulator) -> bool
Sourcepub fn compute_unfixed_stabilizers(
&mut self,
simulator: &mut Simulator,
noise_model: &NoiseModel,
)
pub fn compute_unfixed_stabilizers( &mut self, simulator: &mut Simulator, noise_model: &NoiseModel, )
optimization technique from Shruti: if an error causes N error but out of which M stabilizers are unfixed (connected by 50% edges), then we should add this edge to both the positive and negative graph because this edge is essentially easy to decode. Especially in the tailored surface code with initialization, 1/4 to 1/2 stabilizers are unfixed, meaning there is a lot room for such optimization. Indeed, with this optimization, this tailored SC decoder will function just like a regular decoder in the depolarizing noise, which satisfy our expectation.
Sourcepub fn build_with_weight_function<F>(
&mut self,
simulator: &mut Simulator,
noise_model: &NoiseModel,
weight_of: F,
use_combined_probability: bool,
use_unfixed_stabilizer_edges: bool,
)
pub fn build_with_weight_function<F>( &mut self, simulator: &mut Simulator, noise_model: &NoiseModel, weight_of: F, use_combined_probability: bool, use_unfixed_stabilizer_edges: bool, )
build model graph given the simulator with customized weight function
Sourcepub fn add_one_edge(
&mut self,
positions: (&Position, &Position),
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
idx: usize,
)
pub fn add_one_edge( &mut self, positions: (&Position, &Position), probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, idx: usize, )
add asymmetric edge from source to target in positive direction;
in order to create symmetric edge, call this function twice with reversed input
Sourcepub fn add_positive_edge(
&mut self,
source: &Position,
target: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_positive_edge( &mut self, source: &Position, target: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add asymmetric edge from source to target in positive direction; in order to create symmetric edge, call this function twice with reversed input
Sourcepub fn add_positive_edge_between(
&mut self,
position1: &Position,
position2: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_positive_edge_between( &mut self, position1: &Position, position2: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add symmetric edge between source and target in positive direction
Sourcepub fn add_negative_edge(
&mut self,
source: &Position,
target: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_negative_edge( &mut self, source: &Position, target: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add asymmetric edge from source to target in negative direction; in order to create symmetric edge, call this function twice with reversed input
Sourcepub fn add_negative_edge_between(
&mut self,
position1: &Position,
position2: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_negative_edge_between( &mut self, position1: &Position, position2: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add symmetric edge between source and target in negative direction
Sourcepub fn add_neutral_edge(
&mut self,
source: &Position,
target: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_neutral_edge( &mut self, source: &Position, target: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add asymmetric edge from source to target in negative direction; in order to create symmetric edge, call this function twice with reversed input
Sourcepub fn add_neutral_edge_between(
&mut self,
position1: &Position,
position2: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_neutral_edge_between( &mut self, position1: &Position, position2: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add symmetric edge between source and target in negative direction
Sourcepub fn add_edge_between(
&mut self,
position1: &Position,
position2: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_edge_between( &mut self, position1: &Position, position2: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add symmetric edge between source and target; in order to create symmetric edge, call this function twice with reversed input
Sourcepub fn add_edge_no_residual_between(
&mut self,
position1: &Position,
position2: &Position,
probability: f64,
weight: f64,
error_pattern: Arc<SparseErrorPattern>,
correction: Arc<SparseCorrection>,
)
pub fn add_edge_no_residual_between( &mut self, position1: &Position, position2: &Position, probability: f64, weight: f64, error_pattern: Arc<SparseErrorPattern>, correction: Arc<SparseCorrection>, )
add edges but do not add to residual graph
Sourcepub fn elect_edges<F>(
&mut self,
simulator: &Simulator,
use_combined_probability: bool,
weight_of: F,
)
pub fn elect_edges<F>( &mut self, simulator: &Simulator, use_combined_probability: bool, weight_of: F, )
if there are multiple edges connecting two stabilizer measurements, elect the best one
Trait Implementations§
Source§impl Clone for TailoredModelGraph
impl Clone for TailoredModelGraph
Source§impl Debug for TailoredModelGraph
impl Debug for TailoredModelGraph
Source§impl QecpVisualizer for TailoredModelGraph
impl QecpVisualizer for TailoredModelGraph
Auto Trait Implementations§
impl Freeze for TailoredModelGraph
impl RefUnwindSafe for TailoredModelGraph
impl Send for TailoredModelGraph
impl Sync for TailoredModelGraph
impl Unpin for TailoredModelGraph
impl UnsafeUnpin for TailoredModelGraph
impl UnwindSafe for TailoredModelGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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