Skip to main content

TailoredModelGraph

Struct TailoredModelGraph 

Source
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

Source

pub fn new(simulator: &Simulator) -> Self

initialize the structure corresponding to a Simulator

Source

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

Source

pub fn is_node_exist(&self, position: &Position) -> bool

check if a position contains model graph node

Source

pub fn get_node_unwrap( &self, position: &Position, ) -> &TripleTailoredModelGraphNode

get reference self.nodes[t][i][j] and then unwrap

Source

pub fn get_node_mut_unwrap( &mut self, position: &Position, ) -> &mut TripleTailoredModelGraphNode

get mutable reference self.nodes[t][i][j] and unwrap

Source

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

Source

pub fn is_state_clean(&self, simulator: &Simulator) -> bool

Source

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.

Source

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, )
where F: Fn(f64) -> f64 + Copy,

build model graph given the simulator with customized weight function

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn elect_edges<F>( &mut self, simulator: &Simulator, use_combined_probability: bool, weight_of: F, )
where F: Fn(f64) -> f64 + Copy,

if there are multiple edges connecting two stabilizer measurements, elect the best one

Source

pub fn to_json(&self, simulator: &Simulator) -> Value

create json object for debugging and viewing

Trait Implementations§

Source§

impl Clone for TailoredModelGraph

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TailoredModelGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl QecpVisualizer for TailoredModelGraph

Source§

fn component_info(&self, abbrev: bool) -> (String, Value)

Source§

impl Serialize for TailoredModelGraph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more