complex_normal#

sionna.phy.utils.complex_normal(shape: Sequence[int], var: float = 1.0, *, precision: Literal['single', 'double'] | None = None, device: str | torch.device | None = None, generator: torch._C.Generator | None = None) → torch.Tensor[source]#

Generate a complex normal random tensor, compile-aware.

Generates circularly symmetric complex Gaussian random variables with total variance var (i.e., variance var/2 per real and imaginary component).

In eager mode, uses the provided generator for reproducibility. In compiled mode, uses global RNG state for graph fusion.

Parameters:
  • shape (Sequence[int]) – Shape of the output tensor.

  • var (float) – Total variance, finite and non-negative. Defaults to 1.0.

  • precision (Literal['single', 'double'] | None) – Precision used for the output tensor. If set to None, precision is used.

  • device (str | torch.device | None) – Device for the output tensor. If None, device is used.

  • generator (torch._C.Generator | None) – Random number generator. If None, torch_rng() for the output device is used. Ignored in compiled mode, which uses the global RNG.

Outputs:

samples – Complex tensor with complex normal values.

Examples

from sionna.phy.utils import complex_normal

x = complex_normal([2, 3], var=2.0)
print(x.shape)
# torch.Size([2, 3])