qkd_key_rate.base.parity_strategy module
Base class for ParityStrategy object.
- class qkd_key_rate.base.parity_strategy.ParityStrategy(error_rate, sampling_fraction=0.5, number_of_passes=10, switch_after_pass=None)[source]
Bases:
object
Parity strategy to be used in the Cascade protocol.
In the Cascade protocol, for efficiency reasons, we may change the strategy of our blocks after some passes. This class deals with the parity strategy
- __init__(error_rate, sampling_fraction=0.5, number_of_passes=10, switch_after_pass=None)[source]
- Parameters:
error_rate (
float
) – An estimate of the error rate in the messagesampling_fraction (
float
) – Fraction of the string that is sampled after switching strategiesnumber_of_passes (
int
) – Total number of Cascade iterationsswitch_after_pass (
Optional
[int
]) – After which pass we switch the strategy
- calculate_message_parity_strategy(message_size)[source]
Sets the parity strategy
Initial strategy is to double the block size in each subsequent pass. After some number of passes, we may change the strategy by randomly sampling bits from the message in new blocks.
- Parameters:
message_size (
int
) – Size of the message for which to calculate the parity strategy- Returns:
The block size and number of blocks for each pass
- Return type:
size_blocks_parities