komm.PAMConstellation
Pulse-amplitude modulation (PAM) constellation. It is a real one-dimensional constellation in which the symbols are uniformly arranged in the real line and centered about the origin. For more details, see SA15, Sec. 2.5.1.
Parameters:
-
order
(int
) –The order $M$ of the constellation.
-
delta
(float
) –The distance $\Delta$ between adjacent symbols. The default value is
2.0
.
Examples:
-
The $4$-PAM constellation with $\Delta = 2$ is depicted below.
>>> const = komm.PAMConstellation(4)
-
The $7$-PAM constellation with $\Delta = 5$ is depicted below.
>>> const = komm.PAMConstellation(7, delta=5)
matrix
Array2D[floating]
cached
property
The constellation matrix $\mathbf{X}$.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.matrix
array([[-3.],
[-1.],
[ 1.],
[ 3.]])
order
int
property
The order $M$ of the constellation.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.order
4
dimension
int
property
The dimension $N$ of the constellation.
For the PAM constellation, it is given by $N = 1$.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.dimension
1
mean()
Computes the mean $\mathbf{m}$ of the constellation given prior probabilities $p_i$ of the constellation symbols. It is given by $$ \mathbf{m} = \sum_{i \in [0:M)} p_i \mathbf{x}_i. $$
Parameters:
-
priors
(ArrayLike | None
) –The prior probabilities of the constellation symbols. Must be a 1D-array whose size is equal to the order $M$ of the constellation. If not given, uniform priors are assumed.
Returns:
-
mean
(Array1D[floating]
) –The mean $\mathbf{m}$ of the constellation.
For uniform priors, the mean of the PAM constellation is given by $$ \mathbf{m} = 0. $$
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.mean()
array([0.])
mean_energy()
Computes the mean energy $E$ of the constellation given prior probabilities $p_i$ of the constellation symbols. It is given by $$ E = \sum_{i \in [0:M)} p_i \lVert \mathbf{x}_i \rVert^2. $$
Parameters:
-
priors
(ArrayLike | None
) –The prior probabilities of the constellation symbols. Must be a 1D-array whose size is equal to the order $M$ of the constellation. If not given, uniform priors are assumed.
Returns:
-
mean_energy
(floating
) –The mean energy $E$ of the constellation.
For uniform priors, the mean energy of the PAM constellation is given by $$ E = \frac{\Delta^2}{12}(M^2 - 1). $$
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.mean_energy()
np.float64(5.0)
minimum_distance()
Computes the minimum Euclidean distance $d_\mathrm{min}$ of the constellation. It is given by $$ d_\mathrm{min} = \min_ { i, j \in [0:M), ~ i \neq j } \lVert \mathrm{x}_i - \mathrm{x}_j \rVert. $$
For the PAM constellation, the minimum distance is given by $$ d_{\min} = \Delta. $$
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.minimum_distance()
np.float64(2.0)
indices_to_symbols()
Returns the constellation symbols corresponding to the given indices.
Parameters:
-
indices
(ArrayLike
) –The indices to be converted to symbols. Must be an array of integers in $[0:M)$.
Returns:
-
symbols
(NDArray[floating]
) –The symbols corresponding to the given indices. Has the same shape as
indices
, but with the last dimension expanded by a factor of $N$.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.indices_to_symbols([3, 0])
array([ 3., -3.])
>>> const.indices_to_symbols([[3, 0], [1, 2]])
array([[ 3., -3.],
[-1., 1.]])
closest_indices()
Returns the indices of the constellation symbols closest to the given received points.
Parameters:
-
received
(ArrayLike
) –The received points. Must be an array whose last dimension is a multiple of $N$.
Returns:
-
indices
(NDArray[integer]
) –The indices of the symbols closest to the received points. Has the same shape as
received
, but with the last dimension contracted by a factor of $N$.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.closest_indices([-0.8, 2.4])
array([1, 3])
>>> const.closest_indices([[-0.8, 2.4], [0.0, 10.0]])
array([[1, 3],
[2, 3]])
closest_symbols()
Returns the constellation symbols closest to the given received points.
Parameters:
-
received
(ArrayLike
) –The received points. Must be an array whose last dimension is a multiple of $N$.
Returns:
-
symbols
(NDArray[floating]
) –The symbols closest to the received points. Has the same shape as
received
.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.closest_symbols([-0.8, 2.4])
array([-1., 3.])
>>> const.closest_symbols([[-0.8, 2.4], [0.0, 10.0]])
array([[-1., 3.],
[ 1., 3.]])
posteriors()
Returns the posterior probabilities of each constellation symbol given received points, the signal-to-noise ratio (SNR), and prior probabilities.
Parameters:
-
received
(ArrayLike
) –The received points. Must be an array whose last dimension is a multiple of $N$.
-
snr
(float
) –The signal-to-noise ratio (SNR) of the channel (linear, not decibel).
-
priors
(ArrayLike | None
) –The prior probabilities of the symbols. Must be a 1D-array whose size is equal to $M$. If not given, uniform priors are assumed.
Returns:
-
posteriors
(NDArray[floating]
) –The posterior probabilities of each symbol given the received points. Has the same shape as
received
, but with the last dimension changed by a factor of $M / N$.
Examples:
>>> const = komm.PAMConstellation(4)
>>> const.posteriors([-0.8, 2.4], snr=2.0).round(3)
array([0.103, 0.7 , 0.195, 0.002, 0. , 0.007, 0.343, 0.65 ])
>>> const.posteriors([[-0.8, 2.4], [0.0, 10.0]], snr=2.0).round(3)
array([[0.103, 0.7 , 0.195, 0.002, 0. , 0.007, 0.343, 0.65 ],
[0.02 , 0.48 , 0.48 , 0.02 , 0. , 0. , 0. , 1. ]])