Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert changes to spec/*
  • Loading branch information
ev-br committed Dec 13, 2024
commit 699a1d658d79ff9fe66539a6e6733cc1440a49c8
38 changes: 19 additions & 19 deletions spec/draft/API_specification/array_object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Array object

Array API specification for array object attributes and methods.

A conforming implementation of the array API standard *must* provide and support an array object having the following attributes and methods.
A conforming implementation of the array API standard must provide and support an array object having the following attributes and methods.

Furthermore, a conforming implementation of the array API standard *must* support, at minimum, array objects of rank (i.e., number of dimensions) ``0``, ``1``, ``2``, ``3``, and ``4`` and *must* explicitly document their maximum supported rank ``N``.
Furthermore, a conforming implementation of the array API standard must support, at minimum, array objects of rank (i.e., number of dimensions) ``0``, ``1``, ``2``, ``3``, and ``4`` and must explicitly document their maximum supported rank ``N``.

.. note::
Conforming implementations *must* support zero-dimensional arrays.
Conforming implementations must support zero-dimensional arrays.

Apart from array object attributes, such as ``ndim``, ``device``, and ``dtype``, all operations in this standard return arrays (or tuples of arrays), including those operations, such as ``mean``, ``var``, and ``std``, from which some common array libraries (e.g., NumPy) return scalar values.

Expand All @@ -23,12 +23,12 @@ Furthermore, a conforming implementation of the array API standard *must* suppor
Operators
---------

A conforming implementation of the array API standard *must* provide and support an array object supporting the following Python operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following Python operators.

Arithmetic Operators
~~~~~~~~~~~~~~~~~~~~

A conforming implementation of the array API standard *must* provide and support an array object supporting the following Python arithmetic operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following Python arithmetic operators.

- ``+x``: :meth:`.array.__pos__`

Expand Down Expand Up @@ -75,24 +75,24 @@ A conforming implementation of the array API standard *must* provide and support
- `operator.pow(x1, x2) <https://docs.python.org/3/library/operator.html#operator.pow>`_
- `operator.__pow__(x1, x2) <https://docs.python.org/3/library/operator.html#operator.__pow__>`_

Arithmetic operators *should* be defined for arrays having real-valued data types.
Arithmetic operators should be defined for arrays having real-valued data types.

Array Operators
~~~~~~~~~~~~~~~

A conforming implementation of the array API standard *must* provide and support an array object supporting the following Python array operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following Python array operators.

- `x1 @ x2`: :meth:`.array.__matmul__`

- `operator.matmul(x1, x2) <https://docs.python.org/3/library/operator.html#operator.matmul>`_
- `operator.__matmul__(x1, x2) <https://docs.python.org/3/library/operator.html#operator.__matmul__>`_

The matmul ``@`` operator *should* be defined for arrays having real-valued data types.
The matmul ``@`` operator should be defined for arrays having real-valued data types.

Bitwise Operators
~~~~~~~~~~~~~~~~~

A conforming implementation of the array API standard *must* provide and support an array object supporting the following Python bitwise operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following Python bitwise operators.

- `~x`: :meth:`.array.__invert__`

Expand Down Expand Up @@ -126,12 +126,12 @@ A conforming implementation of the array API standard *must* provide and support
- `operator.rshift(x1, x2) <https://docs.python.org/3/library/operator.html#operator.rshift>`_
- `operator.__rshift__(x1, x2) <https://docs.python.org/3/library/operator.html#operator.__rshift__>`_

Bitwise operators *should* be defined for arrays having integer and boolean data types.
Bitwise operators should be defined for arrays having integer and boolean data types.

Comparison Operators
~~~~~~~~~~~~~~~~~~~~

A conforming implementation of the array API standard *must* provide and support an array object supporting the following Python comparison operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following Python comparison operators.

- `x1 < x2`: :meth:`.array.__lt__`

Expand Down Expand Up @@ -163,20 +163,20 @@ A conforming implementation of the array API standard *must* provide and support
- `operator.ne(x1, x2) <https://docs.python.org/3/library/operator.html#operator.ne>`_
- `operator.__ne__(x1, x2) <https://docs.python.org/3/library/operator.html#operator.__ne__>`_

:meth:`.array.__lt__`, :meth:`.array.__le__`, :meth:`.array.__gt__`, :meth:`.array.__ge__` are only defined for arrays having real-valued data types. Other comparison operators *should* be defined for arrays having any data type.
:meth:`.array.__lt__`, :meth:`.array.__le__`, :meth:`.array.__gt__`, :meth:`.array.__ge__` are only defined for arrays having real-valued data types. Other comparison operators should be defined for arrays having any data type.
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).

In-place Operators
~~~~~~~~~~~~~~~~~~

A conforming implementation of the array API standard *must* provide and support an array object supporting the following in-place Python operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following in-place Python operators.

An in-place operation *must not* change the data type or shape of the in-place array as a result of :ref:`type-promotion` or :ref:`broadcasting`.
An in-place operation must not change the data type or shape of the in-place array as a result of :ref:`type-promotion` or :ref:`broadcasting`.

An in-place operation *must* have the same behavior (including special cases) as its respective binary (i.e., two operand, non-assignment) operation. For example, after in-place addition ``x1 += x2``, the modified array ``x1`` *must* always equal the result of the equivalent binary arithmetic operation ``x1 = x1 + x2``.
An in-place operation must have the same behavior (including special cases) as its respective binary (i.e., two operand, non-assignment) operation. For example, after in-place addition ``x1 += x2``, the modified array ``x1`` must always equal the result of the equivalent binary arithmetic operation ``x1 = x1 + x2``.

.. note::
In-place operators *must* be supported as discussed in :ref:`copyview-mutability`.
In-place operators must be supported as discussed in :ref:`copyview-mutability`.

Arithmetic Operators
""""""""""""""""""""
Expand Down Expand Up @@ -206,12 +206,12 @@ Bitwise Operators
Reflected Operators
~~~~~~~~~~~~~~~~~~~

A conforming implementation of the array API standard *must* provide and support an array object supporting the following reflected operators.
A conforming implementation of the array API standard must provide and support an array object supporting the following reflected operators.

The results of applying reflected operators *must* match their non-reflected equivalents.
The results of applying reflected operators must match their non-reflected equivalents.

.. note::
All operators for which ``array <op> scalar`` is implemented *must* have an equivalent reflected operator implementation.
All operators for which ``array <op> scalar`` is implemented must have an equivalent reflected operator implementation.

Arithmetic Operators
""""""""""""""""""""
Expand Down
4 changes: 2 additions & 2 deletions spec/draft/API_specification/broadcasting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Given an element-wise operation involving two compatible arrays, an array having

If two arrays are of unequal rank, the array having a lower rank is promoted to a higher rank by (virtually) prepending singleton dimensions until the number of dimensions matches that of the array having a higher rank.

The results of the element-wise operation *must* be stored in an array having a shape determined by the following algorithm.
The results of the element-wise operation must be stored in an array having a shape determined by the following algorithm.

#. Let ``A`` and ``B`` both be arrays.

Expand Down Expand Up @@ -112,7 +112,7 @@ The following examples demonstrate array shapes which do **not** broadcast.
In-place Semantics
------------------

As implied by the broadcasting algorithm, in-place element-wise operations (including ``__setitem__``) *must not* change the shape of the in-place array as a result of broadcasting. Such operations should only be supported in the case where the right-hand operand can broadcast to the shape of the left-hand operand, after any indexing operations are performed.
As implied by the broadcasting algorithm, in-place element-wise operations (including ``__setitem__``) must not change the shape of the in-place array as a result of broadcasting. Such operations should only be supported in the case where the right-hand operand can broadcast to the shape of the left-hand operand, after any indexing operations are performed.

For example:

Expand Down
4 changes: 2 additions & 2 deletions spec/draft/API_specification/constants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Constants

Array API specification for constants.

A conforming implementation of the array API standard *must* provide and support the following constants adhering to the following conventions.
A conforming implementation of the array API standard must provide and support the following constants adhering to the following conventions.

- Each constant *must* have a Python floating-point data type (i.e., ``float``) and be provided as a Python scalar value.
- Each constant must have a Python floating-point data type (i.e., ``float``) and be provided as a Python scalar value.

Objects in API
--------------
Expand Down
2 changes: 1 addition & 1 deletion spec/draft/API_specification/creation_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Creation Functions

Array API specification for creating arrays.

A conforming implementation of the array API standard *must* provide and support the following functions.
A conforming implementation of the array API standard must provide and support the following functions.


Objects in API
Expand Down
2 changes: 1 addition & 1 deletion spec/draft/API_specification/data_type_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Data Type Functions

Array API specification for data type functions.

A conforming implementation of the array API standard *must* provide and support the following data type functions.
A conforming implementation of the array API standard must provide and support the following data type functions.


Objects in API
Expand Down
Loading
Loading