- class sdr.DiscreteMemorylessChannel(sdr.Channel)
Implements a discrete memoryless channel (DMC).
Notes
The inputs to the DMC are \(x_i \in \mathcal{X}\) and the outputs are \(y_i \in \mathcal{Y}\). The capacity of the DMC is
\[C = \max_{p(x)} I(X; Y) \ \ \text{bits/channel use} ,\]where \(I(X; Y)\) is the mutual information between the input \(X\) and output \(Y\) of the channel.
References
John Proakis, Digital Communications, Chapter 6.5-1: Channel Models.
Examples
Define the binary symmetric channel (BSC) with transition probability \(p=0.25\).
In [1]: p = 0.25 In [2]: dmc = sdr.DiscreteMemorylessChannel([[1 - p, p], [p, 1 - p]], seed=1) In [3]: dmc.P Out[3]: array([[0.75, 0.25], [0.25, 0.75]]) In [4]: x = np.random.randint(0, 2, 20); x Out[4]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) In [5]: y = dmc(x); y Out[5]: array([0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1]) In [6]: np.count_nonzero(x != y) Out[6]: 6
Define the binary erasure channel (BEC) with erasure probability \(p=0.25\).
In [7]: p = 0.25 In [8]: dmc = sdr.DiscreteMemorylessChannel([[1 - p, 0, p], [0, 1 - p, p]], Y=[0, 1, -1], seed=1) In [9]: x = np.random.randint(0, 2, 20); x Out[9]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) In [10]: y = dmc(x); y Out[10]: array([ 0, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, -1, 1, 0, 0, -1, 0, 0, 1]) In [11]: np.count_nonzero(x != y) Out[11]: 5
Constructors¶
- DiscreteMemorylessChannel(P: ArrayLike, ...)
Creates a new discrete memoryless channel (DMC).
Special methods¶
Methods¶
- static capacities() NDArray
Computes the channel capacity given the channel configuration.
Properties¶
- property X : NDArray[np.int_]
The input alphabet \(\mathcal{X}\) of the DMC channel.
- property Y : NDArray[np.int_]
The output alphabet \(\mathcal{Y}\) of the DMC channel.
- property P : NDArray[np.float64]
The transition probability matrix \(P\) of the DMC channel.