pub type DualModuleInterfacePtr = ArcManualSafeLock<DualModuleInterface>;Aliased Type§
pub struct DualModuleInterfacePtr { /* private fields */ }Implementations§
Source§impl DualModuleInterfacePtr
impl DualModuleInterfacePtr
Sourcepub fn new_load(
syndrome_pattern: &SyndromePattern,
dual_module_impl: &mut impl DualModuleImpl,
) -> Self
pub fn new_load( syndrome_pattern: &SyndromePattern, dual_module_impl: &mut impl DualModuleImpl, ) -> Self
a dual module interface MUST be created given a concrete implementation of the dual module
pub fn load( &self, syndrome_pattern: &SyndromePattern, dual_module_impl: &mut impl DualModuleImpl, )
Sourcepub fn clear(&self)
pub fn clear(&self)
a constant clear function, without dropping anything; this is for consideration of reducing the garbage collection time in the parallel solver, by distributing the clear cost into each thread but not the single main thread.
Sourcepub fn flatten_nodes(&self, flattened_nodes: &mut Vec<Option<DualNodePtr>>)
pub fn flatten_nodes(&self, flattened_nodes: &mut Vec<Option<DualNodePtr>>)
DFS flatten the nodes
pub fn create_defect_node( &self, vertex_idx: VertexIndex, dual_module_impl: &mut impl DualModuleImpl, ) -> DualNodePtr
Sourcepub fn check_ptr_belonging(&self, dual_node_ptr: &DualNodePtr) -> bool
pub fn check_ptr_belonging(&self, dual_node_ptr: &DualNodePtr) -> bool
check whether a pointer belongs to this node, it will acquire a reader lock on dual_node_ptr
Sourcepub fn create_blossom(
&self,
nodes_circle: Vec<DualNodePtr>,
touching_children: Vec<(DualNodeWeak, DualNodeWeak)>,
dual_module_impl: &mut impl DualModuleImpl,
) -> DualNodePtr
pub fn create_blossom( &self, nodes_circle: Vec<DualNodePtr>, touching_children: Vec<(DualNodeWeak, DualNodeWeak)>, dual_module_impl: &mut impl DualModuleImpl, ) -> DualNodePtr
create a dual node corresponding to a blossom, automatically set the grow state of internal nodes; the nodes circle MUST starts with a growing node and ends with a shrinking node
Sourcepub fn expand_blossom(
&self,
blossom_node_ptr: DualNodePtr,
dual_module_impl: &mut impl DualModuleImpl,
)
pub fn expand_blossom( &self, blossom_node_ptr: DualNodePtr, dual_module_impl: &mut impl DualModuleImpl, )
expand a blossom: note that different from Blossom V library, we do not maintain tree structure after a blossom is expanded;
this is because we’re growing all trees together, and due to the natural of quantum codes, this operation is not likely to cause
bottleneck as long as physical error rate is well below the threshold. All internal nodes will have a DualNodeGrowState::Grow state afterwards.
Sourcepub fn set_grow_state(
&self,
dual_node_ptr: &DualNodePtr,
grow_state: DualNodeGrowState,
dual_module_impl: &mut impl DualModuleImpl,
)
pub fn set_grow_state( &self, dual_node_ptr: &DualNodePtr, grow_state: DualNodeGrowState, dual_module_impl: &mut impl DualModuleImpl, )
a helper function to update grow state
Sourcepub fn grow(&self, length: Weight, dual_module_impl: &mut impl DualModuleImpl)
pub fn grow(&self, length: Weight, dual_module_impl: &mut impl DualModuleImpl)
grow the dual module and update [DualModuleInterface::sum_]
Sourcepub fn notify_grown(&self, length: Weight)
pub fn notify_grown(&self, length: Weight)
if a dual module spontaneously grow some value (e.g. with primal offloading), this function should be called
Sourcepub fn grow_iterative(
&self,
length: Weight,
dual_module_impl: &mut impl DualModuleImpl,
)
pub fn grow_iterative( &self, length: Weight, dual_module_impl: &mut impl DualModuleImpl, )
grow a specific length globally but iteratively: will try to keep growing that much
Sourcepub fn slow_fuse(&self, left: &Self, right: &Self)
pub fn slow_fuse(&self, left: &Self, right: &Self)
fuse two interfaces by copying the nodes in other into myself
Sourcepub fn fuse(&self, left: &Self, right: &Self)
pub fn fuse(&self, left: &Self, right: &Self)
fuse two interfaces by (virtually) copying the nodes in other into myself, with O(1) time complexity
Sourcepub fn sanity_check(&self) -> Result<Vec<Option<DualNodePtr>>, String>
pub fn sanity_check(&self) -> Result<Vec<Option<DualNodePtr>>, String>
do a sanity check of if all the nodes are in consistent state