Phase angle (argument) of each element.
Computes the polar-coordinate angle of each complex element: , in radians on the interval . A real element is a complex number on the real axis: its angle is when it is negative and 0 otherwise, and NaN stays NaN.
Parameters
inputTensorComplex or real tensor. A bool or integer one is taken at the
default floating dtype.
Returns
TensorReal tensor with the same shape as input: float32 for
complex64, float64 for complex128, a real input's own
floating dtype.
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., 0.7854, 1.571, 3.142])
>>> lucid.angle(lucid.tensor([-2, 3]))
tensor([3.142, 0.])