Skip to content

Commit fc36a42

Browse files
committed
chore: fix alignment
1 parent a818400 commit fc36a42

File tree

2 files changed

+67
-67
lines changed

2 files changed

+67
-67
lines changed

src/array_api_stubs/_draft/array_object.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,28 +1112,28 @@ def __setitem__(
11121112

11131113
def __sub__(self: array, other: Union[int, float, complex, array], /) -> array:
11141114
"""
1115-
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
1115+
Calculates the difference for each element of an array instance with the respective element of the array ``other``.
11161116
1117-
Parameters
1118-
----------
1119-
self: array
1120-
array instance (minuend array). Should have a numeric data type.
1121-
other: Union[int, float, array]
1122-
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
1117+
Parameters
1118+
----------
1119+
self: array
1120+
array instance (minuend array). Should have a numeric data type.
1121+
other: Union[int, float, array]
1122+
subtrahend array. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
11231123
1124-
Returns
1125-
-------
1126-
out: array
1127-
an array containing the element-wise differences. The returned array must have a data type determined by :ref:`type-promotion`.
1124+
Returns
1125+
-------
1126+
out: array
1127+
an array containing the element-wise differences. The returned array must have a data type determined by :ref:`type-promotion`.
11281128
1129-
Notes
1130-
-----
1129+
Notes
1130+
-----
11311131
11321132
- Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.subtract`.
11331133
- The result of ``self_i - other_i`` must be the same as ``self_i + (-other_i)`` and must be governed by the same floating-point rules as addition (see :meth:`array.__add__`).
11341134
1135-
.. versionchanged:: 2022.12
1136-
Added complex data type support.
1135+
.. versionchanged:: 2022.12
1136+
Added complex data type support.
11371137
"""
11381138

11391139
def __truediv__(self: array, other: Union[int, float, array], /) -> array:

src/array_api_stubs/_draft/elementwise_functions.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,71 +2271,71 @@ def pow(
22712271
x1: Union[array, int, float, complex], x2: Union[array, int, float, complex], /
22722272
) -> array:
22732273
r"""
2274-
Calculates an implementation-dependent approximation of exponentiation by raising each element ``x1_i`` (the base) of the input array ``x1`` to the power of ``x2_i`` (the exponent), where ``x2_i`` is the corresponding element of the input array ``x2``.
2274+
Calculates an implementation-dependent approximation of exponentiation by raising each element ``x1_i`` (the base) of the input array ``x1`` to the power of ``x2_i`` (the exponent), where ``x2_i`` is the corresponding element of the input array ``x2``.
22752275
2276-
Parameters
2277-
----------
2278-
x1: Union[array, int, float, complex]
2279-
first input array whose elements correspond to the exponentiation base. Should have a numeric data type.
2280-
x2: Union[array, int, float, complex]
2281-
second input array whose elements correspond to the exponentiation exponent. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a numeric data type.
2276+
Parameters
2277+
----------
2278+
x1: Union[array, int, float, complex]
2279+
first input array whose elements correspond to the exponentiation base. Should have a numeric data type.
2280+
x2: Union[array, int, float, complex]
2281+
second input array whose elements correspond to the exponentiation exponent. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a numeric data type.
22822282
2283-
Returns
2284-
-------
2285-
out: array
2286-
an array containing the element-wise results. The returned array must have a data type determined by :ref:`type-promotion`.
2283+
Returns
2284+
-------
2285+
out: array
2286+
an array containing the element-wise results. The returned array must have a data type determined by :ref:`type-promotion`.
22872287
2288-
Notes
2289-
-----
2288+
Notes
2289+
-----
22902290
2291-
- At least one of ``x1`` or ``x2`` must be an array.
2291+
- At least one of ``x1`` or ``x2`` must be an array.
22922292
2293-
- If both ``x1`` and ``x2`` have integer data types, the result of ``pow`` when ``x2_i`` is negative (i.e., less than zero) is unspecified and thus implementation-dependent.
2293+
- If both ``x1`` and ``x2`` have integer data types, the result of ``pow`` when ``x2_i`` is negative (i.e., less than zero) is unspecified and thus implementation-dependent.
22942294
2295-
- If ``x1`` has an integer data type and ``x2`` has a floating-point data type, behavior is implementation-dependent (type promotion between data type "kinds" (integer versus floating-point) is unspecified).
2295+
- If ``x1`` has an integer data type and ``x2`` has a floating-point data type, behavior is implementation-dependent (type promotion between data type "kinds" (integer versus floating-point) is unspecified).
22962296
22972297
- By convention, the branch cut of the natural logarithm is the negative real axis :math:`(-\infty, 0)`.
22982298
22992299
The natural logarithm is a continuous function from above the branch cut, taking into account the sign of the imaginary component. As special cases involving complex floating-point operands should be handled according to ``exp(x2*log(x1))``, exponentiation has the same branch cut for ``x1`` as the natural logarithm (see :func:`~array_api.log`).
23002300
23012301
*Note: branch cuts follow C99 and have provisional status* (see :ref:`branch-cuts`).
23022302
2303-
**Special cases**
2304-
2305-
For real-valued floating-point operands,
2306-
2307-
- If ``x1_i`` is not equal to ``1`` and ``x2_i`` is ``NaN``, the result is ``NaN``.
2308-
- If ``x2_i`` is ``+0``, the result is ``1``, even if ``x1_i`` is ``NaN``.
2309-
- If ``x2_i`` is ``-0``, the result is ``1``, even if ``x1_i`` is ``NaN``.
2310-
- If ``x1_i`` is ``NaN`` and ``x2_i`` is not equal to ``0``, the result is ``NaN``.
2311-
- If ``abs(x1_i)`` is greater than ``1`` and ``x2_i`` is ``+infinity``, the result is ``+infinity``.
2312-
- If ``abs(x1_i)`` is greater than ``1`` and ``x2_i`` is ``-infinity``, the result is ``+0``.
2313-
- If ``abs(x1_i)`` is ``1`` and ``x2_i`` is ``+infinity``, the result is ``1``.
2314-
- If ``abs(x1_i)`` is ``1`` and ``x2_i`` is ``-infinity``, the result is ``1``.
2315-
- If ``x1_i`` is ``1`` and ``x2_i`` is not ``NaN``, the result is ``1``.
2316-
- If ``abs(x1_i)`` is less than ``1`` and ``x2_i`` is ``+infinity``, the result is ``+0``.
2317-
- If ``abs(x1_i)`` is less than ``1`` and ``x2_i`` is ``-infinity``, the result is ``+infinity``.
2318-
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is greater than ``0``, the result is ``+infinity``.
2319-
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is less than ``0``, the result is ``+0``.
2320-
- If ``x1_i`` is ``-infinity``, ``x2_i`` is greater than ``0``, and ``x2_i`` is an odd integer value, the result is ``-infinity``.
2321-
- If ``x1_i`` is ``-infinity``, ``x2_i`` is greater than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+infinity``.
2322-
- If ``x1_i`` is ``-infinity``, ``x2_i`` is less than ``0``, and ``x2_i`` is an odd integer value, the result is ``-0``.
2323-
- If ``x1_i`` is ``-infinity``, ``x2_i`` is less than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+0``.
2324-
- If ``x1_i`` is ``+0`` and ``x2_i`` is greater than ``0``, the result is ``+0``.
2325-
- If ``x1_i`` is ``+0`` and ``x2_i`` is less than ``0``, the result is ``+infinity``.
2326-
- If ``x1_i`` is ``-0``, ``x2_i`` is greater than ``0``, and ``x2_i`` is an odd integer value, the result is ``-0``.
2327-
- If ``x1_i`` is ``-0``, ``x2_i`` is greater than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+0``.
2328-
- If ``x1_i`` is ``-0``, ``x2_i`` is less than ``0``, and ``x2_i`` is an odd integer value, the result is ``-infinity``.
2329-
- If ``x1_i`` is ``-0``, ``x2_i`` is less than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+infinity``.
2330-
- If ``x1_i`` is less than ``0``, ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x2_i`` is not an integer value, the result is ``NaN``.
2331-
2332-
For complex floating-point operands, special cases should be handled as if the operation is implemented as ``exp(x2*log(x1))``.
2333-
2334-
.. note::
2335-
Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.
2336-
2337-
.. versionchanged:: 2022.12
2338-
Added complex data type support.
2303+
**Special cases**
2304+
2305+
For real-valued floating-point operands,
2306+
2307+
- If ``x1_i`` is not equal to ``1`` and ``x2_i`` is ``NaN``, the result is ``NaN``.
2308+
- If ``x2_i`` is ``+0``, the result is ``1``, even if ``x1_i`` is ``NaN``.
2309+
- If ``x2_i`` is ``-0``, the result is ``1``, even if ``x1_i`` is ``NaN``.
2310+
- If ``x1_i`` is ``NaN`` and ``x2_i`` is not equal to ``0``, the result is ``NaN``.
2311+
- If ``abs(x1_i)`` is greater than ``1`` and ``x2_i`` is ``+infinity``, the result is ``+infinity``.
2312+
- If ``abs(x1_i)`` is greater than ``1`` and ``x2_i`` is ``-infinity``, the result is ``+0``.
2313+
- If ``abs(x1_i)`` is ``1`` and ``x2_i`` is ``+infinity``, the result is ``1``.
2314+
- If ``abs(x1_i)`` is ``1`` and ``x2_i`` is ``-infinity``, the result is ``1``.
2315+
- If ``x1_i`` is ``1`` and ``x2_i`` is not ``NaN``, the result is ``1``.
2316+
- If ``abs(x1_i)`` is less than ``1`` and ``x2_i`` is ``+infinity``, the result is ``+0``.
2317+
- If ``abs(x1_i)`` is less than ``1`` and ``x2_i`` is ``-infinity``, the result is ``+infinity``.
2318+
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is greater than ``0``, the result is ``+infinity``.
2319+
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is less than ``0``, the result is ``+0``.
2320+
- If ``x1_i`` is ``-infinity``, ``x2_i`` is greater than ``0``, and ``x2_i`` is an odd integer value, the result is ``-infinity``.
2321+
- If ``x1_i`` is ``-infinity``, ``x2_i`` is greater than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+infinity``.
2322+
- If ``x1_i`` is ``-infinity``, ``x2_i`` is less than ``0``, and ``x2_i`` is an odd integer value, the result is ``-0``.
2323+
- If ``x1_i`` is ``-infinity``, ``x2_i`` is less than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+0``.
2324+
- If ``x1_i`` is ``+0`` and ``x2_i`` is greater than ``0``, the result is ``+0``.
2325+
- If ``x1_i`` is ``+0`` and ``x2_i`` is less than ``0``, the result is ``+infinity``.
2326+
- If ``x1_i`` is ``-0``, ``x2_i`` is greater than ``0``, and ``x2_i`` is an odd integer value, the result is ``-0``.
2327+
- If ``x1_i`` is ``-0``, ``x2_i`` is greater than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+0``.
2328+
- If ``x1_i`` is ``-0``, ``x2_i`` is less than ``0``, and ``x2_i`` is an odd integer value, the result is ``-infinity``.
2329+
- If ``x1_i`` is ``-0``, ``x2_i`` is less than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+infinity``.
2330+
- If ``x1_i`` is less than ``0``, ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x2_i`` is not an integer value, the result is ``NaN``.
2331+
2332+
For complex floating-point operands, special cases should be handled as if the operation is implemented as ``exp(x2*log(x1))``.
2333+
2334+
.. note::
2335+
Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.
2336+
2337+
.. versionchanged:: 2022.12
2338+
Added complex data type support.
23392339
"""
23402340

23412341

0 commit comments

Comments
 (0)