Skip to content

Commit 309d191

Browse files
authored
Add conj specification for computing the complex conjugate (#446)
* Add specification for computing the complex conjugate * Remove config * Update copy
1 parent 15e37c9 commit 309d191

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

spec/API_specification/array_api/elementwise_functions.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,34 @@ def ceil(x: array, /) -> array:
401401
an array containing the rounded result for each element in ``x``. The returned array must have the same data type as ``x``.
402402
"""
403403

404+
def conj(x: array, /) -> array:
405+
"""
406+
Returns the complex conjugate for each element ``x_i`` of the input array ``x``.
407+
408+
For complex numbers of the form
409+
410+
.. math::
411+
a + bj
412+
413+
the complex conjugate is defined as
414+
415+
.. math::
416+
a - bj
417+
418+
Hence, the returned complex conjugates must be computed by negating the imaginary component of each element ``x_i``.
419+
420+
Parameters
421+
----------
422+
x: array
423+
input array. Should have a complex-floating point data type.
424+
425+
Returns
426+
-------
427+
out: array
428+
an array containing the element-wise results. The returned array must have the same data type as ``x``.
429+
"""
430+
431+
404432
def cos(x: array, /) -> array:
405433
r"""
406434
Calculates an implementation-dependent approximation to the cosine for each element ``x_i`` of the input array ``x``.
@@ -1582,4 +1610,4 @@ def trunc(x: array, /) -> array:
15821610
an array containing the rounded result for each element in ``x``. The returned array must have the same data type as ``x``.
15831611
"""
15841612

1585-
__all__ = ['abs', 'acos', 'acosh', 'add', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'bitwise_and', 'bitwise_left_shift', 'bitwise_invert', 'bitwise_or', 'bitwise_right_shift', 'bitwise_xor', 'ceil', 'cos', 'cosh', 'divide', 'equal', 'exp', 'expm1', 'floor', 'floor_divide', 'greater', 'greater_equal', 'isfinite', 'isinf', 'isnan', 'less', 'less_equal', 'log', 'log1p', 'log2', 'log10', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'multiply', 'negative', 'not_equal', 'positive', 'pow', 'real', 'remainder', 'round', 'sign', 'sin', 'sinh', 'square', 'sqrt', 'subtract', 'tan', 'tanh', 'trunc']
1613+
__all__ = ['abs', 'acos', 'acosh', 'add', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'bitwise_and', 'bitwise_left_shift', 'bitwise_invert', 'bitwise_or', 'bitwise_right_shift', 'bitwise_xor', 'ceil', 'conj', 'cos', 'cosh', 'divide', 'equal', 'exp', 'expm1', 'floor', 'floor_divide', 'greater', 'greater_equal', 'isfinite', 'isinf', 'isnan', 'less', 'less_equal', 'log', 'log1p', 'log2', 'log10', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'multiply', 'negative', 'not_equal', 'positive', 'pow', 'real', 'remainder', 'round', 'sign', 'sin', 'sinh', 'square', 'sqrt', 'subtract', 'tan', 'tanh', 'trunc']

spec/API_specification/elementwise_functions.rst

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Objects in API
4444
bitwise_right_shift
4545
bitwise_xor
4646
ceil
47+
conj
4748
cos
4849
cosh
4950
divide

0 commit comments

Comments
 (0)