Skip to content

Clean up some wording in the fft extension #720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c51ce80
Use better wording for the return dtypes for fft functions
asmeurer Dec 12, 2023
1dd9757
Specify the output shapes for fft functions
asmeurer Dec 12, 2023
bde524e
Fix typo for rfft return dtype
asmeurer Dec 12, 2023
1fd3429
Add specification for computing the cumulative sum
kgryte Dec 14, 2023
bda9c48
Add note clarifying behavior for out-of-bounds indices in `take`
kgryte Dec 14, 2023
50ca679
Add specifications for `maximum` and `minimum`
kgryte Dec 14, 2023
5c2423a
Fix definition of complex inner product in `vecdot` (#723)
mtsokol Dec 18, 2023
3295776
Update fft, ifft, fftn, ifftn, and hfft to only accept complex inputs
asmeurer Jan 10, 2024
72f86f3
Add `searchsorted` to the specification (#699)
kgryte Jan 11, 2024
8fe8b08
Fix sidebar contents under Extensions (#729)
rgommers Jan 11, 2024
7a56675
Update DLPack content to address unsupported use cases (#709)
rgommers Jan 12, 2024
7c3f99a
Backport fft language improvements to 2022.12
asmeurer Jan 12, 2024
62f95fd
Fix typo for hfft return dtype
asmeurer Jan 12, 2024
6e320d0
Add `clip` to the specification
kgryte Jan 22, 2024
0cde841
Clarify guidance in the "function and method signatures" section
rgommers Jan 22, 2024
293512d
Upgrade Sphinx version used in doc deployment (#735)
rgommers Jan 22, 2024
95332bb
Fix wording for comparison operators
hameerabbasi Jan 25, 2024
e9988f2
Fix the text for the output shape for (i)rfft(n)
asmeurer Feb 5, 2024
22fc23a
Add Optional type annotation for some parameters that can be None
asmeurer Feb 5, 2024
d4eebdf
back port optional type annotation
leofang Feb 7, 2024
86cc351
nits
leofang Feb 7, 2024
c4df0be
sync 2022 and draft
leofang Feb 7, 2024
6a2d6d0
nit: length of array "along" axis
leofang Feb 7, 2024
4d6e519
mention untransformed axes & align style
leofang Feb 7, 2024
35f2ea4
no more m
leofang Feb 7, 2024
a84c293
separately list the condition when s/n is None
leofang Feb 7, 2024
029afcd
Update language to be consistent with existing specification conventions
kgryte Feb 7, 2024
17124ba
Merge branch 'fft-fixes' of https://github.com/asmeurer/array-api int…
kgryte Feb 8, 2024
6d9fac4
Update copy for `fft`
kgryte Feb 8, 2024
66e9e29
Update copy
kgryte Feb 8, 2024
99cb776
Update copy for `ifft`
kgryte Feb 8, 2024
04a4e66
style: satisfy linting
kgryte Feb 8, 2024
9f208f6
Update copy for `fftn`
kgryte Feb 8, 2024
9a6fcc7
Update copy for `ifftn`
kgryte Feb 8, 2024
454ded7
Update copy
kgryte Feb 8, 2024
21e2840
Update copy for `rfft`
kgryte Feb 8, 2024
22d354a
Update copy for `irfft`
kgryte Feb 8, 2024
4d0160c
Update copy for `rfftn`
kgryte Feb 8, 2024
9d90326
Update copy for `irfftn`
kgryte Feb 8, 2024
8f2b6df
Update copy for `hfft`
kgryte Feb 8, 2024
43e96fa
Update copy for `ihfft`
kgryte Feb 8, 2024
c180034
Update copy
kgryte Feb 8, 2024
9f1c20e
Copy changes over to draft specification
kgryte Feb 8, 2024
b97bb34
Update copy
kgryte Feb 8, 2024
0a7df55
Fix indentation
kgryte Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
sphinx==4.3.0
sphinx==6.2.1
sphinx-material==0.0.30
myst-parser
sphinx_markdown_tables
sphinx_copybutton
sphinx_favicon
docutils<0.18
sphinx-math-dollar
4 changes: 2 additions & 2 deletions spec/2021.12/assumptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of functions to be predictable from input dtypes only rather than input values.

The only dependency that's assumed in this standard is that on Python itself.
Python >= 3.8 is assumed, motivated by the use of positional-only parameters
(see [function and method signatures](API_specification/function_and_method_signatures.md)).
(see [function and method signatures](API_specification/function_and_method_signatures.rst)).

Importantly, array libraries are not assumed to be aware of each other, or of
a common array-specific layer. The [use cases](use_cases.md) do not require
Expand All @@ -39,7 +39,7 @@ for that is:

Array libraries may know how to interoperate with each other, for example by
constructing their own array type from that of another library or by shared
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.md)).
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.rst)).
This can be done without a dependency though - only adherence to a protocol is
enough.

Expand Down
2 changes: 1 addition & 1 deletion spec/2021.12/purpose_and_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ standard is shown in this diagram:
_Rationale: this is an important topic for some array-consuming libraries,
but there is no widely shared C/Cython API and hence it doesn't make sense at
this point in time to standardize anything. See
the [C API section](design_topics/C_API.md) for more details._
the [C API section](design_topics/C_API.rst) for more details._

4. Standardization of these dtypes is out of scope: bfloat16, complex, extended
precision floating point, datetime, string, object and void dtypes.
Expand Down
2 changes: 1 addition & 1 deletion spec/2021.12/use_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ array implementation as a dependency.

It's clear that SciPy functionality that relies on compiled extensions (C,
C++, Cython, Fortran) directly can't easily be run on another array library
than NumPy (see [C API](design_topics/C_API.md) for more details about this topic). Pure Python
than NumPy (see [C API](design_topics/C_API.rst) for more details about this topic). Pure Python
code can work though. There's two main possibilities:

