RZFPrecoder#
- class sionna.phy.ofdm.RZFPrecoder(resource_grid: sionna.phy.ofdm.resource_grid.ResourceGrid, stream_management: sionna.phy.mimo.stream_management.StreamManagement, return_effective_channel: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#
Bases:
sionna.phy.block.BlockRegularized zero-forcing (RZF) precoding for multi-antenna transmissions.
This block precodes a tensor containing OFDM resource grids using the
rzf_precoder(). For every transmitter, the channels to all intended receivers are gathered into a channel matrix, based on which the precoding matrix is computed and the input tensor is precoded. The block also outputs optionally the effective channel after precoding for each stream.- Parameters:
resource_grid (sionna.phy.ofdm.ResourceGrid) – ResourceGrid to be used
stream_management (sionna.phy.mimo.StreamManagement) – StreamManagement to be used
return_effective_channel (bool) – Indicates if the effective channel after precoding should be returned. Defaults to False.
precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None,
precisionis used.device (str | None) – Device for computation. If None,
deviceis used.
- Inputs:
x – [batch_size, num_tx, num_streams_per_tx, num_ofdm_symbols, fft_size], torch.complex. Resource grids to be precoded.
h – [batch_size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_ofdm_symbols, fft_size], torch.complex. Channel knowledge based on which the precoding is computed.
alpha – 0. (default) | [batch_size, num_tx, num_ofdm_symbols, fft_size] (or broadcastable), float. Regularization parameter for RZF precoding. If set to 0, RZF is equivalent to ZF precoding.
- Outputs:
x_precoded – [batch_size, num_tx, num_tx_ant, num_ofdm_symbols, fft_size], torch.complex. Precoded resource grids.
h_eff – [batch_size, num_rx, num_rx_ant, num_tx, num_streams_per_tx, num_ofdm_symbols, num_effective_subcarriers], torch.complex. Only returned if
return_effective_channel=True. The effective channels for all streams after precoding. Can be used to simulate perfect channel state information (CSI) at the receivers. Nulled subcarriers are automatically removed to be compliant with the behavior of a channel estimator.
Examples
import numpy as np import torch from sionna.phy.ofdm import ResourceGrid, RZFPrecoder from sionna.phy.mimo import StreamManagement # Setup: 2 transmitters, 4 receivers (2 per TX), 2 streams per RX num_tx = 2 num_rx_per_tx = 2 num_rx = num_tx * num_rx_per_tx num_streams_per_rx = 2 num_streams_per_tx = num_rx_per_tx * num_streams_per_rx rx_tx_association = np.zeros((num_rx, num_tx), dtype=np.int32) for j in range(num_tx): rx_tx_association[j*num_rx_per_tx:(j+1)*num_rx_per_tx, j] = 1 sm = StreamManagement(rx_tx_association, num_streams_per_tx) rg = ResourceGrid(num_ofdm_symbols=14, fft_size=64, subcarrier_spacing=15e3, num_tx=num_tx, num_streams_per_tx=num_streams_per_tx) precoder = RZFPrecoder(rg, sm) # Create inputs batch_size = 16 x = torch.randn(batch_size, num_tx, num_streams_per_tx, 14, 64, dtype=torch.complex64) h = torch.randn(batch_size, num_rx, num_streams_per_rx, num_tx, num_streams_per_tx * 2, 14, 64, dtype=torch.complex64) x_precoded = precoder(x, h, alpha=0.1) print(x_precoded.shape) # torch.Size([16, 2, 8, 14, 64])