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
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])