Skip to content

Commit 0c4d440

Browse files
Align documentation reference with NumPy/CuPy short names (#2633)
This PR proposes to align all sections in `doc/reference` with `NumPy` and `CuPy` documentation style by using short function names Additionally, it adds `hints` with links to the corresponding NumPy API reference pages and fixes math rendering in `gcd()` and `lcm()` docstrings
1 parent 5b39d66 commit 0c4d440

26 files changed

+864
-824
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
2424
* Silenced `pybind11` CMake message due to using compatibility mode for Python [#2614](https://github.com/IntelPython/dpnp/pull/2614)
2525
* Changed the license from `BSD-2-Clause` to `BSD-3-Clause` [#2593](https://github.com/IntelPython/dpnp/pull/2593)
2626
* Defined explicit versions range of the Python interpreter which is needed during the build [#2634](https://github.com/IntelPython/dpnp/pull/2634)
27+
* Aligned documentation with NumPy and CuPy style by using short function names [#2633](https://github.com/IntelPython/dpnp/pull/2633)
2728

2829
### Deprecated
2930

doc/reference/array-creation.rst

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.. _routines.array-creation:
22

3+
.. currentmodule:: dpnp
4+
35
Array creation routines
46
=======================
57

6-
.. https://numpy.org/doc/stable/reference/routines.array-creation.html
8+
.. hint:: `NumPy API Reference: Array creation routines <https://numpy.org/doc/stable/reference/routines.array-creation.html>`_
79

810
From shape or value
911
-----------------------
@@ -12,16 +14,16 @@ From shape or value
1214
:toctree: generated/
1315
:nosignatures:
1416

15-
dpnp.empty
16-
dpnp.empty_like
17-
dpnp.eye
18-
dpnp.identity
19-
dpnp.ones
20-
dpnp.ones_like
21-
dpnp.zeros
22-
dpnp.zeros_like
23-
dpnp.full
24-
dpnp.full_like
17+
empty
18+
empty_like
19+
eye
20+
identity
21+
ones
22+
ones_like
23+
zeros
24+
zeros_like
25+
full
26+
full_like
2527

2628

2729
From existing data
@@ -31,19 +33,19 @@ From existing data
3133
:toctree: generated/
3234
:nosignatures:
3335

34-
dpnp.array
35-
dpnp.asarray
36-
dpnp.asanyarray
37-
dpnp.ascontiguousarray
38-
dpnp.astype
39-
dpnp.copy
40-
dpnp.frombuffer
41-
dpnp.from_dlpack
42-
dpnp.fromfile
43-
dpnp.fromfunction
44-
dpnp.fromiter
45-
dpnp.fromstring
46-
dpnp.loadtxt
36+
array
37+
asarray
38+
asanyarray
39+
ascontiguousarray
40+
astype
41+
copy
42+
frombuffer
43+
from_dlpack
44+
fromfile
45+
fromfunction
46+
fromiter
47+
fromstring
48+
loadtxt
4749

4850

4951
Numerical ranges
@@ -53,13 +55,13 @@ Numerical ranges
5355
:toctree: generated/
5456
:nosignatures:
5557

56-
dpnp.arange
57-
dpnp.linspace
58-
dpnp.logspace
59-
dpnp.geomspace
60-
dpnp.meshgrid
61-
dpnp.mgrid
62-
dpnp.ogrid
58+
arange
59+
linspace
60+
logspace
61+
geomspace
62+
meshgrid
63+
mgrid
64+
ogrid
6365

6466

6567
Building matrices
@@ -69,18 +71,9 @@ Building matrices
6971
:toctree: generated/
7072
:nosignatures:
7173

72-
dpnp.diag
73-
dpnp.diagflat
74-
dpnp.tri
75-
dpnp.tril
76-
dpnp.triu
77-
dpnp.vander
78-
79-
80-
The Matrix class
81-
----------------
82-
.. autosummary::
83-
:toctree: generated/
84-
:nosignatures:
85-
86-
dpnp.bmat
74+
diag
75+
diagflat
76+
tri
77+
tril
78+
triu
79+
vander
Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
.. currentmodule:: dpnp
2+
13
Array manipulation routines
24
===========================
35

4-
.. https://numpy.org/doc/stable/reference/routines.array-manipulation.html
6+
.. hint:: `NumPy API Reference: Array manipulation routines <https://numpy.org/doc/stable/reference/routines.array-manipulation.html>`_
57

68
Basic operations
79
----------------
@@ -10,10 +12,10 @@ Basic operations
1012
:toctree: generated/
1113
:nosignatures:
1214

13-
dpnp.copyto
14-
dpnp.ndim
15-
dpnp.shape
16-
dpnp.size
15+
copyto
16+
ndim
17+
shape
18+
size
1719

1820

1921
Changing array shape
@@ -23,10 +25,10 @@ Changing array shape
2325
:toctree: generated/
2426
:nosignatures:
2527

26-
dpnp.reshape
27-
dpnp.ravel
28-
dpnp.ndarray.flat
29-
dpnp.ndarray.flatten
28+
reshape
29+
ravel
30+
ndarray.flat
31+
ndarray.flatten
3032

3133

3234
Transpose-like operations
@@ -36,13 +38,13 @@ Transpose-like operations
3638
:toctree: generated/
3739
:nosignatures:
3840

39-
dpnp.moveaxis
40-
dpnp.rollaxis
41-
dpnp.swapaxes
42-
dpnp.ndarray.T
43-
dpnp.transpose
44-
dpnp.permute_dims
45-
dpnp.matrix_transpose (Array API compatible)
41+
moveaxis
42+
rollaxis
43+
swapaxes
44+
ndarray.T
45+
transpose
46+
permute_dims
47+
matrix_transpose (Array API compatible)
4648

4749

4850
Changing number of dimensions
@@ -52,14 +54,14 @@ Changing number of dimensions
5254
:toctree: generated/
5355
:nosignatures:
5456

55-
dpnp.atleast_1d
56-
dpnp.atleast_2d
57-
dpnp.atleast_3d
58-
dpnp.broadcast
59-
dpnp.broadcast_to
60-
dpnp.broadcast_arrays
61-
dpnp.expand_dims
62-
dpnp.squeeze
57+
atleast_1d
58+
atleast_2d
59+
atleast_3d
60+
broadcast
61+
broadcast_to
62+
broadcast_arrays
63+
expand_dims
64+
squeeze
6365

6466

6567
Changing kind of array
@@ -69,14 +71,14 @@ Changing kind of array
6971
:toctree: generated/
7072
:nosignatures:
7173

72-
dpnp.asarray
73-
dpnp.asanyarray
74-
dpnp.asnumpy
75-
dpnp.asfarray
76-
dpnp.asfortranarray
77-
dpnp.ascontiguousarray
78-
dpnp.asarray_chkfinite
79-
dpnp.require
74+
asarray
75+
asanyarray
76+
asnumpy
77+
asfarray
78+
asfortranarray
79+
ascontiguousarray
80+
asarray_chkfinite
81+
require
8082

8183

8284
Joining arrays
@@ -86,15 +88,15 @@ Joining arrays
8688
:toctree: generated/
8789
:nosignatures:
8890

89-
dpnp.concatenate
90-
dpnp.concat
91-
dpnp.stack
92-
dpnp.block
93-
dpnp.vstack
94-
dpnp.hstack
95-
dpnp.dstack
96-
dpnp.column_stack
97-
dpnp.row_stack
91+
concatenate
92+
concat
93+
stack
94+
block
95+
vstack
96+
hstack
97+
dstack
98+
column_stack
99+
row_stack
98100

99101

100102
Splitting arrays
@@ -104,12 +106,12 @@ Splitting arrays
104106
:toctree: generated/
105107
:nosignatures:
106108

107-
dpnp.split
108-
dpnp.array_split
109-
dpnp.dsplit
110-
dpnp.hsplit
111-
dpnp.vsplit
112-
dpnp.unstack
109+
split
110+
array_split
111+
dsplit
112+
hsplit
113+
vsplit
114+
unstack
113115

114116

115117
Tiling arrays
@@ -119,8 +121,8 @@ Tiling arrays
119121
:toctree: generated/
120122
:nosignatures:
121123

122-
dpnp.tile
123-
dpnp.repeat
124+
tile
125+
repeat
124126

125127

126128
Adding and removing elements
@@ -130,12 +132,12 @@ Adding and removing elements
130132
:toctree: generated/
131133
:nosignatures:
132134

133-
dpnp.delete
134-
dpnp.insert
135-
dpnp.append
136-
dpnp.resize
137-
dpnp.trim_zeros
138-
dpnp.pad
135+
delete
136+
insert
137+
append
138+
resize
139+
trim_zeros
140+
pad
139141

140142

141143
Rearranging elements
@@ -145,8 +147,8 @@ Rearranging elements
145147
:toctree: generated/
146148
:nosignatures:
147149

148-
dpnp.flip
149-
dpnp.fliplr
150-
dpnp.flipud
151-
dpnp.roll
152-
dpnp.rot90
150+
flip
151+
fliplr
152+
flipud
153+
roll
154+
rot90

doc/reference/array_api.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
.. _array-api-standard-compatibility:
22

3-
.. https://numpy.org/doc/stable/reference/array_api.html
3+
.. currentmodule:: dpnp
44

55
********************************
66
Array API standard compatibility
77
********************************
88

9+
.. hint:: `NumPy API Reference: Array API standard compatibility <https://numpy.org/doc/stable/reference/array_api.html>`_
10+
911
DPNP's main namespace as well as the :mod:`dpnp.fft` and :mod:`dpnp.linalg`
1012
namespaces are compatible with the
1113
`2024.12 version <https://data-apis.org/array-api/2024.12/index.html>`__
@@ -23,4 +25,4 @@ function, which returns a namespace containing the inspection utilities.
2325
:toctree: generated/
2426
:nosignatures:
2527

26-
dpnp.__array_namespace_info__
28+
__array_namespace_info__

0 commit comments

Comments
 (0)