1. Testing with another package, manually or in CI, and simply provide a list
Expand Down
3 changes: 2 additions & 1 deletion spec/2022.12/API_specification/array_object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ A conforming implementation of the array API standard must provide and support a
- `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__>`_

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
~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions spec/2022.12/assumptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of functions to be predictable from input dtypes only rather than input values.

The only dependency that's assumed in this standard is that on Python itself.
Python >= 3.8 is assumed, motivated by the use of positional-only parameters
(see [function and method signatures](API_specification/function_and_method_signatures.md)).
(see [function and method signatures](API_specification/function_and_method_signatures.rst)).

Importantly, array libraries are not assumed to be aware of each other, or of
a common array-specific layer. The [use cases](use_cases.md) do not require
Expand All @@ -39,7 +39,7 @@ for that is:

Array libraries may know how to interoperate with each other, for example by
constructing their own array type from that of another library or by shared
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.md)).
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.rst)).
This can be done without a dependency though - only adherence to a protocol is
enough.

Expand Down
2 changes: 1 addition & 1 deletion spec/2022.12/purpose_and_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ standard is shown in this diagram:
_Rationale: this is an important topic for some array-consuming libraries,
but there is no widely shared C/Cython API and hence it doesn't make sense at
this point in time to standardize anything. See
the [C API section](design_topics/C_API.md) for more details._
the [C API section](design_topics/C_API.rst) for more details._

4. Standardization of these dtypes is out of scope: bfloat16, extended
precision floating point, datetime, string, object and void dtypes.
Expand Down
2 changes: 1 addition & 1 deletion spec/2022.12/use_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ array implementation as a dependency.

It's clear that SciPy functionality that relies on compiled extensions (C,
C++, Cython, Fortran) directly can't easily be run on another array library
than NumPy (see [C API](design_topics/C_API.md) for more details about this topic). Pure Python
than NumPy (see [C API](design_topics/C_API.rst) for more details about this topic). Pure Python
code can work though. There's two main possibilities:

1. Testing with another package, manually or in CI, and simply provide a list
Expand Down
3 changes: 2 additions & 1 deletion spec/draft/API_specification/array_object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ A conforming implementation of the array API standard must provide and support a
- `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__>`_

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
~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions spec/draft/API_specification/elementwise_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Objects in API
bitwise_right_shift
bitwise_xor
ceil
clip
conj
copysign
cos
Expand Down Expand Up @@ -60,6 +61,8 @@ Objects in API
logical_not
logical_or
logical_xor
maximum
minimum
multiply
negative
not_equal
Expand Down
12 changes: 8 additions & 4 deletions spec/draft/API_specification/function_and_method_signatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Function and method signatures

Function signatures in this standard adhere to the following:

1. Positional parameters must be `positional-only <https://www.python.org/dev/peps/pep-0570/>`_ parameters.
1. Positional parameters should be `positional-only <https://www.python.org/dev/peps/pep-0570/>`_ parameters.
Positional-only parameters have no externally-usable name. When a function
accepting positional-only parameters is called, positional arguments are
mapped to these parameters based solely on their order.
Expand All @@ -20,7 +20,7 @@ Function signatures in this standard adhere to the following:
namespace >= 3.8. Alternatively, they can add guidance to their users in the
documentation to use the functions as if they were positional-only.

2. Optional parameters must be `keyword-only <https://www.python.org/dev/peps/pep-3102/>`_ arguments.
2. Optional parameters should be `keyword-only <https://www.python.org/dev/peps/pep-3102/>`_ arguments.

*Rationale: this leads to more readable code, and it makes it easier to
evolve an API over time by adding keywords without having to worry about
Expand All @@ -30,8 +30,8 @@ Function signatures in this standard adhere to the following:
is called ``x``. For functions that have multiple array parameters, those
parameters are called ``xi`` with ``i = 1, 2, ...`` (i.e., ``x1``, ``x2``).

4. Type annotations are left out of the signatures themselves for readability; however,
they are added to individual parameter descriptions. For code which aims to
4. Signatures include type annotations. The type annotations are also added to
individual parameter and return value descriptions. For code which aims to
adhere to the standard, adding type annotations is strongly recommended.

