summaryrefslogtreecommitdiff
path: root/doc/source/reference/c-api/array.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/reference/c-api/array.rst')
-rw-r--r--doc/source/reference/c-api/array.rst90
1 files changed, 43 insertions, 47 deletions
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst
index 3aa541b79..1673f1d6b 100644
--- a/doc/source/reference/c-api/array.rst
+++ b/doc/source/reference/c-api/array.rst
@@ -22,8 +22,8 @@ Array structure and data access
These macros access the :c:type:`PyArrayObject` structure members and are
defined in ``ndarraytypes.h``. The input argument, *arr*, can be any
-:c:type:`PyObject *<PyObject>` that is directly interpretable as a
-:c:type:`PyArrayObject *` (any instance of the :c:data:`PyArray_Type`
+:c:expr:`PyObject *` that is directly interpretable as a
+:c:expr:`PyArrayObject *` (any instance of the :c:data:`PyArray_Type`
and its sub-types).
.. c:function:: int PyArray_NDIM(PyArrayObject *arr)
@@ -825,7 +825,7 @@ General check of Python Type
Evaluates true if *op* is an instance of (a subclass of)
:c:data:`PyArray_Type` and has 0 dimensions.
-.. c:function:: PyArray_IsScalar(op, cls)
+.. c:macro:: PyArray_IsScalar(op, cls)
Evaluates true if *op* is an instance of ``Py{cls}ArrType_Type``.
@@ -864,8 +864,8 @@ Data-type checking
For the typenum macros, the argument is an integer representing an
enumerated array data type. For the array type checking macros the
-argument must be a :c:type:`PyObject *<PyObject>` that can be directly interpreted as a
-:c:type:`PyArrayObject *`.
+argument must be a :c:expr:`PyObject *` that can be directly interpreted as a
+:c:expr:`PyArrayObject *`.
.. c:function:: int PyTypeNum_ISUNSIGNED(int num)
@@ -1022,7 +1022,7 @@ argument must be a :c:type:`PyObject *<PyObject>` that can be directly interpret
.. c:function:: int PyArray_EquivByteorders(int b1, int b2)
- True if byteorder characters ( :c:data:`NPY_LITTLE`,
+ True if byteorder characters *b1* and *b2* ( :c:data:`NPY_LITTLE`,
:c:data:`NPY_BIG`, :c:data:`NPY_NATIVE`, :c:data:`NPY_IGNORE` ) are
either equal or equivalent as to their specification of a native
byte order. Thus, on a little-endian machine :c:data:`NPY_LITTLE`
@@ -2781,14 +2781,14 @@ Data-type descriptors
Data-type objects must be reference counted so be aware of the
action on the data-type reference of different C-API calls. The
standard rule is that when a data-type object is returned it is a
- new reference. Functions that take :c:type:`PyArray_Descr *` objects and
+ new reference. Functions that take :c:expr:`PyArray_Descr *` objects and
return arrays steal references to the data-type their inputs
unless otherwise noted. Therefore, you must own a reference to any
data-type object used as input to such a function.
.. c:function:: int PyArray_DescrCheck(PyObject* obj)
- Evaluates as true if *obj* is a data-type object ( :c:type:`PyArray_Descr *` ).
+ Evaluates as true if *obj* is a data-type object ( :c:expr:`PyArray_Descr *` ).
.. c:function:: PyArray_Descr* PyArray_DescrNew(PyArray_Descr* obj)
@@ -3485,10 +3485,6 @@ Miscellaneous Macros
Evaluates as True if arrays *a1* and *a2* have the same shape.
-.. c:var:: a
-
-.. c:var:: b
-
.. c:macro:: PyArray_MAX(a,b)
Returns the maximum of *a* and *b*. If (*a*) or (*b*) are
@@ -3547,22 +3543,22 @@ Miscellaneous Macros
Enumerated Types
^^^^^^^^^^^^^^^^
-.. c:type:: NPY_SORTKIND
+.. c:enum:: NPY_SORTKIND
A special variable-type which can take on different values to indicate
the sorting algorithm being used.
- .. c:var:: NPY_QUICKSORT
+ .. c:enumerator:: NPY_QUICKSORT
- .. c:var:: NPY_HEAPSORT
+ .. c:enumerator:: NPY_HEAPSORT
- .. c:var:: NPY_MERGESORT
+ .. c:enumerator:: NPY_MERGESORT
- .. c:var:: NPY_STABLESORT
+ .. c:enumerator:: NPY_STABLESORT
Used as an alias of :c:data:`NPY_MERGESORT` and vica versa.
- .. c:var:: NPY_NSORTS
+ .. c:enumerator:: NPY_NSORTS
Defined to be the number of sorts. It is fixed at three by the need for
backwards compatibility, and consequently :c:data:`NPY_MERGESORT` and
@@ -3570,90 +3566,90 @@ Enumerated Types
of several stable sorting algorithms depending on the data type.
-.. c:type:: NPY_SCALARKIND
+.. c:enum:: NPY_SCALARKIND
A special variable type indicating the number of "kinds" of
scalars distinguished in determining scalar-coercion rules. This
variable can take on the values:
- .. c:var:: NPY_NOSCALAR
+ .. c:enumerator:: NPY_NOSCALAR
- .. c:var:: NPY_BOOL_SCALAR
+ .. c:enumerator:: NPY_BOOL_SCALAR
- .. c:var:: NPY_INTPOS_SCALAR
+ .. c:enumerator:: NPY_INTPOS_SCALAR
- .. c:var:: NPY_INTNEG_SCALAR
+ .. c:enumerator:: NPY_INTNEG_SCALAR
- .. c:var:: NPY_FLOAT_SCALAR
+ .. c:enumerator:: NPY_FLOAT_SCALAR
- .. c:var:: NPY_COMPLEX_SCALAR
+ .. c:enumerator:: NPY_COMPLEX_SCALAR
- .. c:var:: NPY_OBJECT_SCALAR
+ .. c:enumerator:: NPY_OBJECT_SCALAR
- .. c:var:: NPY_NSCALARKINDS
+ .. c:enumerator:: NPY_NSCALARKINDS
Defined to be the number of scalar kinds
(not including :c:data:`NPY_NOSCALAR`).
-.. c:type:: NPY_ORDER
+.. c:enum:: NPY_ORDER
An enumeration type indicating the element order that an array should be
interpreted in. When a brand new array is created, generally
only **NPY_CORDER** and **NPY_FORTRANORDER** are used, whereas
when one or more inputs are provided, the order can be based on them.
- .. c:var:: NPY_ANYORDER
+ .. c:enumerator:: NPY_ANYORDER
Fortran order if all the inputs are Fortran, C otherwise.
- .. c:var:: NPY_CORDER
+ .. c:enumerator:: NPY_CORDER
C order.
- .. c:var:: NPY_FORTRANORDER
+ .. c:enumerator:: NPY_FORTRANORDER
Fortran order.
- .. c:var:: NPY_KEEPORDER
+ .. c:enumerator:: NPY_KEEPORDER
An order as close to the order of the inputs as possible, even
if the input is in neither C nor Fortran order.
-.. c:type:: NPY_CLIPMODE
+.. c:enum:: NPY_CLIPMODE
A variable type indicating the kind of clipping that should be
applied in certain functions.
- .. c:var:: NPY_RAISE
+ .. c:enumerator:: NPY_RAISE
The default for most operations, raises an exception if an index
is out of bounds.
- .. c:var:: NPY_CLIP
+ .. c:enumerator:: NPY_CLIP
Clips an index to the valid range if it is out of bounds.
- .. c:var:: NPY_WRAP
+ .. c:enumerator:: NPY_WRAP
Wraps an index to the valid range if it is out of bounds.
-.. c:type:: NPY_SEARCHSIDE
+.. c:enum:: NPY_SEARCHSIDE
A variable type indicating whether the index returned should be that of
the first suitable location (if :c:data:`NPY_SEARCHLEFT`) or of the last
(if :c:data:`NPY_SEARCHRIGHT`).
- .. c:var:: NPY_SEARCHLEFT
+ .. c:enumerator:: NPY_SEARCHLEFT
- .. c:var:: NPY_SEARCHRIGHT
+ .. c:enumerator:: NPY_SEARCHRIGHT
-.. c:type:: NPY_SELECTKIND
+.. c:enum:: NPY_SELECTKIND
A variable type indicating the selection algorithm being used.
- .. c:var:: NPY_INTROSELECT
+ .. c:enumerator:: NPY_INTROSELECT
-.. c:type:: NPY_CASTING
+.. c:enum:: NPY_CASTING
.. versionadded:: 1.6
@@ -3661,25 +3657,25 @@ Enumerated Types
be. This is used by the iterator added in NumPy 1.6, and is intended
to be used more broadly in a future version.
- .. c:var:: NPY_NO_CASTING
+ .. c:enumerator:: NPY_NO_CASTING
Only allow identical types.
- .. c:var:: NPY_EQUIV_CASTING
+ .. c:enumerator:: NPY_EQUIV_CASTING
Allow identical and casts involving byte swapping.
- .. c:var:: NPY_SAFE_CASTING
+ .. c:enumerator:: NPY_SAFE_CASTING
Only allow casts which will not cause values to be rounded,
truncated, or otherwise changed.
- .. c:var:: NPY_SAME_KIND_CASTING
+ .. c:enumerator:: NPY_SAME_KIND_CASTING
Allow any safe casts, and casts between types of the same kind.
For example, float64 -> float32 is permitted with this rule.
- .. c:var:: NPY_UNSAFE_CASTING
+ .. c:enumerator:: NPY_UNSAFE_CASTING
Allow any cast, no matter what kind of data loss may occur.