fn
angle
→Tensorangle(input: Tensor)Phase angle (argument) of a complex tensor.
Computes the polar-coordinate angle of each complex element: . The output is a real F32 tensor in radians on the interval .
Parameters
inputTensorComplex-valued tensor (dtype must be
complex64).Returns
TensorReal F32 tensor with the same shape as input; each element
contains the phase of the corresponding complex entry.
Notes
Mathematical definition:
Uses quadrant-correct lucid.atan2 internally — unlike a naive
arctan(imag / real), this returns the proper four-quadrant angle.
Zero complex inputs yield 0.0 (not NaN).
Examples
>>> import lucid
>>> z = lucid.tensor([1+0j, 1+1j, 0+1j, -1+0j])
>>> lucid.angle(z)
Tensor([0.0000, 0.7854, 1.5708, 3.1416])