A function signature and description will look like:
Expand All @@ -57,3 +57,7 @@ A function signature and description will look like:


Method signatures will follow the same conventions modulo the addition of ``self``.

Note that there are a few exceptions to rules (1) and (2), in cases where
it enhances readability or use of the non-default form of the parameter in
question is commonly used in code written for existing array libraries.
1 change: 1 addition & 0 deletions spec/draft/API_specification/searching_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ Objects in API
argmax
argmin
nonzero
searchsorted
where
1 change: 1 addition & 0 deletions spec/draft/API_specification/statistical_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Objects in API
:toctree: generated
:template: method.rst

cumulative_sum
max
mean
min
Expand Down
4 changes: 2 additions & 2 deletions spec/draft/assumptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of functions to be predictable from input dtypes only rather than input values.

The only dependency that's assumed in this standard is that on Python itself.
Python >= 3.8 is assumed, motivated by the use of positional-only parameters
(see [function and method signatures](API_specification/function_and_method_signatures.md)).
(see [function and method signatures](API_specification/function_and_method_signatures.rst)).

Importantly, array libraries are not assumed to be aware of each other, or of
a common array-specific layer. The [use cases](use_cases.md) do not require
Expand All @@ -39,7 +39,7 @@ for that is:

Array libraries may know how to interoperate with each other, for example by
constructing their own array type from that of another library or by shared
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.md)).
memory use of an array (see [Data interchange mechanisms](design_topics/data_interchange.rst)).
This can be done without a dependency though - only adherence to a protocol is
enough.

Expand Down
19 changes: 19 additions & 0 deletions spec/draft/design_topics/data_interchange.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,22 @@ page gives a high-level specification for data exchange in Python using DLPack.
are recommended to do so using the same syntax and semantics as outlined
below. They are not required to return an array object from ``from_dlpack``
which conforms to this standard.

Non-supported use cases
-----------------------

Use of DLPack requires that the data can be represented by a strided, in-memory
layout on a single device. This covers usage by a large range of, but not all,
known and possible array libraries. Use cases that are not supported by DLPack
include:

- Distributed arrays, i.e., the data residing on multiple nodes or devices,
- Sparse arrays, i.e., sparse representations where a data value (typically
zero) is implicit.

There may be other reasons why it is not possible or desirable for an
implementation to materialize the array as strided data in memory. In such
cases, the implementation may raise a `BufferError` in the `__dlpack__` or
`__dlpack_device__` method. In case an implementation is never able to export
its array data via DLPack, it may omit `__dlpack__` and `__dlpack_device__`
completely, and hence `from_dlpack` may raise an `AttributeError`.
5 changes: 2 additions & 3 deletions spec/draft/extensions/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ the implementer, e.g. via a regular submodule that is imported under the
The functions in an extension must adhere to the same conventions as those in
the array API standard. See :ref:`api-specification`.


Extensions
----------
------------------------------------------------------------------------------

.. toctree::
:caption: Extension modules:
:maxdepth: 1

fourier_transform_functions
Expand Down
2 changes: 1 addition & 1 deletion spec/draft/purpose_and_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ standard is shown in this diagram:
_Rationale: this is an important topic for some array-consuming libraries,
but there is no widely shared C/Cython API and hence it doesn't make sense at
this point in time to standardize anything. See
the [C API section](design_topics/C_API.md) for more details._
the [C API section](design_topics/C_API.rst) for more details._

4. Standardization of these dtypes is out of scope: bfloat16, extended
precision floating point, datetime, string, object and void dtypes.
Expand Down
2 changes: 1 addition & 1 deletion spec/draft/use_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ array implementation as a dependency.

It's clear that SciPy functionality that relies on compiled extensions (C,
C++, Cython, Fortran) directly can't easily be run on another array library
than NumPy (see [C API](design_topics/C_API.md) for more details about this topic). Pure Python
than NumPy (see [C API](design_topics/C_API.rst) for more details about this topic). Pure Python
code can work though. There's two main possibilities:

1. Testing with another package, manually or in CI, and simply provide a list
Expand Down
2 changes: 2 additions & 0 deletions src/_array_api_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@
nitpick_ignore = [
("py:class", "collections.abc.Sequence"),
("py:class", "Optional[Union[int, float, Literal[inf, - inf, 'fro', 'nuc']]]"),
("py:class", "int | float | ~typing.Literal[inf, -inf, 'fro', 'nuc'] | None"),
("py:class", "Union[int, float, Literal[inf, - inf]]"),
(
"py:obj",
"typing.Optional[typing.Union[int, float, typing.Literal[inf, - inf, 'fro', 'nuc']]]",
),
("py:obj", "typing.Union[int, float, typing.Literal[inf, - inf]]"),
("py:class", "int | float | ~typing.Literal[inf, -inf]"),
("py:class", "enum.Enum"),
("py:class", "ellipsis"),
]
Expand Down
Loading