BP+LSD Decoder
- class ldpc.bplsd_decoder.BpLsdDecoder
Bases:
BpDecoderBaseA class representing a decoder that combines Belief Propagation (BP) with the Localised Statistics Decoder (LSD) algorithm.
The BpLsdDecoder is designed to decode binary linear codes by initially attempting BP decoding, and if that fails, it falls back to the Localised Statistics Decoder algorithm.
- Parameters:
pcm (Union[np.ndarray, scipy.sparse.spmatrix]) – The parity check matrix for the code.
error_rate (Optional[float], optional) – The probability of a bit being flipped in the received codeword, by default None.
error_channel (Optional[List[float]], optional) – A list of probabilities specifying the probability of each bit being flipped in the received codeword. Must be of length equal to the block length of the code, by default None.
max_iter (Optional[int], optional) – The maximum number of iterations for the decoding algorithm, by default 0.
bp_method (Optional[str], optional) – The belief propagation method used. Must be one of {‘product_sum’, ‘minimum_sum’}, by default ‘minimum_sum’.
ms_scaling_factor (Optional[float], optional) – The scaling factor used in the minimum sum method, by default 1.0.
schedule (Optional[str], optional) – The scheduling method used. Must be one of {‘parallel’, ‘serial’}, by default ‘parallel’.
omp_thread_count (Optional[int], optional, NotImplemented) – The number of OpenMP threads used for parallel decoding, by default 1.
random_schedule_seed (Optional[int], optional) – Whether to use a random serial schedule order, by default 0.
serial_schedule_order (Optional[List[int]], optional) – A list of integers specifying the serial schedule order. Must be of length equal to the block length of the code, by default None.
bits_per_step (int, optional) – Specifies the number of bits added to the cluster in each step of the LSD algorithm. If no value is provided, this is set the block length of the code.
lsd_order (int, optional) – The order of the LSD algorithm applied to each cluster. Must be greater than or equal to 0, by default 0.
lsd_method (str, optional) – The LSD method of the LSD algorithm applied to each cluster. Must be one of {‘LSD_0’, ‘LSD_E’, ‘LSD_CS’}. By default ‘LSD_0’.
Notes
The BpLsdDecoder class leverages soft information outputted by the BP decoder to guide the cluster growth in the LSD algorithm. The number of bits added to the cluster in each step is controlled by the bits_per_step parameter.
- bit_count
int
Returns the number of columns of the parity check matrix.
- Returns:
The number of columns of the parity check matrix.
- Return type:
int
- Type:
BpDecoderBase.bit_count
- bp_method
str
Returns the belief propagation method used.
- Returns:
The belief propagation method used. Possible values are ‘product_sum’ or ‘minimum_sum’.
- Return type:
str
- Type:
BpDecoderBase.bp_method
- channel_probs
np.ndarray
- Type:
BpDecoderBase.channel_probs
- check_count
int
Returns the number of rows of the parity check matrix.
- Returns:
The number of rows of the parity check matrix.
- Return type:
int
- Type:
BpDecoderBase.check_count
- converge
bool
Returns whether the decoder has converged or not.
- Returns:
True if the decoder has converged, False otherwise.
- Return type:
bool
- Type:
BpDecoderBase.converge
- decode(self, syndrome)
Decodes the input syndrome using the belief propagation and LSD decoding methods.
Initially, the method attempts to decode the syndrome using belief propagation. If this fails to converge, it falls back to the LSD algorithm.
- Parameters:
syndrome (np.ndarray) – The input syndrome to decode.
- Returns:
The decoded output.
- Return type:
np.ndarray
- Raises:
ValueError – If the length of the input syndrome is not equal to the length of the code.
- do_stats
bool
Returns whether the statistics are being collected.
- Returns:
Whether the statistics are being collected.
- Return type:
bool
- Type:
BpLsdDecoder.do_stats
- error_channel
np.ndarray
Returns the current error channel vector.
- Returns:
A numpy array containing the current error channel vector.
- Return type:
np.ndarray
- Type:
BpDecoderBase.error_channel
- error_rate
np.ndarray
Returns the current error rate vector.
- Returns:
A numpy array containing the current error rate vector.
- Return type:
np.ndarray
- Type:
BpDecoderBase.error_rate
- input_vector_type
str
Returns the current input vector type.
- Returns:
The current input vector type.
- Return type:
str
- Type:
BpDecoderBase.input_vector_type
- iter
int
Returns the number of iterations performed by the decoder.
- Returns:
The number of iterations performed by the decoder.
- Return type:
int
- Type:
BpDecoderBase.iter
- log_prob_ratios
np.ndarray
Returns the current log probability ratio vector.
- Returns:
A numpy array containing the current log probability ratio vector.
- Return type:
np.ndarray
- Type:
BpDecoderBase.log_prob_ratios
- lsd_method
Optional[str]
The Localized Statistic Decoding (LSD) method used.
- Returns:
A string representing the LSD method used. Must be one of {‘LSD_0’, ‘LSD_E’, ‘LSD_CS’}. If no LSD method has been set, returns None.
- Return type:
Optional[str]
- Type:
BpLsdDecoder.lsd_method
- lsd_order
int
The LSD order used.
- Returns:
An integer representing the OSD order used.
- Return type:
int
- Type:
BpLsdDecoder.lsd_order
- max_iter
int
Returns the maximum number of iterations allowed by the decoder.
- Returns:
The maximum number of iterations allowed by the decoder.
- Return type:
int
- Type:
BpDecoderBase.max_iter
- ms_scaling_factor
float Get the scaling factor for minimum sum method.
- Returns:
float: The current scaling factor.
- Type:
BpDecoderBase.ms_scaling_factor
- omp_thread_count
int Get the number of OpenMP threads.
- Returns:
int: The number of threads used.
- Type:
BpDecoderBase.omp_thread_count
- random_schedule_seed
int Get the value of random_schedule_seed.
- Returns:
int: The current value of random_schedule_seed.
- Type:
BpDecoderBase.random_schedule_seed
- reset_cluster_stats(self) None
Resets cluster statistics of the decoder. Note that this also resets the additional stat fields, such as the error, and compare_recovery vectors
- schedule
str
Returns the scheduling method used.
- Returns:
The scheduling method used. Possible values are ‘parallel’ or ‘serial’.
- Return type:
str
- Type:
BpDecoderBase.schedule
- serial_schedule_order
Union[None, np.ndarray]
Returns the serial schedule order.
- Returns:
The serial schedule order as a numpy array, or None if no schedule has been set.
- Return type:
Union[None, np.ndarray]
- Type:
BpDecoderBase.serial_schedule_order
- set_additional_stat_fields(self, error, syndrome, compare_recover) None
Sets additional fields to be collected in the statistics.
- Parameters:
fields (List[str]) – A list of strings representing the additional fields to be collected in the statistics.
- set_do_stats(self, bool value: bool) None
Sets whether the statistics are being collected.
- Parameters:
value (bool) – Whether the statistics are being collected.
- statistics
Statistics
Returns the statistics for the LSD algorithm. May be None if the statistics are not being collected. ——- Statistics
The statistics object.
- Type:
BpLsdDecoder.statistics
- update_channel_probs(self, value: List[float] | np.ndarray) None