array-api
array-api copied to clipboard
RFC: add `angle` for computing the argument of a complex number
This RFC requests to include a new API in the array API specification for the purpose of computing the argument of a complex number.
Overview
Based on array comparison data, the API is available in the majority of libraries in the PyData ecosystem.
The Array API specification does not currently include an API for computing the argument of a complex number.
Prior art
- NumPy: https://numpy.org/doc/stable/reference/generated/numpy.angle.html
- PyTorch: https://pytorch.org/docs/stable/generated/torch.angle.html
- TensorFlow: https://www.tensorflow.org/api_docs/python/tf/math/angle
- C99: https://en.cppreference.com/w/c/numeric/complex/carg
Proposal:
def angle(x: array, /) -> array
Questions
- okay with
angle
as name? arg? phase? - only operate on complex arrays, similar to
conj
et al?
cc @kgryte