@@ -12,3 +12,352 @@ For the basic concept of ``ndarray``\s, please refer to the `NumPy documentation
12
12
13
13
dpnp.ndarray
14
14
dpnp.dpnp_array.dpnp_array
15
+
16
+
17
+ Constructing arrays
18
+ ===================
19
+
20
+ New arrays can be constructed using the routines detailed in
21
+ :ref: `Array Creation Routines <routines.creation >`, and also by using the low-level
22
+ :class: `dpnp.ndarray ` constructor:
23
+
24
+ .. autosummary ::
25
+ :toctree: generated/
26
+ :nosignatures:
27
+
28
+ dpnp.ndarray
29
+
30
+
31
+ Indexing arrays
32
+ ===============
33
+
34
+ Arrays can be indexed using an extended Python slicing syntax,
35
+ ``array[selection] ``. Similar syntax is also used for accessing
36
+ fields in a :term: `structured data type `.
37
+
38
+ .. seealso :: :ref:`Array Indexing Routines <routines.indexing>`.
39
+
40
+
41
+ Array attributes
42
+ ================
43
+
44
+ Array attributes reflect information that is intrinsic to the array
45
+ itself. Generally, accessing an array through its attributes allows
46
+ you to get and sometimes set intrinsic properties of the array without
47
+ creating a new array. The exposed attributes are the core parts of an
48
+ array and only some of them can be reset meaningfully without creating
49
+ a new array. Information on each attribute is given below.
50
+
51
+
52
+ Memory layout
53
+ -------------
54
+
55
+ The following attributes contain information about the memory layout
56
+ of the array:
57
+
58
+ .. autosummary ::
59
+ :toctree: generated/
60
+ :nosignatures:
61
+
62
+ dpnp.ndarray.flags
63
+ dpnp.ndarray.shape
64
+ dpnp.ndarray.strides
65
+ dpnp.ndarray.ndim
66
+ dpnp.ndarray.data
67
+ dpnp.ndarray.size
68
+ dpnp.ndarray.itemsize
69
+ dpnp.ndarray.nbytes
70
+ dpnp.ndarray.base
71
+
72
+
73
+ Data type
74
+ ---------
75
+
76
+ .. seealso :: :ref:`Data type objects <dtype>`
77
+
78
+ The data type object associated with the array can be found in the
79
+ :attr: `dtype <dpnp.ndarray.dtype> ` attribute:
80
+
81
+ .. autosummary ::
82
+ :toctree: generated/
83
+ :nosignatures:
84
+
85
+ dpnp.ndarray.dtype
86
+
87
+
88
+ Other attributes
89
+ ----------------
90
+
91
+ .. autosummary ::
92
+ :toctree: generated/
93
+ :nosignatures:
94
+
95
+ dpnp.ndarray.T
96
+ dpnp.ndarray.real
97
+ dpnp.ndarray.imag
98
+ dpnp.ndarray.flat
99
+
100
+
101
+ Array methods
102
+ =============
103
+
104
+ An :class: `dpnp.ndarray ` object has many methods which operate on or with
105
+ the array in some fashion, typically returning an array result. These
106
+ methods are briefly explained below. (Each method's docstring has a
107
+ more complete description.)
108
+
109
+ For the following methods there are also corresponding functions in
110
+ :mod: `dpnp `: :func: `all <dpnp.all> `, :func: `any <dpnp.any> `,
111
+ :func: `argmax <dpnp.argmax> `, :func: `argmin <dpnp.argmin> `,
112
+ :func: `argpartition <dpnp.argpartition> `, :func: `argsort <dpnp.argsort> `,
113
+ :func: `choose <dpnp.choose> `, :func: `clip <dpnp.clip> `,
114
+ :func: `compress <dpnp.compress> `, :func: `copy <dpnp.copy> `,
115
+ :func: `cumprod <dpnp.cumprod> `, :func: `cumsum <dpnp.cumsum> `,
116
+ :func: `diagonal <dpnp.diagonal> `, :func: `imag <dpnp.imag> `,
117
+ :func: `max <dpnp.max> `, :func: `mean <dpnp.mean> `, :func: `min <dpnp.min> `,
118
+ :func: `nonzero <dpnp.nonzero> `, :func: `partition <dpnp.partition> `,
119
+ :func: `prod <dpnp.prod> `, :func: `ptp <dpnp.ptp> `, :func: `put <dpnp.put> `,
120
+ :func: `ravel <dpnp.ravel> `, :func: `real <dpnp.real> `, :func: `repeat <dpnp.repeat> `,
121
+ :func: `reshape <dpnp.reshape> `, :func: `round <dpnp.around> `,
122
+ :func: `searchsorted <dpnp.searchsorted> `, :func: `sort <dpnp.sort> `,
123
+ :func: `squeeze <dpnp.squeeze> `, :func: `std <dpnp.std> `, :func: `sum <dpnp.sum> `,
124
+ :func: `swapaxes <dpnp.swapaxes> `, :func: `take <dpnp.take> `, :func: `trace <dpnp.trace> `,
125
+ :func: `transpose <dpnp.transpose> `, :func: `var <dpnp.var> `.
126
+
127
+
128
+ Array conversion
129
+ ----------------
130
+
131
+ .. autosummary ::
132
+ :toctree: generated/
133
+ :nosignatures:
134
+
135
+ dpnp.ndarray.item
136
+ dpnp.ndarray.tolist
137
+ dpnp.ndarray.itemset
138
+ dpnp.ndarray.tostring
139
+ dpnp.ndarray.tobytes
140
+ dpnp.ndarray.tofile
141
+ dpnp.ndarray.dump
142
+ dpnp.ndarray.dumps
143
+ dpnp.ndarray.astype
144
+ dpnp.ndarray.byteswap
145
+ dpnp.ndarray.copy
146
+ dpnp.ndarray.view
147
+ dpnp.ndarray.getfield
148
+ dpnp.ndarray.setflags
149
+ dpnp.ndarray.fill
150
+
151
+
152
+ Shape manipulation
153
+ ------------------
154
+
155
+ For reshape, resize, and transpose, the single tuple argument may be
156
+ replaced with ``n `` integers which will be interpreted as an n-tuple.
157
+
158
+ .. autosummary ::
159
+ :toctree: generated/
160
+ :nosignatures:
161
+
162
+ dpnp.ndarray.reshape
163
+ dpnp.ndarray.resize
164
+ dpnp.ndarray.transpose
165
+ dpnp.ndarray.swapaxes
166
+ dpnp.ndarray.flatten
167
+ dpnp.ndarray.ravel
168
+ dpnp.ndarray.squeeze
169
+
170
+
171
+ Item selection and manipulation
172
+ -------------------------------
173
+
174
+ For array methods that take an *axis * keyword, it defaults to
175
+ *None *. If axis is *None *, then the array is treated as a 1-D
176
+ array. Any other value for *axis * represents the dimension along which
177
+ the operation should proceed.
178
+
179
+ .. autosummary ::
180
+ :toctree: generated/
181
+ :nosignatures:
182
+
183
+ dpnp.ndarray.take
184
+ dpnp.ndarray.put
185
+ dpnp.ndarray.repeat
186
+ dpnp.ndarray.choose
187
+ dpnp.ndarray.sort
188
+ dpnp.ndarray.argsort
189
+ dpnp.ndarray.partition
190
+ dpnp.ndarray.argpartition
191
+ dpnp.ndarray.searchsorted
192
+ dpnp.ndarray.nonzero
193
+ dpnp.ndarray.compress
194
+ dpnp.ndarray.diagonal
195
+
196
+
197
+ Calculation
198
+ -----------
199
+
200
+ .. autosummary ::
201
+ :toctree: generated/
202
+ :nosignatures:
203
+
204
+ dpnp.ndarray.max
205
+ dpnp.ndarray.argmax
206
+ dpnp.ndarray.min
207
+ dpnp.ndarray.argmin
208
+ dpnp.ndarray.ptp
209
+ dpnp.ndarray.clip
210
+ dpnp.ndarray.conj
211
+ dpnp.ndarray.conjugate
212
+ dpnp.ndarray.round
213
+ dpnp.ndarray.trace
214
+ dpnp.ndarray.sum
215
+ dpnp.ndarray.cumsum
216
+ dpnp.ndarray.mean
217
+ dpnp.ndarray.var
218
+ dpnp.ndarray.std
219
+ dpnp.ndarray.prod
220
+ dpnp.ndarray.cumprod
221
+ dpnp.ndarray.all
222
+ dpnp.ndarray.any
223
+
224
+
225
+ Arithmetic, matrix multiplication, and comparison operations
226
+ ============================================================
227
+
228
+ Arithmetic and comparison operations on :class: `dpnp.ndarrays <dpnp.ndarray> `
229
+ are defined as element-wise operations, and generally yield
230
+ :class: `dpnp.ndarray ` objects as results.
231
+
232
+ Each of the arithmetic operations (``+ ``, ``- ``, ``* ``, ``/ ``, ``// ``,
233
+ ``% ``, ``divmod() ``, ``** `` or ``pow() ``, ``<< ``, ``>> ``, ``& ``,
234
+ ``^ ``, ``| ``, ``~ ``) and the comparisons (``== ``, ``< ``, ``> ``,
235
+ ``<= ``, ``>= ``, ``!= ``) is equivalent to the corresponding
236
+ universal function (or **ufunc ** for short) in DPNP. For
237
+ more information, see the section on :ref: `Universal Functions
238
+ <ufunc>`.
239
+
240
+
241
+ Comparison operators:
242
+
243
+ .. autosummary ::
244
+ :toctree: generated/
245
+ :nosignatures:
246
+
247
+ dpnp.ndarray.__lt__
248
+ dpnp.ndarray.__le__
249
+ dpnp.ndarray.__gt__
250
+ dpnp.ndarray.__ge__
251
+ dpnp.ndarray.__eq__
252
+ dpnp.ndarray.__ne__
253
+
254
+
255
+ Unary operations:
256
+
257
+ .. autosummary ::
258
+ :toctree: generated/
259
+ :nosignatures:
260
+
261
+ dpnp.ndarray.__neg__
262
+ dpnp.ndarray.__pos__
263
+ dpnp.ndarray.__abs__
264
+ dpnp.ndarray.__invert__
265
+
266
+
267
+ Arithmetic:
268
+
269
+ .. autosummary ::
270
+ :toctree: generated/
271
+ :nosignatures:
272
+
273
+ dpnp.ndarray.__add__
274
+ dpnp.ndarray.__sub__
275
+ dpnp.ndarray.__mul__
276
+ dpnp.ndarray.__truediv__
277
+ dpnp.ndarray.__floordiv__
278
+ dpnp.ndarray.__mod__
279
+ dpnp.ndarray.__divmod__
280
+ dpnp.ndarray.__pow__
281
+ dpnp.ndarray.__lshift__
282
+ dpnp.ndarray.__rshift__
283
+ dpnp.ndarray.__and__
284
+ dpnp.ndarray.__or__
285
+ dpnp.ndarray.__xor__
286
+
287
+
288
+ Arithmetic, in-place:
289
+
290
+ .. autosummary ::
291
+ :toctree: generated/
292
+ :nosignatures:
293
+
294
+ dpnp.ndarray.__iadd__
295
+ dpnp.ndarray.__isub__
296
+ dpnp.ndarray.__imul__
297
+ dpnp.ndarray.__itruediv__
298
+ dpnp.ndarray.__ifloordiv__
299
+ dpnp.ndarray.__imod__
300
+ dpnp.ndarray.__ipow__
301
+ dpnp.ndarray.__ilshift__
302
+ dpnp.ndarray.__irshift__
303
+ dpnp.ndarray.__iand__
304
+ dpnp.ndarray.__ior__
305
+ dpnp.ndarray.__ixor__
306
+
307
+
308
+ Special methods
309
+ ===============
310
+
311
+ For standard library functions:
312
+
313
+ .. autosummary ::
314
+ :toctree: generated/
315
+ :nosignatures:
316
+
317
+ dpnp.ndarray.__copy__
318
+ dpnp.ndarray.__deepcopy__
319
+ dpnp.ndarray.__reduce__
320
+ dpnp.ndarray.__setstate__
321
+
322
+ Basic customization:
323
+
324
+ .. autosummary ::
325
+ :toctree: generated/
326
+ :nosignatures:
327
+
328
+ dpnp.ndarray.__new__
329
+ dpnp.ndarray.__array__
330
+ dpnp.ndarray.__array_wrap__
331
+
332
+ Container customization: (see :ref: `Indexing <routines.indexing >`)
333
+
334
+ .. autosummary ::
335
+ :toctree: generated/
336
+ :nosignatures:
337
+
338
+ dpnp.ndarray.__len__
339
+ dpnp.ndarray.__getitem__
340
+ dpnp.ndarray.__setitem__
341
+ dpnp.ndarray.__contains__
342
+
343
+ Conversion; the operations :class: `int() <int> `,
344
+ :class: `float() <float> ` and :class: `complex() <complex> `.
345
+ They work only on arrays that have one element in them
346
+ and return the appropriate scalar.
347
+
348
+ .. autosummary ::
349
+ :toctree: generated/
350
+ :nosignatures:
351
+
352
+ dpnp.ndarray.__int__
353
+ dpnp.ndarray.__float__
354
+ dpnp.ndarray.__complex__
355
+
356
+ String representations:
357
+
358
+ .. autosummary ::
359
+ :toctree: generated/
360
+ :nosignatures:
361
+
362
+ dpnp.ndarray.__str__
363
+ dpnp.ndarray.__repr__
0 commit comments