Skip to content

Commit 5a68453

Browse files
authored
Add complex number support to square (#552)
1 parent 91656a7 commit 5a68453

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: spec/API_specification/array_api/elementwise_functions.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1955,13 +1955,22 @@ def sinh(x: array, /) -> array:
19551955
"""
19561956

19571957
def square(x: array, /) -> array:
1958-
"""
1959-
Squares (``x_i * x_i``) each element ``x_i`` of the input array ``x``.
1958+
r"""
1959+
Squares each element ``x_i`` of the input array ``x``.
1960+
1961+
The square of a number ``x_i`` is defined as
1962+
1963+
.. math::
1964+
x_i^2 = x_i \cdot x_i
1965+
1966+
**Special cases**
1967+
1968+
For floating-point operands, special cases must be handled as if the operation is implemented as ``x * x`` (see :func:`~array_api.multiply`).
19601969
19611970
Parameters
19621971
----------
19631972
x: array
1964-
input array. Should have a real-valued data type.
1973+
input array. Should have a numeric data type.
19651974
19661975
Returns
19671976
-------

0 commit comments

Comments
 (0)