DualModuleSerial

Struct DualModuleSerial 

Source
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: usize

current nodes length, to enable constant-time clear operation

§edges: Vec<EdgePtr>

keep edges, which can also be accessed in Self::vertices

§active_timestamp: FastClearTimestamp

current timestamp

§vertex_num: VertexNum

the number of all vertices (including those partitioned into other serial modules)

§edge_num: usize

the number of all edges (including those partitioned into other serial modules)

§owning_range: VertexRange

vertices 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: EdgeWeightModifier

remember the edges that’s modified by erasures

§edge_dedup_timestamp: FastClearTimestamp

deduplicate 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

Source

pub fn hard_clear_graph(&mut self)

hard clear all growth (manual call not recommended due to performance drawback)

Source

pub fn clear_graph(&mut self)

soft clear all growth

Source

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

do a sanity check of if all the nodes are in consistent state

Source§

impl DualModuleSerial

Source

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

Source

pub fn get_vertex_index(&self, vertex_index: VertexIndex) -> Option<usize>

get the local index of a vertex, thus has usize type

Source

pub fn get_dual_node_internal_ptr( &self, dual_node_ptr: &DualNodePtr, ) -> DualNodeInternalPtr

Source

pub fn get_dual_node_internal_ptr_optional( &self, dual_node_ptr: &DualNodePtr, ) -> Option<DualNodeInternalPtr>

dual node ptr may not hold in this module

Source

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

Source

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

Source

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

Source§

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 clear(&mut self)

clear all growth and existing dual nodes

Source§

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)

remove a blossom, note that this dual node ptr is already expanded from the root: normally you only need to remove this blossom; when force flag is set, remove blossom even if its dual variable is not 0: this action cannot be undone
Source§

fn set_grow_state( &mut self, dual_node_ptr: &DualNodePtr, grow_state: DualNodeGrowState, )

update grow state
Source§

fn compute_maximum_update_length_dual_node( &mut self, dual_node_ptr: &DualNodePtr, is_grow: bool, simultaneous_update: bool, ) -> MaxUpdateLength

An optional function that helps to break down the implementation of 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

check the maximum length to grow (shrink) for all nodes, return a list of conflicting reason and a single number indicating the maximum length to grow: this number will be 0 if any conflicting reason presents
Source§

fn grow_dual_node(&mut self, dual_node_ptr: &DualNodePtr, length: Weight)

An optional function that can manipulate individual dual node, not necessarily supported by all implementations
Source§

fn grow(&mut self, length: Weight)

grow a specific length globally, length must be positive. note that reversing the process is possible, but not recommended: to do that, reverse the state of each dual node, Grow->Shrink, Shrink->Grow
Source§

fn load_edge_modifier(&mut self, edge_modifier: &[(EdgeIndex, Weight)])

optional support for edge modifier. for example, erasure errors temporarily set some edges to 0 weight. When it clears, those edges must be reverted back to the original weight
Source§

fn prepare_all(&mut self) -> &mut Vec<SyncRequest>

prepare the growing or shrinking state of all nodes and return a list of sync requests in case of mirrored vertices are changed
Source§

fn prepare_nodes_shrink( &mut self, nodes_circle: &[DualNodePtr], ) -> &mut Vec<SyncRequest>

prepare a list of nodes as shrinking state; useful in creating a blossom
Source§

fn contains_dual_node(&self, dual_node_ptr: &DualNodePtr) -> bool

judge whether the current module hosts the dual node
Source§

fn new_partitioned( partitioned_initializer: &PartitionedSolverInitializer, ) -> Self

create a partitioned dual module (hosting only a subgraph and subset of dual nodes) to be used in the parallel dual module
Source§

fn contains_vertex(&self, vertex_index: VertexIndex) -> bool

judge whether the current module hosts a vertex
Source§

fn bias_dual_node_index(&mut self, bias: NodeIndex)

bias the global dual node indices
Source§

fn execute_sync_event(&mut self, sync_event: &SyncRequest)

execute a synchronize event by updating the state of a vertex and also update the internal dual node accordingly
Source§

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

helper function to specifically add a syndrome node
Source§

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

helper function to specifically add a blossom node
Source§

fn load_erasures(&mut self, erasures: &[EdgeIndex])

an erasure error means this edge is totally uncertain: p=0.5, so new weight = ln((1-p)/p) = 0
Source§

fn load_dynamic_weights(&mut self, dynamic_weights: &[(EdgeIndex, Weight)])

Source§

fn generate_profiler_report(&self) -> Value

performance profiler report
Source§

fn contains_dual_nodes_any(&self, dual_node_ptrs: &[DualNodePtr]) -> bool

judge whether the current module hosts any of these dual node
Source§

impl FusionVisualizer for DualModuleSerial

Source§

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

take a snapshot, set abbrev to true to save space

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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
§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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