PrimalModuleSerialPtr

Type Alias PrimalModuleSerialPtr 

Source
pub type PrimalModuleSerialPtr = ArcManualSafeLock<PrimalModuleSerial>;

Aliased Type§

pub struct PrimalModuleSerialPtr { /* private fields */ }

Implementations§

Source§

impl PrimalModuleSerialPtr

Source

pub fn get_primal_node_internal_ptr_option( &self, dual_node_ptr: &DualNodePtr, ) -> Option<PrimalNodeInternalPtr>

Source

pub fn get_primal_node_internal_ptr( &self, dual_node_ptr: &DualNodePtr, ) -> PrimalNodeInternalPtr

Source

pub fn get_outer_node( &self, primal_node_internal_ptr: PrimalNodeInternalPtr, ) -> PrimalNodeInternalPtr

get the outer node in the most up-to-date cache

Source

pub fn find_lowest_common_ancestor( &self, primal_node_internal_ptr_1: PrimalNodeInternalPtr, primal_node_internal_ptr_2: PrimalNodeInternalPtr, ) -> (PrimalNodeInternalPtr, Vec<PrimalNodeInternalPtr>, Vec<PrimalNodeInternalPtr>)

find the lowest common ancestor (LCA) of two nodes in the alternating tree, return (LCA, path_1, path_2) where path includes leaf but exclude the LCA

Source

pub fn match_subtree<D: DualModuleImpl>( tree_node_internal_ptr: PrimalNodeInternalPtr, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )

for any - node, match the children by matching them with + node

Source

pub fn augment_tree_given_matched<D: DualModuleImpl>( tree_node_internal_ptr: PrimalNodeInternalPtr, match_node_internal_ptr: PrimalNodeInternalPtr, tree_touching_ptr: DualNodeWeak, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )

for any + node, match it with another node will augment the whole tree, breaking out into several matched pairs; tree_grandson_ptr is the grandson of tree_node_internal_ptr that touches match_node_internal_ptr

Source

pub fn augment_tree_given_virtual_vertex<D: DualModuleImpl>( &self, tree_node_internal_ptr: PrimalNodeInternalPtr, virtual_vertex_index: VertexIndex, tree_touching_ptr: DualNodeWeak, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )

for any + node, match it with virtual boundary will augment the whole tree, breaking out into several matched pairs

Source

pub fn flatten_nodes( &self, flattened_nodes: &mut Vec<Option<PrimalNodeInternalPtr>>, )

DFS flatten the nodes

Source

pub fn slow_fuse(&self, left: &Self, right: &Self)

fuse two modules by copying the nodes in other into myself

Source

pub fn fuse(&self, left: &Self, right: &Self)

fuse two modules by (virtually) copying the nodes in other into myself, with O(1) time complexity

Source

pub fn sanity_check(&self) -> Result<Vec<Option<PrimalNodeInternalPtr>>, String>

do a sanity check of it’s tree structure and internal state

Source

pub fn collapse_tree<D: DualModuleImpl>( &self, primal_node_internal_ptr: PrimalNodeInternalPtr, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )

collapse a tree into a single blossom, just like what union-find decoder does. No MWPM guarantee once this is called.

Trait Implementations§

Source§

impl Debug for PrimalModuleSerialPtr

Source§

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

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

impl FusionVisualizer for PrimalModuleSerialPtr

Source§

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

take a snapshot, set abbrev to true to save space
Source§

impl PrimalModuleImpl for PrimalModuleSerialPtr

Source§

fn new_empty(_initializer: &SolverInitializer) -> Self

create a primal module given the dual module
Source§

fn clear(&mut self)

clear all states; however this method is not necessarily called when load a new decoding problem, so you need to call it yourself
Source§

fn load_defect_dual_node(&mut self, dual_node_ptr: &DualNodePtr)

Source§

fn resolve<D: DualModuleImpl>( &mut self, group_max_update_length: GroupMaxUpdateLength, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )

analyze the reason why dual module cannot further grow, update primal data structure (alternating tree, temporary matches, etc) and then tell dual module what to do to resolve these conflicts; note that this function doesn’t necessarily resolve all the conflicts, but can return early if some major change is made. when implementing this function, it’s recommended that you resolve as many conflicts as possible.
Source§

fn intermediate_matching<D: DualModuleImpl>( &mut self, _interface: &DualModuleInterfacePtr, _dual_module: &mut D, ) -> IntermediateMatching

return a matching that can possibly include blossom nodes: this does not affect dual module
Source§

fn load_defect<D: DualModuleImpl>( &mut self, defect_vertex: VertexIndex, interface_ptr: &DualModuleInterfacePtr, dual_module: &mut D, )

load a single syndrome and update the dual module and the interface
Source§

fn load(&mut self, interface_ptr: &DualModuleInterfacePtr)

load a new decoding problem given dual interface: note that all nodes MUST be syndrome node
Source§

fn perfect_matching<D: DualModuleImpl>( &mut self, interface: &DualModuleInterfacePtr, dual_module: &mut D, ) -> PerfectMatching

break down the blossoms to find the final matching; this function will take more time on the dual module
Source§

fn solve<D: DualModuleImpl>( &mut self, interface: &DualModuleInterfacePtr, syndrome_pattern: &SyndromePattern, dual_module: &mut D, )

Source§

fn solve_visualizer<D: DualModuleImpl + FusionVisualizer>( &mut self, interface: &DualModuleInterfacePtr, syndrome_pattern: &SyndromePattern, dual_module: &mut D, visualizer: Option<&mut Visualizer>, )
where Self: FusionVisualizer + Sized,

Source§

fn solve_step_callback<D: DualModuleImpl, F>( &mut self, interface: &DualModuleInterfacePtr, syndrome_pattern: &SyndromePattern, dual_module: &mut D, callback: F, )

Source§

fn solve_step_callback_interface_loaded<D: DualModuleImpl, F>( &mut self, interface: &DualModuleInterfacePtr, dual_module: &mut D, callback: F, )

Source§

fn generate_profiler_report(&self) -> Value

performance profiler report