Skip to main content

mi

Function mi 

Source
pub fn mi(
    kind: ConstellationKind,
    m: usize,
    snr_db: f64,
    px: Option<&[f64]>,
    points: usize,
) -> Result<f64>
Expand description

Mutual information (bits/symbol) of a constellation over AWGN, by Gauss–Hermite quadrature (OptiCommPy theoryMI).

snr_db is E_s/σ² with E_s the mean energy under px (uniform if None); a real constellation (PAM, OOK) sees a real channel, a complex one a circular complex channel, as in OptiCommPy. With D_ij(w) = (|x_i - x_j + w|² - |w|²)/N_0,

MI = -Σ_i p_i E_w log2 Σ_j p_j e^{-D_ij(w)},

evaluated with points nodes per dimension (40 give 6 digits for 64-QAM).

§Errors

Error::Config for an invalid constellation or probabilities.

§Examples

use comnum_mapping::{theory, constellation::ConstellationKind};
// the MI of 16-QAM approaches 4 bits at high SNR and stays below the capacity
let mi = theory::mi(ConstellationKind::Qam, 16, 10.0, None, 40).unwrap();
assert!(mi < (1.0 + 10.0f64).log2() && mi > 2.5);
let hi = theory::mi(ConstellationKind::Qam, 16, 30.0, None, 40).unwrap();
assert!((hi - 4.0).abs() < 1e-6);