From 4e4b2b41b0427dbb26d697269ee4f2de72a49f72 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 2 May 2022 02:10:54 -0700 Subject: [PATCH 1/4] Add initial stub --- .../signatures/elementwise_functions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/API_specification/signatures/elementwise_functions.py b/spec/API_specification/signatures/elementwise_functions.py index 213ebe53e..b973cdc20 100644 --- a/spec/API_specification/signatures/elementwise_functions.py +++ b/spec/API_specification/signatures/elementwise_functions.py @@ -1108,6 +1108,16 @@ def pow(x1: array, x2: array, /) -> array: an array containing the element-wise results. The returned array must have a data type determined by :ref:`type-promotion`. """ +def real(x: array, /) -> array: + """ + Returns the real component of a complex number for each element ``x_i`` of the input array ``x``. + + Parameters + ---------- + x: array + input array. + """ + def remainder(x1: array, x2: array, /) -> array: """ Returns the remainder of division for each element ``x1_i`` of the input array ``x1`` and the respective element ``x2_i`` of the input array ``x2``. From 2bc3c15d6a592f7a5cd32ea81c10f787e0b333c4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 5 May 2022 01:01:02 -0700 Subject: [PATCH 2/4] Update copy concerning input and output array data types --- spec/API_specification/signatures/elementwise_functions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/signatures/elementwise_functions.py b/spec/API_specification/signatures/elementwise_functions.py index b973cdc20..b780e08e5 100644 --- a/spec/API_specification/signatures/elementwise_functions.py +++ b/spec/API_specification/signatures/elementwise_functions.py @@ -1115,7 +1115,12 @@ def real(x: array, /) -> array: Parameters ---------- x: array - input 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 a floating-point data type with the same floating-point precision as ``x`` (e.g., if ``x`` is ``complex64``, the returned array must have the floating-point data type ``float32``). """ def remainder(x1: array, x2: array, /) -> array: From d51bdcd312a0de0246fbe413ee67db7dae37e460 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 5 May 2022 01:14:12 -0700 Subject: [PATCH 3/4] Update index --- spec/API_specification/elementwise_functions.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/API_specification/elementwise_functions.rst b/spec/API_specification/elementwise_functions.rst index 316ac8ce9..503b60f09 100644 --- a/spec/API_specification/elementwise_functions.rst +++ b/spec/API_specification/elementwise_functions.rst @@ -73,6 +73,7 @@ Objects in API not_equal positive pow + real remainder round sign From f1ee418a6c83ff0ef3b65d53e2595a80fb1a392e Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 19 Sep 2022 01:47:55 -0700 Subject: [PATCH 4/4] Fix missing export --- 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 2199392f2..c0efb6eaf 100644 --- a/spec/API_specification/array_api/elementwise_functions.py +++ b/spec/API_specification/array_api/elementwise_functions.py @@ -1582,4 +1582,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', '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'] \ No newline at end of file