From caf2013ec78d2a973882d25058c4f005494e1b8b Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 30 May 2022 02:14:06 -0700 Subject: [PATCH 1/3] Add specification for computing the complex conjugate --- .../array_api/elementwise_functions.py | 30 ++++++++++++++++++- .../elementwise_functions.rst | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/array_api/elementwise_functions.py b/spec/API_specification/array_api/elementwise_functions.py index f72af2089..8d79a45e5 100644 --- a/spec/API_specification/array_api/elementwise_functions.py +++ b/spec/API_specification/array_api/elementwise_functions.py @@ -401,6 +401,34 @@ def ceil(x: array, /) -> array: an array containing the rounded result for each element in ``x``. The returned array must have the same data type as ``x``. """ +def conj(x: array, /) -> array: + """ + Returns the complex conjugate for each element ``x_i`` of the input array ``x``. + + For complex numbers of the form + + .. math:: + a + bj + + the complex conjugate is defined as + + .. math:: + a - bj + + Hence, the returned complex conjugate must be computed by negating the imaginary component of each element ``x_i``. + + Parameters + ---------- + x: array + input array. Should have a complex-floating point data type. + + Returns + ------- + out: array + an array containing the element-wise results. The returned array must have the same data type as ``x``. + """ + + def cos(x: array, /) -> array: """ Calculates an implementation-dependent approximation to the cosine, having domain ``(-infinity, +infinity)`` and codomain ``[-1, +1]``, for each element ``x_i`` of the input array ``x``. Each element ``x_i`` is assumed to be expressed in radians. @@ -1390,4 +1418,4 @@ def trunc(x: array, /) -> array: an array containing the rounded result for each element in ``x``. The returned array must have the same data type as ``x``. """ -__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', 'remainder', 'round', 'sign', 'sin', 'sinh', 'square', 'sqrt', 'subtract', 'tan', 'tanh', 'trunc'] \ No newline at end of file +__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', 'remainder', 'round', 'sign', 'sin', 'sinh', 'square', 'sqrt', 'subtract', 'tan', 'tanh', 'trunc'] \ No newline at end of file diff --git a/spec/API_specification/elementwise_functions.rst b/spec/API_specification/elementwise_functions.rst index 02e3d50b6..b20278674 100644 --- a/spec/API_specification/elementwise_functions.rst +++ b/spec/API_specification/elementwise_functions.rst @@ -44,6 +44,7 @@ Objects in API bitwise_right_shift bitwise_xor ceil + conj cos cosh divide From bb65523330d4357969dceb0e786ddb5b666c4a97 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 30 May 2022 02:17:10 -0700 Subject: [PATCH 2/3] Remove config --- spec/conf.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/spec/conf.py b/spec/conf.py index 470900803..92d76dc28 100644 --- a/spec/conf.py +++ b/spec/conf.py @@ -51,13 +51,6 @@ default_role = 'code' # Mathjax configuration -mathjax_config = { - 'tex2jax': { - 'inlineMath': [ ["\\(","\\)"] ], - 'displayMath': [["\\[","\\]"] ], - }, -} - mathjax3_config = { "tex": { "inlineMath": [['\\(', '\\)']], From e746c568d26322d9107e1cd27198b742fe7fbb48 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 30 May 2022 02:29:07 -0700 Subject: [PATCH 3/3] Update copy --- spec/API_specification/array_api/elementwise_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/array_api/elementwise_functions.py b/spec/API_specification/array_api/elementwise_functions.py index 8d79a45e5..3737c5df0 100644 --- a/spec/API_specification/array_api/elementwise_functions.py +++ b/spec/API_specification/array_api/elementwise_functions.py @@ -415,7 +415,7 @@ def conj(x: array, /) -> array: .. math:: a - bj - Hence, the returned complex conjugate must be computed by negating the imaginary component of each element ``x_i``. + Hence, the returned complex conjugates must be computed by negating the imaginary component of each element ``x_i``. Parameters ----------