fn
polar
→Tensorpolar(abs: Tensor, angle: Tensor)Build a complex tensor from polar coordinates (magnitude, phase).
Constructs each complex output entry as
, where r
comes from abs and from angle. Both inputs are
real-valued and follow standard broadcasting rules.
Parameters
absTensorReal F32 tensor of magnitudes (non-negative values are typical
but not enforced — a negative magnitude simply rotates the phase
by ).
angleTensorReal F32 tensor of phase angles, in radians. Must broadcast with
abs.Returns
Tensorcomplex64 tensor whose shape is the broadcast shape of the two
inputs.
Notes
Mathematical definition:
Inverse of the pair lucid.abs / angle for complex
tensors: polar(abs(z), angle(z)) reconstructs z up to
floating-point round-off.
Examples
>>> import lucid
>>> import math
>>> r = lucid.tensor([1.0, 2.0])
>>> th = lucid.tensor([0.0, math.pi / 2])
>>> lucid.polar(r, th)
Tensor([1.+0.j, 0.+2.j])