pub enum DynDecoder<'a, T: Topology> {
S1(DecodingState<'a, T, 1>),
S2(DecodingState<'a, T, 2>),
S4(DecodingState<'a, T, 4>),
S8(DecodingState<'a, T, 8>),
S16(DecodingState<'a, T, 16>),
S32(DecodingState<'a, T, 32>),
S64(DecodingState<'a, T, 64>),
S128(DecodingState<'a, T, 128>),
S256(DecodingState<'a, T, 256>),
S512(DecodingState<'a, T, 512>),
}Expand description
Dynamic decoder wrapper that hides the STRIDE_Y const generic.
This enum provides a unified interface regardless of the underlying stride, at the cost of a small dispatch overhead per method call.
§Performance Note
For maximum performance in tight loops, prefer using DecodingState
directly with the correct const generic. The dynamic dispatch overhead
is typically negligible for most use cases.
§Example
let mut decoder = DecoderBuilder::<SquareGrid>::new()
.dimensions(32, 32)
.build(&mut arena)?;
// Use unified interface regardless of stride
decoder.load_dense_syndromes(&syndromes);
decoder.grow_clusters();
let count = decoder.peel_forest(&mut corrections);
decoder.reset_for_next_cycle();Variants§
S1(DecodingState<'a, T, 1>)
Stride 1 (1x1 grids).
S2(DecodingState<'a, T, 2>)
Stride 2 (up to 2x2 grids).
S4(DecodingState<'a, T, 4>)
Stride 4 (up to 4x4 grids).
S8(DecodingState<'a, T, 8>)
Stride 8 (up to 8x8 grids).
S16(DecodingState<'a, T, 16>)
Stride 16 (up to 16x16 grids).
S32(DecodingState<'a, T, 32>)
Stride 32 (up to 32x32 grids).
S64(DecodingState<'a, T, 64>)
Stride 64 (up to 64x64 grids).
S128(DecodingState<'a, T, 128>)
Stride 128 (up to 128x128 grids).
S256(DecodingState<'a, T, 256>)
Stride 256 (up to 256x256 grids).
S512(DecodingState<'a, T, 512>)
Stride 512 (up to 512x512 grids).
Implementations§
Source§impl<'a, T: Topology> DynDecoder<'a, T>
impl<'a, T: Topology> DynDecoder<'a, T>
Sourcepub fn load_dense_syndromes(&mut self, syndromes: &[u64])
pub fn load_dense_syndromes(&mut self, syndromes: &[u64])
Loads syndrome measurements from a dense bitarray.
Each u64 in the slice represents 64 consecutive nodes, where bit i
being set indicates a syndrome at node (block_index * 64 + i).
§Arguments
syndromes- Dense syndrome bitarray with oneu64per 64-node block.
Sourcepub fn grow_clusters(&mut self)
pub fn grow_clusters(&mut self)
Performs full cluster growth until convergence.
This iteratively expands syndrome clusters until all defects are paired or reach boundaries.
Sourcepub fn grow_iteration(&mut self) -> bool
pub fn grow_iteration(&mut self) -> bool
Performs a single growth iteration.
Returns true if more iterations are needed, false if converged.
Sourcepub fn peel_forest(&mut self, corrections: &mut [EdgeCorrection]) -> usize
pub fn peel_forest(&mut self, corrections: &mut [EdgeCorrection]) -> usize
Sourcepub fn decode(&mut self, corrections: &mut [EdgeCorrection]) -> usize
pub fn decode(&mut self, corrections: &mut [EdgeCorrection]) -> usize
Performs full decode cycle (grow + peel).
This is equivalent to calling grow_clusters
followed by peel_forest.
§Arguments
corrections- Output buffer for edge corrections.
§Returns
The number of corrections written to the buffer.
Sourcepub fn reset_for_next_cycle(&mut self)
pub fn reset_for_next_cycle(&mut self)
Resets state for the next decoding cycle (sparse reset).
This efficiently resets only the blocks that were modified during the previous decoding cycle.
Sourcepub fn full_reset(&mut self)
pub fn full_reset(&mut self)
Fully resets all decoder state.
This performs a complete reset of all internal data structures.
For repeated decoding, prefer reset_for_next_cycle.