Contents
Sionna MIMO Processing (mimo/): Equalization, Detection, Precoding, and Stream Management
mimo/ deals with the “spatial dimension”: how to combine across multiple antennas, how to make decisions, and how to preprocess at the transmitter. The model is uniformly written as
where , , and .
1. Files and Responsibilities
| File | Function | Main Public Classes/Functions |
|---|---|---|
__init__.py | Entry point of the MIMO subpackage | Re-exports symbols from utils/equalization/detection/precoding/stream_management |
equalization.py | MIMO channel equalization | lmmse_matrix, lmmse_equalizer, zf_equalizer, mf_equalizer |
detection.py | MIMO channel detection | LinearDetector, MaximumLikelihoodDetector, KBestDetector, EPDetector, MMSEPICDetector |
precoding.py | MIMO transmit precoding | rzf_precoding_matrix, rzf_precoder, cbf_precoding_matrix, grid_of_beams_dft_ula, grid_of_beams_dft, flatten_precoding_mat, normalize_precoding_power |
stream_management.py | MIMO stream management | StreamManagement(Object): decides which transmitter sends which streams to which receiver, and exposes properties such as rx_tx_association and num_streams_per_tx |
utils.py | MIMO utility functions and layers | complex2real_vector/real2complex_vector, complex2real_matrix/real2complex_matrix, complex2real_covariance/real2complex_covariance, complex2real_channel/real2complex_channel, whiten_channel, List2LLR (abstract), List2LLRSimple |
The Three Equalizers
A linear equalizer essentially looks for a matrix such that . The three differ only in the choice of :
| Equalizer | Characteristics | |
|---|---|---|
| MF (matched filter) | Maximizes the per-stream SNR but ignores inter-stream interference | |
| ZF (zero forcing) | Eliminates interference completely, but severely amplifies noise at low SNR | |
| LMMSE | Trades off interference suppression against noise enhancement |
LMMSE is the most commonly used one. It also outputs no_eff (the effective noise variance) for the downstream demapper to compute LLRs:
Here is the noise (and interference) covariance. I previously wrote a separate note on per-RB estimation of and its low-rank structure (Interference Covariance Estimation in MMSE Equalization)—where this matrix comes from and why the noise floor must be topped up are covered there. Here I only want to stress one point: the validity of the inverse depends entirely on being positive definite, so in practice a small diagonal perturbation is always added.
The Five Detectors
| Detector | Output format | Typical use case |
|---|---|---|
LinearDetector | Bits/symbols | Equalize-then-demodulate, lowest complexity |
MaximumLikelihoodDetector | Bits/symbols | Exhausts the constellation; best performance but exponential complexity |
KBestDetector | Bits/symbols | Sphere-decoding-style approximation; k controls the number of retained candidates |
EPDetector | Bits | Expectation propagation; a good performance/complexity balance for massive MIMO |
MMSEPICDetector | Bits | Iterative detection with MMSE + parallel interference cancellation |
LinearDetector internally is just two stages, “equalize first, then demodulate”, so you can directly specify equalizer="lmmse" and demapping_method="app".
2. Usage Examples
MIMO equalization:
import torch
from sionna.phy.mimo import lmmse_equalizer, zf_equalizer, mf_equalizer
y = torch.complex(torch.randn(4), torch.randn(4))
h = torch.complex(torch.randn(4, 2), torch.randn(4, 2))
s = torch.eye(4, dtype=torch.complex64) # Noise covariance
x_hat, no_eff = lmmse_equalizer(y, h, s) # Can also switch to zf_equalizer / mf_equalizer
Detectors:
from sionna.phy.mimo import (LinearDetector, KBestDetector,
MaximumLikelihoodDetector, EPDetector)
detector = LinearDetector(equalizer="lmmse", output="bit",
demapping_method="app",
constellation_type="qam", num_bits_per_symbol=4)
llr = detector(y, h, s)
ml = MaximumLikelihoodDetector(output="bit", demapping_method="maxlog",
num_streams=2, constellation_type="qam",
num_bits_per_symbol=4)
kbest = KBestDetector(output="bit", num_streams=2, k=16,
constellation_type="qam", num_bits_per_symbol=4)
An Easy Pitfall
sionna.phy.mimo and sionna.phy.ofdm contain same-named detectors with completely different interfaces:
| Input | Constructor arguments | |
|---|---|---|
mimo version | (y, h, s) | Only the constellation and stream count |
ofdm version | (y, h_hat, err_var, no) | Also requires resource_grid and stream_management |
The extra err_var in the ofdm version is the channel-estimate error variance, and no is the noise power—because in an OFDM setting the channel is estimated, and the error must be passed to the detector explicitly (see the OFDM processing article).
Stream management:
import numpy as np
from sionna.phy.mimo import StreamManagement
num_tx, num_rx, num_streams_per_tx = 4, 1, 1
rx_tx_association = np.zeros([num_rx, num_tx])
rx_tx_association[0, :] = 1 # A single receiver receives streams from all 4 transmitters
sm = StreamManagement(rx_tx_association, num_streams_per_tx)
rx_tx_association is a [num_rx, num_tx] 0/1 matrix, where 1 means the receiver must demodulate that transmitter’s streams. The example above is uplink multi-user: one base station simultaneously receiving from 4 users. For multi-cell interference scenarios, set the columns of the interfering cells to 0—streams zeroed out do not enter detection; they show up as interference inside the noise covariance, which ties directly back to the discussed earlier.
Precoding:
import torch
from sionna.phy.mimo import rzf_precoder, grid_of_beams_dft
x = torch.complex(torch.randn(4), torch.randn(4))
h = torch.complex(torch.randn(4, 8), torch.randn(4, 8))
x_precoded = rzf_precoder(x, h, alpha=0.1) # [8]
gob = grid_of_beams_dft(num_ant_v=4, num_ant_h=8) # [4, 8, 32]
For rzf_precoder, the larger the regularization coefficient alpha, the closer it gets to matched filtering (more robust to channel errors); the smaller, the closer to zero forcing (more thorough interference suppression). grid_of_beams_dft generates the beam grid of a DFT codebook, commonly used for beam sweeping and fixed-codebook precoding.
Complex/real domain conversion and channel whitening:
import torch
from sionna.phy.mimo import complex2real_channel, whiten_channel
y = torch.complex(torch.randn(4), torch.randn(4))
h = torch.complex(torch.randn(4, 2), torch.randn(4, 2))
s = torch.eye(4, dtype=torch.complex64) * 0.5
yr, hr, sr = complex2real_channel(y, h, s) # Equivalent real-valued model
yw, hw, sw = whiten_channel(y, h, s) # Whitens colored noise
These two groups of functions are front-ends for the detectors: the real-domain conversion lets complex models use real-valued optimization algorithms (detectors such as EPDetector require real-valued inputs); whitening turns colored noise into standard white noise with . List2LLRSimple is the default implementation for converting candidate lists into LLRs and can be reused directly when writing a custom detector.
3. Summary
- The three functions in
equalization.pyare stateless and immediately usable—the easiest place to start; - The classes in
detection.pyare statefulBlocks that must bebuild, but they raise the performance ceiling step by step; stream_management.pydecides “which streams to decode and which to treat as interference” and is the key to configuring multi-user/multi-cell scenarios;- The complex/real conversion and whitening in
utils.pyare generic front-end processing you will constantly run into when reading detector source code.
Comments
Loading comments…
Want to leave a note? Sign in first — comments are open to every signed-in reader.