Skip to content

komm.BinarySymmetricChannel

Binary symmetric channel (BSC). It is a discrete memoryless channel with input and output alphabets given by $\mathcal{X} = \mathcal{Y} = \{ 0, 1 \}$, and transition probability matrix given by $$ p_{Y \mid X} = \begin{bmatrix} 1-p & p \\ p & 1-p \end{bmatrix}, $$ where the parameter $p$ is called the crossover probability of the channel. Equivalently, a BSC with crossover probability $p$ may be defined by $$ Y_n = X_n + Z_n, $$ where $Z_n$ are iid Bernoulli random variables with $\Pr[Z_n = 1] = p$. For more details, see CT06, Sec. 7.1.4.

To invoke the channel, call the object giving the input signal as parameter (see example below).

__init__()

Constructor for the class.

Parameters:

  • crossover_probability (Optional[float])

    The channel crossover probability $p$. Must satisfy $0 \leq p \leq 1$. The default value is 0.0, which corresponds to a noiseless channel.

Examples:

>>> np.random.seed(1)
>>> bsc = komm.BinarySymmetricChannel(0.1)
>>> x = [0, 1, 1, 1, 0, 0, 0, 0, 0, 1]
>>> y = bsc(x); y
array([0, 1, 0, 1, 0, 1, 0, 0, 0, 1])

crossover_probability property writable

The crossover probability $p$ of the channel.

capacity()

Returns the channel capacity $C$. It is given by $C = 1 - \mathcal{H}(p)$. See CT06, Sec. 7.1.4.

Examples:

>>> bsc = komm.BinarySymmetricChannel(0.25)
>>> bsc.capacity()
0.18872187554086717