pub struct DualModuleSerial {Show 13 fields
pub vertices: Vec<VertexPtr>,
pub nodes: Vec<Option<DualNodeInternalPtr>>,
pub nodes_length: usize,
pub edges: Vec<EdgePtr>,
pub active_timestamp: FastClearTimestamp,
pub vertex_num: VertexNum,
pub edge_num: usize,
pub owning_range: VertexRange,
pub unit_module_info: Option<UnitModuleInfo>,
pub active_list: Vec<DualNodeInternalWeak>,
pub edge_modifier: EdgeWeightModifier,
pub edge_dedup_timestamp: FastClearTimestamp,
pub sync_requests: Vec<SyncRequest>,
/* private fields */
}Fields§
§vertices: Vec<VertexPtr>all vertices including virtual ones
nodes: Vec<Option<DualNodeInternalPtr>>nodes internal information
nodes_length: usizecurrent nodes length, to enable constant-time clear operation
edges: Vec<EdgePtr>keep edges, which can also be accessed in Self::vertices
active_timestamp: FastClearTimestampcurrent timestamp
vertex_num: VertexNumthe number of all vertices (including those partitioned into other serial modules)
edge_num: usizethe number of all edges (including those partitioned into other serial modules)
owning_range: VertexRangevertices exclusively owned by this module, useful when partitioning the decoding graph into multiple DualModuleSerial
unit_module_info: Option<UnitModuleInfo>module information when used as a component in the partitioned dual module
active_list: Vec<DualNodeInternalWeak>maintain an active list to optimize for average cases: most defect vertices have already been matched, and we only need to work on a few remained; note that this list may contain deleted node as well as duplicate nodes
edge_modifier: EdgeWeightModifierremember the edges that’s modified by erasures
edge_dedup_timestamp: FastClearTimestampdeduplicate edges in the boundary, helpful when the decoding problem is partitioned
sync_requests: Vec<SyncRequest>temporary list of synchronize requests, i.e. those propagating into the mirrored vertices; should always be empty when not partitioned, i.e. serial version
Implementations§
Source§impl DualModuleSerial
impl DualModuleSerial
Sourcepub fn hard_clear_graph(&mut self)
pub fn hard_clear_graph(&mut self)
hard clear all growth (manual call not recommended due to performance drawback)
Sourcepub fn clear_graph(&mut self)
pub fn clear_graph(&mut self)
soft clear all growth
Sourcepub fn sanity_check(&self) -> Result<(), String>
pub fn sanity_check(&self) -> Result<(), String>
do a sanity check of if all the nodes are in consistent state
Source§impl DualModuleSerial
impl DualModuleSerial
Sourcepub fn get_dual_node_index(&self, dual_node_ptr: &DualNodePtr) -> Option<usize>
pub fn get_dual_node_index(&self, dual_node_ptr: &DualNodePtr) -> Option<usize>
get the local index of a dual node, thus has usize type
Sourcepub fn get_vertex_index(&self, vertex_index: VertexIndex) -> Option<usize>
pub fn get_vertex_index(&self, vertex_index: VertexIndex) -> Option<usize>
get the local index of a vertex, thus has usize type
pub fn get_dual_node_internal_ptr( &self, dual_node_ptr: &DualNodePtr, ) -> DualNodeInternalPtr
Sourcepub fn get_dual_node_internal_ptr_optional(
&self,
dual_node_ptr: &DualNodePtr,
) -> Option<DualNodeInternalPtr>
pub fn get_dual_node_internal_ptr_optional( &self, dual_node_ptr: &DualNodePtr, ) -> Option<DualNodeInternalPtr>
dual node ptr may not hold in this module
Sourcepub fn get_otherwise_add_dual_node(
&mut self,
dual_node_ptr: &DualNodePtr,
dual_variable: Weight,
) -> DualNodeInternalPtr
pub fn get_otherwise_add_dual_node( &mut self, dual_node_ptr: &DualNodePtr, dual_variable: Weight, ) -> DualNodeInternalPtr
possibly add dual node only when sync_event is provided
Sourcepub fn prepare_dual_node_growth_single(
&mut self,
dual_node_ptr: &DualNodePtr,
is_grow: bool,
) -> bool
pub fn prepare_dual_node_growth_single( &mut self, dual_node_ptr: &DualNodePtr, is_grow: bool, ) -> bool
this is equivalent to DualModuleSerial::prepare_dual_node_growth when there are no 0 weight edges, but when it encounters zero-weight edges, it will report true
Sourcepub fn prepare_dual_node_growth(
&mut self,
dual_node_ptr: &DualNodePtr,
is_grow: bool,
)
pub fn prepare_dual_node_growth( &mut self, dual_node_ptr: &DualNodePtr, is_grow: bool, )
adjust the boundary of each dual node to fit into the need of growing (length > 0) or shrinking (length < 0)
Trait Implementations§
Source§impl DualModuleImpl for DualModuleSerial
impl DualModuleImpl for DualModuleSerial
Source§fn new_empty(initializer: &SolverInitializer) -> Self
fn new_empty(initializer: &SolverInitializer) -> Self
initialize the dual module, which is supposed to be reused for multiple decoding tasks with the same structure
Source§fn add_dual_node(&mut self, dual_node_ptr: &DualNodePtr)
fn add_dual_node(&mut self, dual_node_ptr: &DualNodePtr)
add a new dual node from dual module root
Source§fn remove_blossom(&mut self, dual_node_ptr: DualNodePtr)
fn remove_blossom(&mut self, dual_node_ptr: DualNodePtr)
Source§fn set_grow_state(
&mut self,
dual_node_ptr: &DualNodePtr,
grow_state: DualNodeGrowState,
)
fn set_grow_state( &mut self, dual_node_ptr: &DualNodePtr, grow_state: DualNodeGrowState, )
Source§fn compute_maximum_update_length_dual_node(
&mut self,
dual_node_ptr: &DualNodePtr,
is_grow: bool,
simultaneous_update: bool,
) -> MaxUpdateLength
fn compute_maximum_update_length_dual_node( &mut self, dual_node_ptr: &DualNodePtr, is_grow: bool, simultaneous_update: bool, ) -> MaxUpdateLength
DualModuleImpl::compute_maximum_update_length
check the maximum length to grow (shrink) specific dual node, if length is 0, give the reason of why it cannot further grow (shrink).
if is_grow is false, return length <= 0, in any case |length| is maximized so that at least one edge becomes fully grown or fully not-grown.
if simultaneous_update is true, also check for the peer node according to DualNode::grow_state.Source§fn compute_maximum_update_length(&mut self) -> GroupMaxUpdateLength
fn compute_maximum_update_length(&mut self) -> GroupMaxUpdateLength
Source§fn grow_dual_node(&mut self, dual_node_ptr: &DualNodePtr, length: Weight)
fn grow_dual_node(&mut self, dual_node_ptr: &DualNodePtr, length: Weight)
Source§fn grow(&mut self, length: Weight)
fn grow(&mut self, length: Weight)
Source§fn load_edge_modifier(&mut self, edge_modifier: &[(EdgeIndex, Weight)])
fn load_edge_modifier(&mut self, edge_modifier: &[(EdgeIndex, Weight)])
Source§fn prepare_all(&mut self) -> &mut Vec<SyncRequest>
fn prepare_all(&mut self) -> &mut Vec<SyncRequest>
Source§fn prepare_nodes_shrink(
&mut self,
nodes_circle: &[DualNodePtr],
) -> &mut Vec<SyncRequest>
fn prepare_nodes_shrink( &mut self, nodes_circle: &[DualNodePtr], ) -> &mut Vec<SyncRequest>
Source§fn contains_dual_node(&self, dual_node_ptr: &DualNodePtr) -> bool
fn contains_dual_node(&self, dual_node_ptr: &DualNodePtr) -> bool
Source§fn new_partitioned(
partitioned_initializer: &PartitionedSolverInitializer,
) -> Self
fn new_partitioned( partitioned_initializer: &PartitionedSolverInitializer, ) -> Self
Source§fn contains_vertex(&self, vertex_index: VertexIndex) -> bool
fn contains_vertex(&self, vertex_index: VertexIndex) -> bool
Source§fn bias_dual_node_index(&mut self, bias: NodeIndex)
fn bias_dual_node_index(&mut self, bias: NodeIndex)
Source§fn execute_sync_event(&mut self, sync_event: &SyncRequest)
fn execute_sync_event(&mut self, sync_event: &SyncRequest)
Source§fn add_defect_node(&mut self, dual_node_ptr: &DualNodePtr)
fn add_defect_node(&mut self, dual_node_ptr: &DualNodePtr)
Source§fn add_blossom(&mut self, dual_node_ptr: &DualNodePtr)
fn add_blossom(&mut self, dual_node_ptr: &DualNodePtr)
Source§fn load_erasures(&mut self, erasures: &[EdgeIndex])
fn load_erasures(&mut self, erasures: &[EdgeIndex])
fn load_dynamic_weights(&mut self, dynamic_weights: &[(EdgeIndex, Weight)])
Source§fn generate_profiler_report(&self) -> Value
fn generate_profiler_report(&self) -> Value
Source§fn contains_dual_nodes_any(&self, dual_node_ptrs: &[DualNodePtr]) -> bool
fn contains_dual_nodes_any(&self, dual_node_ptrs: &[DualNodePtr]) -> bool
Source§impl FusionVisualizer for DualModuleSerial
impl FusionVisualizer for DualModuleSerial
Auto Trait Implementations§
impl Freeze for DualModuleSerial
impl !RefUnwindSafe for DualModuleSerial
impl Send for DualModuleSerial
impl Sync for DualModuleSerial
impl Unpin for DualModuleSerial
impl !UnwindSafe for DualModuleSerial
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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