@@ -30,57 +30,6 @@ and its sub-types).
30
30
31
31
The number of dimensions in the array.
32
32
33
- .. c :function :: void *PyArray_DATA (PyArrayObject *arr)
34
-
35
- The pointer to the first element of the array.
36
-
37
- .. c :function :: char *PyArray_BYTES (PyArrayObject *arr)
38
-
39
- These two macros are similar and obtain the pointer to the
40
- data-buffer for the array. The first macro can (and should be)
41
- assigned to a particular pointer where the second is for generic
42
- processing. If you have not guaranteed a contiguous and/or aligned
43
- array then be sure you understand how to access the data in the
44
- array to avoid memory and/or alignment problems.
45
-
46
- .. c:function:: npy_intp *PyArray_DIMS(PyArrayObject *arr)
47
-
48
- Returns a pointer to the dimensions/shape of the array. The
49
- number of elements matches the number of dimensions
50
- of the array. Can return ``NULL `` for 0-dimensional arrays.
51
-
52
- .. c :function :: npy_intp *PyArray_STRIDES (PyArrayObject* arr)
53
-
54
- Returns a pointer to the strides of the array. The
55
- number of elements matches the number of dimensions
56
- of the array.
57
-
58
- .. c:function:: npy_intp PyArray_DIM(PyArrayObject* arr, int n)
59
-
60
- Return the shape in the *n* :math:`^{\t extrm{th}}` dimension.
61
-
62
- .. c :function :: npy_intp PyArray_STRIDE (PyArrayObject* arr, int n)
63
-
64
- Return the stride in the *n* :math:`^{\t extrm{th}}` dimension.
65
-
66
- .. c :function :: PyObject *PyArray_BASE (PyArrayObject* arr)
67
-
68
- This returns the base object of the array. In most cases, this
69
- means the object which owns the memory the array is pointing at.
70
-
71
- If you are constructing an array using the C API, and specifying
72
- your own memory, you should use the function :c:func:`PyArray_SetBaseObject`
73
- to set the base to an object which owns the memory.
74
-
75
- If the :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag is set, it has a different
76
- meaning, namely base is the array into which the current array will
77
- be copied upon copy resolution. This overloading of the base property
78
- for two functions is likely to change in a future version of NumPy.
79
-
80
- .. c:function:: PyArray_Descr *PyArray_DESCR(PyArrayObject* arr)
81
-
82
- Returns a borrowed reference to the dtype property of the array.
83
-
84
33
.. c :function :: int PyArray_FLAGS (PyArrayObject* arr)
85
34
86
35
Returns an integer representing the :ref:`array-flags<array-flags>`.
@@ -89,32 +38,6 @@ and its sub-types).
89
38
90
39
Return the (builtin) typenumber for the elements of this array.
91
40
92
- .. c:function:: PyArray_Descr *PyArray_DTYPE(PyArrayObject* arr)
93
-
94
- A synonym for PyArray_DESCR, named to be consistent with the
95
- 'dtype' usage within Python.
96
-
97
- .. c:function:: npy_intp *PyArray_SHAPE(PyArrayObject *arr)
98
-
99
- A synonym for :c:func: `PyArray_DIMS `, named to be consistent with the
100
- `shape <numpy.ndarray.shape> ` usage within Python.
101
-
102
- .. c :function :: void PyArray_ENABLEFLAGS (PyArrayObject* arr, int flags)
103
-
104
- Enables the specified array flags. This function does no validation,
105
- and assumes that you know what you're doing.
106
-
107
- .. c:function:: void PyArray_CLEARFLAGS(PyArrayObject* arr, int flags)
108
-
109
- Clears the specified array flags. This function does no validation,
110
- and assumes that you know what you're doing.
111
-
112
- .. c:function:: int PyArray_HANDLER(PyArrayObject *arr)
113
-
114
- .. versionadded :: 1.22
115
-
116
- Returns the memory handler associated with the given array.
117
-
118
41
.. c:function:: int PyArray_Pack( \
119
42
const PyArray_Descr *descr, void *item, const PyObject *value)
120
43
@@ -141,6 +64,52 @@ and its sub-types).
141
64
handling arbitrary Python objects. Setitem is for example not able
142
65
to handle arbitrary casts between different dtypes.
143
66
67
+ .. c:function:: void PyArray_ENABLEFLAGS(PyArrayObject* arr, int flags)
68
+
69
+ Enables the specified array flags. This function does no validation,
70
+ and assumes that you know what you're doing.
71
+
72
+ .. c:function:: void PyArray_CLEARFLAGS(PyArrayObject* arr, int flags)
73
+
74
+ Clears the specified array flags. This function does no validation,
75
+ and assumes that you know what you're doing.
76
+
77
+ .. c:function:: void *PyArray_DATA(PyArrayObject *arr)
78
+
79
+ .. c :function :: char *PyArray_BYTES (PyArrayObject *arr)
80
+
81
+ These two macros are similar and obtain the pointer to the
82
+ data-buffer for the array. The first macro can (and should be)
83
+ assigned to a particular pointer where the second is for generic
84
+ processing. If you have not guaranteed a contiguous and/or aligned
85
+ array then be sure you understand how to access the data in the
86
+ array to avoid memory and/or alignment problems.
87
+
88
+ .. c:function:: npy_intp *PyArray_DIMS(PyArrayObject *arr)
89
+
90
+ Returns a pointer to the dimensions/shape of the array. The
91
+ number of elements matches the number of dimensions
92
+ of the array. Can return ``NULL `` for 0-dimensional arrays.
93
+
94
+ .. c :function :: npy_intp *PyArray_SHAPE (PyArrayObject *arr)
95
+
96
+ A synonym for :c:func: `PyArray_DIMS `, named to be consistent with the
97
+ `shape <numpy.ndarray.shape> ` usage within Python.
98
+
99
+ .. c :function :: npy_intp *PyArray_STRIDES (PyArrayObject* arr)
100
+
101
+ Returns a pointer to the strides of the array. The
102
+ number of elements matches the number of dimensions
103
+ of the array.
104
+
105
+ .. c:function:: npy_intp PyArray_DIM(PyArrayObject* arr, int n)
106
+
107
+ Return the shape in the *n* :math:`^{\t extrm{th}}` dimension.
108
+
109
+ .. c :function :: npy_intp PyArray_STRIDE (PyArrayObject* arr, int n)
110
+
111
+ Return the stride in the *n* :math:`^{\t extrm{th}}` dimension.
112
+
144
113
.. c :function :: npy_intp PyArray_ITEMSIZE (PyArrayObject* arr)
145
114
146
115
Return the itemsize for the elements of this array.
@@ -162,6 +131,29 @@ and its sub-types).
162
131
163
132
Returns the total number of bytes consumed by the array.
164
133
134
+ .. c:function:: PyObject *PyArray_BASE(PyArrayObject* arr)
135
+
136
+ This returns the base object of the array. In most cases, this
137
+ means the object which owns the memory the array is pointing at.
138
+
139
+ If you are constructing an array using the C API, and specifying
140
+ your own memory, you should use the function :c:func:`PyArray_SetBaseObject`
141
+ to set the base to an object which owns the memory.
142
+
143
+ If the :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag is set, it has a different
144
+ meaning, namely base is the array into which the current array will
145
+ be copied upon copy resolution. This overloading of the base property
146
+ for two functions is likely to change in a future version of NumPy.
147
+
148
+ .. c:function:: PyArray_Descr *PyArray_DESCR(PyArrayObject* arr)
149
+
150
+ Returns a borrowed reference to the dtype property of the array.
151
+
152
+ .. c:function:: PyArray_Descr *PyArray_DTYPE(PyArrayObject* arr)
153
+
154
+ A synonym for PyArray_DESCR, named to be consistent with the
155
+ 'dtype' usage within Python.
156
+
165
157
.. c:function:: PyObject *PyArray_GETITEM(PyArrayObject* arr, void* itemptr)
166
158
167
159
Get a Python object of a builtin type from the ndarray, *arr*,
0 commit comments