diff options
author | Michael Seifert <michaelseifert04@yahoo.de> | 2017-03-28 01:02:44 +0200 |
---|---|---|
committer | Michael Seifert <michaelseifert04@yahoo.de> | 2017-03-28 01:31:10 +0200 |
commit | 5b0e3aa11ac5ae7b16ae6c2d72bb5624d3c124bc (patch) | |
tree | 895c5d8df8527dc892b0b3a9985d839b121e856c /doc/source/reference/c-api.array.rst | |
parent | 0a1697f7802d864d5e417d913bfe1c9cd6740268 (diff) | |
download | numpy-5b0e3aa11ac5ae7b16ae6c2d72bb5624d3c124bc.tar.gz |
DOC: Unwrap long signature lines
[skip ci]
Diffstat (limited to 'doc/source/reference/c-api.array.rst')
-rw-r--r-- | doc/source/reference/c-api.array.rst | 331 |
1 files changed, 228 insertions, 103 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst index d75faf5dd..f559ddd68 100644 --- a/doc/source/reference/c-api.array.rst +++ b/doc/source/reference/c-api.array.rst @@ -124,7 +124,8 @@ sub-types). Get a Python object from the ndarray, *arr*, at the location pointed to by itemptr. Return ``NULL`` on failure. -.. c:function:: int PyArray_SETITEM(PyArrayObject* arr, void* itemptr, PyObject* obj) +.. c:function:: int PyArray_SETITEM( \ + PyArrayObject* arr, void* itemptr, PyObject* obj) Convert obj and place it in the ndarray, *arr*, at the place pointed to by itemptr. Return -1 if an error occurs or 0 on @@ -170,11 +171,14 @@ with misaligned data. .. c:function:: void* PyArray_GETPTR1(PyArrayObject* obj, npy_intp i) -.. c:function:: void* PyArray_GETPTR2(PyArrayObject* obj, npy_intp i, npy_intp j) +.. c:function:: void* PyArray_GETPTR2( \ + PyArrayObject* obj, npy_intp i, npy_intp j) -.. c:function:: void* PyArray_GETPTR3(PyArrayObject* obj, npy_intp i, npy_intp j, npy_intp k) +.. c:function:: void* PyArray_GETPTR3( \ + PyArrayObject* obj, npy_intp i, npy_intp j, npy_intp k) -.. c:function:: void* PyArray_GETPTR4(PyArrayObject* obj, npy_intp i, npy_intp j, npy_intp k, npy_intp l) +.. c:function:: void* PyArray_GETPTR4( \ + PyArrayObject* obj, npy_intp i, npy_intp j, npy_intp k, npy_intp l) Quick, inline access to the element at the given coordinates in the ndarray, *obj*, which must have respectively 1, 2, 3, or 4 @@ -191,7 +195,9 @@ Creating arrays From scratch ^^^^^^^^^^^^ -.. c:function:: PyObject* PyArray_NewFromDescr(PyTypeObject* subtype, PyArray_Descr* descr, int nd, npy_intp* dims, npy_intp* strides, void* data, int flags, PyObject* obj) +.. c:function:: PyObject* PyArray_NewFromDescr( \ + PyTypeObject* subtype, PyArray_Descr* descr, int nd, npy_intp* dims, \ + npy_intp* strides, void* data, int flags, PyObject* obj) This function steals a reference to *descr*. @@ -223,7 +229,9 @@ From scratch provided *dims* and *strides* are copied into newly allocated dimension and strides arrays for the new array object. -.. c:function:: PyObject* PyArray_NewLikeArray(PyArrayObject* prototype, NPY_ORDER order, PyArray_Descr* descr, int subok) +.. c:function:: PyObject* PyArray_NewLikeArray( \ + PyArrayObject* prototype, NPY_ORDER order, PyArray_Descr* descr, \ + int subok) .. versionadded:: 1.6 @@ -245,7 +253,9 @@ From scratch *prototype* to create the new array, otherwise it will create a base-class array. -.. c:function:: PyObject* PyArray_New(PyTypeObject* subtype, int nd, npy_intp* dims, int type_num, npy_intp* strides, void* data, int itemsize, int flags, PyObject* obj) +.. c:function:: PyObject* PyArray_New( \ + PyTypeObject* subtype, int nd, npy_intp* dims, int type_num, \ + npy_intp* strides, void* data, int itemsize, int flags, PyObject* obj) This is similar to :c:func:`PyArray_DescrNew` (...) except you specify the data-type descriptor with *type_num* and *itemsize*, @@ -273,7 +283,8 @@ From scratch This function cannot be used to create a flexible-type array (no itemsize given). -.. c:function:: PyObject* PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data) +.. c:function:: PyObject* PyArray_SimpleNewFromData( \ + int nd, npy_intp* dims, int typenum, void* data) Create an array wrapper around *data* pointed to by the given pointer. The array flags will have a default that the data area is @@ -281,7 +292,8 @@ From scratch given by the *dims* c-array of length *nd*. The data-type of the array is indicated by *typenum*. -.. c:function:: PyObject* PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, PyArray_Descr* descr) +.. c:function:: PyObject* PyArray_SimpleNewFromDescr( \ + int nd, npy_intp* dims, PyArray_Descr* descr) This function steals a reference to *descr* if it is not NULL. @@ -294,7 +306,8 @@ From scratch of) bigndarray---with the contents of *val* (evaluated as a byte). This macro calls memset, so obj must be contiguous. -.. c:function:: PyObject* PyArray_Zeros(int nd, npy_intp* dims, PyArray_Descr* dtype, int fortran) +.. c:function:: PyObject* PyArray_Zeros( \ + int nd, npy_intp* dims, PyArray_Descr* dtype, int fortran) Construct a new *nd* -dimensional array with shape given by *dims* and data type given by *dtype*. If *fortran* is non-zero, then a @@ -302,12 +315,14 @@ From scratch created. Fill the memory with zeros (or the 0 object if *dtype* corresponds to :c:type:`NPY_OBJECT` ). -.. c:function:: PyObject* PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran) +.. c:function:: PyObject* PyArray_ZEROS( \ + int nd, npy_intp* dims, int type_num, int fortran) Macro form of :c:func:`PyArray_Zeros` which takes a type-number instead of a data-type object. -.. c:function:: PyObject* PyArray_Empty(int nd, npy_intp* dims, PyArray_Descr* dtype, int fortran) +.. c:function:: PyObject* PyArray_Empty( \ + int nd, npy_intp* dims, PyArray_Descr* dtype, int fortran) Construct a new *nd* -dimensional array with shape given by *dims* and data type given by *dtype*. If *fortran* is non-zero, then a @@ -316,18 +331,21 @@ From scratch corresponds to :c:type:`NPY_OBJECT` in which case the array is filled with :c:data:`Py_None`. -.. c:function:: PyObject* PyArray_EMPTY(int nd, npy_intp* dims, int typenum, int fortran) +.. c:function:: PyObject* PyArray_EMPTY( \ + int nd, npy_intp* dims, int typenum, int fortran) Macro form of :c:func:`PyArray_Empty` which takes a type-number, *typenum*, instead of a data-type object. -.. c:function:: PyObject* PyArray_Arange(double start, double stop, double step, int typenum) +.. c:function:: PyObject* PyArray_Arange( \ + double start, double stop, double step, int typenum) Construct a new 1-dimensional array of data-type, *typenum*, that ranges from *start* to *stop* (exclusive) in increments of *step* . Equivalent to **arange** (*start*, *stop*, *step*, dtype). -.. c:function:: PyObject* PyArray_ArangeObj(PyObject* start, PyObject* stop, PyObject* step, PyArray_Descr* descr) +.. c:function:: PyObject* PyArray_ArangeObj( \ + PyObject* start, PyObject* stop, PyObject* step, PyArray_Descr* descr) Construct a new 1-dimensional array of data-type determined by ``descr``, that ranges from ``start`` to ``stop`` (exclusive) in @@ -355,7 +373,9 @@ From scratch From other objects ^^^^^^^^^^^^^^^^^^ -.. c:function:: PyObject* PyArray_FromAny(PyObject* op, PyArray_Descr* dtype, int min_depth, int max_depth, int requirements, PyObject* context) +.. c:function:: PyObject* PyArray_FromAny( \ + PyObject* op, PyArray_Descr* dtype, int min_depth, int max_depth, \ + int requirements, PyObject* context) This is the main function used to obtain an array from any nested sequence, or object that exposes the array interface, *op*. The @@ -489,7 +509,10 @@ From other objects :c:data:`NPY_ARRAY_F_CONTIGUOUS` \| :c:data:`NPY_ARRAY_WRITEABLE` \| :c:data:`NPY_ARRAY_ALIGNED` \| :c:data:`NPY_ARRAY_UPDATEIFCOPY` -.. c:function:: int PyArray_GetArrayParamsFromObject(PyObject* op, PyArray_Descr* requested_dtype, npy_bool writeable, PyArray_Descr** out_dtype, int* out_ndim, npy_intp* out_dims, PyArrayObject** out_arr, PyObject* context) +.. c:function:: int PyArray_GetArrayParamsFromObject( \ + PyObject* op, PyArray_Descr* requested_dtype, npy_bool writeable, \ + PyArray_Descr** out_dtype, int* out_ndim, npy_intp* out_dims, \ + PyArrayObject** out_arr, PyObject* context) .. versionadded:: 1.6 @@ -552,7 +575,9 @@ From other objects } ... use arr ... -.. c:function:: PyObject* PyArray_CheckFromAny(PyObject* op, PyArray_Descr* dtype, int min_depth, int max_depth, int requirements, PyObject* context) +.. c:function:: PyObject* PyArray_CheckFromAny( \ + PyObject* op, PyArray_Descr* dtype, int min_depth, int max_depth, \ + int requirements, PyObject* context) Nearly identical to :c:func:`PyArray_FromAny` (...) except *requirements* can contain :c:data:`NPY_ARRAY_NOTSWAPPED` (over-riding the @@ -584,7 +609,8 @@ From other objects Make sure the returned array has strides that are multiples of the element size. -.. c:function:: PyObject* PyArray_FromArray(PyArrayObject* op, PyArray_Descr* newtype, int requirements) +.. c:function:: PyObject* PyArray_FromArray( \ + PyArrayObject* op, PyArray_Descr* newtype, int requirements) Special case of :c:func:`PyArray_FromAny` for when *op* is already an array but it needs to be of a specific *newtype* (including @@ -604,7 +630,8 @@ From other objects protocol. If the object does not contain this attribute then a borrowed reference to :c:data:`Py_NotImplemented` is returned. -.. c:function:: PyObject* PyArray_FromArrayAttr(PyObject* op, PyArray_Descr* dtype, PyObject* context) +.. c:function:: PyObject* PyArray_FromArrayAttr( \ + PyObject* op, PyArray_Descr* dtype, PyObject* context) Return an ndarray object from a Python object that exposes the :obj:`~numpy.class.__array__` method. The :obj:`~numpy.class.__array__` method can take 0, 1, or 2 @@ -612,7 +639,8 @@ From other objects information about where the :obj:`~numpy.class.__array__` method is being called from (currently only used in ufuncs). -.. c:function:: PyObject* PyArray_ContiguousFromAny(PyObject* op, int typenum, int min_depth, int max_depth) +.. c:function:: PyObject* PyArray_ContiguousFromAny( \ + PyObject* op, int typenum, int min_depth, int max_depth) This function returns a (C-style) contiguous and behaved function array from any nested sequence or array interface exporting @@ -622,7 +650,8 @@ From other objects requirements set to :c:data:`NPY_DEFAULT` and the type_num member of the type argument set to *typenum*. -.. c:function:: PyObject *PyArray_FromObject(PyObject *op, int typenum, int min_depth, int max_depth) +.. c:function:: PyObject *PyArray_FromObject( \ + PyObject *op, int typenum, int min_depth, int max_depth) Return an aligned and in native-byteorder array from any nested sequence or array-interface exporting object, op, of a type given by @@ -638,7 +667,9 @@ From other objects but otherwise calls :c:func:`PyArray_FromAny` ( ``op``, NULL, 0, 0, :c:data:`NPY_ARRAY_ENSUREARRAY`). -.. c:function:: PyObject* PyArray_FromString(char* string, npy_intp slen, PyArray_Descr* dtype, npy_intp num, char* sep) +.. c:function:: PyObject* PyArray_FromString( \ + char* string, npy_intp slen, PyArray_Descr* dtype, npy_intp num, \ + char* sep) Construct a one-dimensional ndarray of a single type from a binary or (ASCII) text ``string`` of length ``slen``. The data-type of @@ -651,7 +682,8 @@ From other objects data-types may not be readable in text mode and an error will be raised if that occurs. All errors return NULL. -.. c:function:: PyObject* PyArray_FromFile(FILE* fp, PyArray_Descr* dtype, npy_intp num, char* sep) +.. c:function:: PyObject* PyArray_FromFile( \ + FILE* fp, PyArray_Descr* dtype, npy_intp num, char* sep) Construct a one-dimensional ndarray of a single type from a binary or text file. The open file pointer is ``fp``, the data-type of @@ -664,7 +696,8 @@ From other objects separator. Some array types cannot be read in text mode in which case an error is raised. -.. c:function:: PyObject* PyArray_FromBuffer(PyObject* buf, PyArray_Descr* dtype, npy_intp count, npy_intp offset) +.. c:function:: PyObject* PyArray_FromBuffer( \ + PyObject* buf, PyArray_Descr* dtype, npy_intp count, npy_intp offset) Construct a one-dimensional ndarray of a single type from an object, ``buf``, that exports the (single-segment) buffer protocol @@ -728,12 +761,14 @@ From other objects Similar to :c:func:`PyArray_FROM_O` except it can take an argument of *typenum* specifying the type-number the returned array. -.. c:function:: PyObject* PyArray_FROM_OTF(PyObject* obj, int typenum, int requirements) +.. c:function:: PyObject* PyArray_FROM_OTF( \ + PyObject* obj, int typenum, int requirements) Combination of :c:func:`PyArray_FROM_OF` and :c:func:`PyArray_FROM_OT` allowing both a *typenum* and a *flags* argument to be provided.. -.. c:function:: PyObject* PyArray_FROMANY(PyObject* obj, int typenum, int min, int max, int requirements) +.. c:function:: PyObject* PyArray_FROMANY( \ + PyObject* obj, int typenum, int min, int max, int requirements) Similar to :c:func:`PyArray_FromAny` except the data-type is specified using a typenumber. :c:func:`PyArray_DescrFromType` @@ -741,7 +776,8 @@ From other objects macro also adds :c:data:`NPY_DEFAULT` to requirements if :c:data:`NPY_ARRAY_ENSURECOPY` is passed in as requirements. -.. c:function:: PyObject *PyArray_CheckAxis(PyObject* obj, int* axis, int requirements) +.. c:function:: PyObject *PyArray_CheckAxis( \ + PyObject* obj, int* axis, int requirements) Encapsulate the functionality of functions and methods that take the axis= keyword and work properly with None as the axis @@ -959,7 +995,8 @@ argument must be a :c:type:`PyObject *<PyObject>` that can be directly interpret Evaluates true if the data area of the ndarray *m* is **not** in machine byte-order according to the array's data-type descriptor. -.. c:function:: Bool PyArray_EquivTypes(PyArray_Descr* type1, PyArray_Descr* type2) +.. c:function:: Bool PyArray_EquivTypes( \ + PyArray_Descr* type1, PyArray_Descr* type2) Return :c:data:`NPY_TRUE` if *type1* and *type2* actually represent equivalent types for this platform (the fortran member of each @@ -967,7 +1004,8 @@ argument must be a :c:type:`PyObject *<PyObject>` that can be directly interpret :c:data:`NPY_LONG` and :c:data:`NPY_INT` are equivalent. Otherwise return :c:data:`NPY_FALSE`. -.. c:function:: Bool PyArray_EquivArrTypes(PyArrayObject* a1, PyArrayObject * a2) +.. c:function:: Bool PyArray_EquivArrTypes( \ + PyArrayObject* a1, PyArrayObject * a2) Return :c:data:`NPY_TRUE` if *a1* and *a2* are arrays with equivalent types for this platform. @@ -997,7 +1035,8 @@ Converting data types the elements of *arr* cast to the data-type *typenum* which must be one of the enumerated types and not a flexible type. -.. c:function:: PyObject* PyArray_CastToType(PyArrayObject* arr, PyArray_Descr* type, int fortran) +.. c:function:: PyObject* PyArray_CastToType( \ + PyArrayObject* arr, PyArray_Descr* type, int fortran) Return a new array of the *type* specified, casting the elements of *arr* as appropriate. The fortran argument specifies the @@ -1014,7 +1053,8 @@ Converting data types placed in out), and have a data type that is one of the builtin types. Returns 0 on success and -1 if an error occurs. -.. c:function:: PyArray_VectorUnaryFunc* PyArray_GetCastFunc(PyArray_Descr* from, int totype) +.. c:function:: PyArray_VectorUnaryFunc* PyArray_GetCastFunc( \ + PyArray_Descr* from, int totype) Return the low-level casting function to cast from the given descriptor to the builtin type number. If no casting function @@ -1033,14 +1073,16 @@ Converting data types explicit requests. Flexible array types are not checked according to their lengths with this function. -.. c:function:: int PyArray_CanCastTo(PyArray_Descr* fromtype, PyArray_Descr* totype) +.. c:function:: int PyArray_CanCastTo( \ + PyArray_Descr* fromtype, PyArray_Descr* totype) :c:func:`PyArray_CanCastTypeTo` supersedes this function in NumPy 1.6 and later. Equivalent to PyArray_CanCastTypeTo(fromtype, totype, NPY_SAFE_CASTING). -.. c:function:: int PyArray_CanCastTypeTo(PyArray_Descr* fromtype, PyArray_Descr* totype, NPY_CASTING casting) +.. c:function:: int PyArray_CanCastTypeTo( \ + PyArray_Descr* fromtype, PyArray_Descr* totype, NPY_CASTING casting) .. versionadded:: 1.6 @@ -1055,7 +1097,8 @@ Converting data types or unicode type is big enough to hold the max value of the integer/float type being cast from. -.. c:function:: int PyArray_CanCastArrayTo(PyArrayObject* arr, PyArray_Descr* totype, NPY_CASTING casting) +.. c:function:: int PyArray_CanCastArrayTo( \ + PyArrayObject* arr, PyArray_Descr* totype, NPY_CASTING casting) .. versionadded:: 1.6 @@ -1084,7 +1127,8 @@ Converting data types boolean, but will demote a signed integer to an unsigned integer when the scalar value is positive. -.. c:function:: PyArray_Descr* PyArray_PromoteTypes(PyArray_Descr* type1, PyArray_Descr* type2) +.. c:function:: PyArray_Descr* PyArray_PromoteTypes( \ + PyArray_Descr* type1, PyArray_Descr* type2) .. versionadded:: 1.6 @@ -1093,7 +1137,9 @@ Converting data types associative. A string or unicode result will be the proper size for storing the max value of the input types converted to a string or unicode. -.. c:function:: PyArray_Descr* PyArray_ResultType(npy_intp narrs, PyArrayObject**arrs, npy_intp ndtypes, PyArray_Descr**dtypes) +.. c:function:: PyArray_Descr* PyArray_ResultType( \ + npy_intp narrs, PyArrayObject**arrs, npy_intp ndtypes, \ + PyArray_Descr**dtypes) .. versionadded:: 1.6 @@ -1134,7 +1180,8 @@ Converting data types return value is the enumerated typenumber that represents the data-type that *op* should have. -.. c:function:: void PyArray_ArrayType(PyObject* op, PyArray_Descr* mintype, PyArray_Descr* outtype) +.. c:function:: void PyArray_ArrayType( \ + PyObject* op, PyArray_Descr* mintype, PyArray_Descr* outtype) This function is superceded by :c:func:`PyArray_ResultType`. @@ -1144,7 +1191,8 @@ Converting data types itemsize member at least as big but perhaps bigger depending on the object *op*. -.. c:function:: PyArrayObject** PyArray_ConvertToCommonType(PyObject* op, int* n) +.. c:function:: PyArrayObject** PyArray_ConvertToCommonType( \ + PyObject* op, int* n) The functionality this provides is largely superceded by iterator :c:type:`NpyIter` introduced in 1.6, with flag @@ -1221,14 +1269,16 @@ New data types registered (checked only by the address of the pointer), then return the previously-assigned type-number. -.. c:function:: int PyArray_RegisterCastFunc(PyArray_Descr* descr, int totype, PyArray_VectorUnaryFunc* castfunc) +.. c:function:: int PyArray_RegisterCastFunc( \ + PyArray_Descr* descr, int totype, PyArray_VectorUnaryFunc* castfunc) Register a low-level casting function, *castfunc*, to convert from the data-type, *descr*, to the given data-type number, *totype*. Any old casting function is over-written. A ``0`` is returned on success or a ``-1`` on failure. -.. c:function:: int PyArray_RegisterCanCast(PyArray_Descr* descr, int totype, NPY_SCALARKIND scalar) +.. c:function:: int PyArray_RegisterCanCast( \ + PyArray_Descr* descr, int totype, NPY_SCALARKIND scalar) Register the data-type number, *totype*, as castable from data-type object, *descr*, of the given *scalar* kind. Use @@ -1543,7 +1593,8 @@ Array method alternative API Conversion ^^^^^^^^^^ -.. c:function:: PyObject* PyArray_GetField(PyArrayObject* self, PyArray_Descr* dtype, int offset) +.. c:function:: PyObject* PyArray_GetField( \ + PyArrayObject* self, PyArray_Descr* dtype, int offset) Equivalent to :meth:`ndarray.getfield<numpy.ndarray.getfield>` (*self*, *dtype*, *offset*). Return a new array of the given *dtype* using the data in the current @@ -1555,7 +1606,8 @@ Conversion be used to select specific bytes or groups of bytes from any array type. -.. c:function:: int PyArray_SetField(PyArrayObject* self, PyArray_Descr* dtype, int offset, PyObject* val) +.. c:function:: int PyArray_SetField( \ + PyArrayObject* self, PyArray_Descr* dtype, int offset, PyObject* val) Equivalent to :meth:`ndarray.setfield<numpy.ndarray.setfield>` (*self*, *val*, *dtype*, *offset* ). Set the field starting at *offset* in bytes and of the given @@ -1595,7 +1647,8 @@ Conversion Equivalent to :meth:`ndarray.tobytes<numpy.ndarray.tobytes>` (*self*, *order*). Return the bytes of this array in a Python string. -.. c:function:: PyObject* PyArray_ToFile(PyArrayObject* self, FILE* fp, char* sep, char* format) +.. c:function:: PyObject* PyArray_ToFile( \ + PyArrayObject* self, FILE* fp, char* sep, char* format) Write the contents of *self* to the file pointer *fp* in C-style contiguous fashion. Write the data as binary bytes if *sep* is the @@ -1627,7 +1680,8 @@ Conversion copied into every location. A -1 is returned if an error occurs, otherwise 0 is returned. -.. c:function:: PyObject* PyArray_View(PyArrayObject* self, PyArray_Descr* dtype, PyTypeObject *ptype) +.. c:function:: PyObject* PyArray_View( \ + PyArrayObject* self, PyArray_Descr* dtype, PyTypeObject *ptype) Equivalent to :meth:`ndarray.view<numpy.ndarray.view>` (*self*, *dtype*). Return a new view of the array *self* as possibly a different data-type, *dtype*, @@ -1646,7 +1700,8 @@ Conversion Shape Manipulation ^^^^^^^^^^^^^^^^^^ -.. c:function:: PyObject* PyArray_Newshape(PyArrayObject* self, PyArray_Dims* newshape, NPY_ORDER order) +.. c:function:: PyObject* PyArray_Newshape( \ + PyArrayObject* self, PyArray_Dims* newshape, NPY_ORDER order) Result will be a new array (pointing to the same memory location as *self* if possible), but having a shape given by *newshape*. @@ -1677,7 +1732,9 @@ Shape Manipulation array is a new view of the data in *self* with the given axes, *a1* and *a2*, swapped. -.. c:function:: PyObject* PyArray_Resize(PyArrayObject* self, PyArray_Dims* newshape, int refcheck, NPY_ORDER fortran) +.. c:function:: PyObject* PyArray_Resize( \ + PyArrayObject* self, PyArray_Dims* newshape, int refcheck, \ + NPY_ORDER fortran) Equivalent to :meth:`ndarray.resize<numpy.ndarray.resize>` (*self*, *newshape*, refcheck ``=`` *refcheck*, order= fortran ). This function only works on @@ -1693,7 +1750,8 @@ Shape Manipulation the data when constructing a differently-dimensioned array. Returns None on success and NULL on error. -.. c:function:: PyObject* PyArray_Transpose(PyArrayObject* self, PyArray_Dims* permute) +.. c:function:: PyObject* PyArray_Transpose( \ + PyArrayObject* self, PyArray_Dims* permute) Equivalent to :meth:`ndarray.transpose<numpy.ndarray.transpose>` (*self*, *permute*). Permute the axes of the ndarray object *self* according to the data structure @@ -1726,7 +1784,9 @@ Shape Manipulation Item selection and manipulation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. c:function:: PyObject* PyArray_TakeFrom(PyArrayObject* self, PyObject* indices, int axis, PyArrayObject* ret, NPY_CLIPMODE clipmode) +.. c:function:: PyObject* PyArray_TakeFrom( \ + PyArrayObject* self, PyObject* indices, int axis, PyArrayObject* ret, \ + NPY_CLIPMODE clipmode) Equivalent to :meth:`ndarray.take<numpy.ndarray.take>` (*self*, *indices*, *axis*, *ret*, *clipmode*) except *axis* =None in Python is obtained by setting @@ -1737,21 +1797,25 @@ Item selection and manipulation *ret* argument can specify an output array rather than having one created internally. -.. c:function:: PyObject* PyArray_PutTo(PyArrayObject* self, PyObject* values, PyObject* indices, NPY_CLIPMODE clipmode) +.. c:function:: PyObject* PyArray_PutTo( \ + PyArrayObject* self, PyObject* values, PyObject* indices, \ + NPY_CLIPMODE clipmode) Equivalent to *self*.put(*values*, *indices*, *clipmode* ). Put *values* into *self* at the corresponding (flattened) *indices*. If *values* is too small it will be repeated as necessary. -.. c:function:: PyObject* PyArray_PutMask(PyArrayObject* self, PyObject* values, PyObject* mask) +.. c:function:: PyObject* PyArray_PutMask( \ + PyArrayObject* self, PyObject* values, PyObject* mask) Place the *values* in *self* wherever corresponding positions (using a flattened context) in *mask* are true. The *mask* and *self* arrays must have the same total number of elements. If *values* is too small, it will be repeated as necessary. -.. c:function:: PyObject* PyArray_Repeat(PyArrayObject* self, PyObject* op, int axis) +.. c:function:: PyObject* PyArray_Repeat( \ + PyArrayObject* self, PyObject* op, int axis) Equivalent to :meth:`ndarray.repeat<numpy.ndarray.repeat>` (*self*, *op*, *axis*). Copy the elements of *self*, *op* times along the given *axis*. Either @@ -1759,7 +1823,9 @@ Item selection and manipulation ->dimensions[ *axis* ] indicating how many times to repeat each item along the axis. -.. c:function:: PyObject* PyArray_Choose(PyArrayObject* self, PyObject* op, PyArrayObject* ret, NPY_CLIPMODE clipmode) +.. c:function:: PyObject* PyArray_Choose( \ + PyArrayObject* self, PyObject* op, PyArrayObject* ret, \ + NPY_CLIPMODE clipmode) Equivalent to :meth:`ndarray.choose<numpy.ndarray.choose>` (*self*, *op*, *ret*, *clipmode*). Create a new array by selecting elements from the sequence of @@ -1820,7 +1886,9 @@ Item selection and manipulation :c:func:`PyArray_Sort` (...) can also be used to sort the array directly. -.. c:function:: PyObject* PyArray_SearchSorted(PyArrayObject* self, PyObject* values, NPY_SEARCHSIDE side, PyObject* perm) +.. c:function:: PyObject* PyArray_SearchSorted( \ + PyArrayObject* self, PyObject* values, NPY_SEARCHSIDE side, \ + PyObject* perm) Equivalent to :meth:`ndarray.searchsorted<numpy.ndarray.searchsorted>` (*self*, *values*, *side*, *perm*). Assuming *self* is a 1-d array in ascending order, then the @@ -1838,7 +1906,9 @@ Item selection and manipulation This is typically the result of a call to :c:func:`PyArray_ArgSort` (...) Binary search is used to find the required insertion points. -.. c:function:: int PyArray_Partition(PyArrayObject *self, PyArrayObject * ktharray, int axis, NPY_SELECTKIND which) +.. c:function:: int PyArray_Partition( \ + PyArrayObject *self, PyArrayObject * ktharray, int axis, \ + NPY_SELECTKIND which) Equivalent to :meth:`ndarray.partition<numpy.ndarray.partition>` (*self*, *ktharray*, *axis*, *kind*). Partitions the array so that the values of the element indexed by @@ -1853,13 +1923,16 @@ Item selection and manipulation order of names and construct a view of the array with that new data-type. Returns zero on success and -1 on failure. -.. c:function:: PyObject* PyArray_ArgPartition(PyArrayObject *op, PyArrayObject * ktharray, int axis, NPY_SELECTKIND which) +.. c:function:: PyObject* PyArray_ArgPartition( \ + PyArrayObject *op, PyArrayObject * ktharray, int axis, \ + NPY_SELECTKIND which) Equivalent to :meth:`ndarray.argpartition<numpy.ndarray.argpartition>` (*self*, *ktharray*, *axis*, *kind*). Return an array of indices such that selection of these indices along the given ``axis`` would return a partitioned version of *self*. -.. c:function:: PyObject* PyArray_Diagonal(PyArrayObject* self, int offset, int axis1, int axis2) +.. c:function:: PyObject* PyArray_Diagonal( \ + PyArrayObject* self, int offset, int axis1, int axis2) Equivalent to :meth:`ndarray.diagonal<numpy.ndarray.diagonal>` (*self*, *offset*, *axis1*, *axis2* ). Return the *offset* diagonals of the 2-d arrays defined by @@ -1879,7 +1952,8 @@ Item selection and manipulation returned. The index arrays have data type :c:data:`NPY_INTP`. If a tuple is returned (nd :math:`\neq` 1), then its length is nd. -.. c:function:: PyObject* PyArray_Compress(PyArrayObject* self, PyObject* condition, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Compress( \ + PyArrayObject* self, PyObject* condition, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.compress<numpy.ndarray.compress>` (*self*, *condition*, *axis* ). Return the elements along *axis* corresponding to elements of @@ -1895,12 +1969,14 @@ Calculation effect that is obtained by passing in *axis* = :const:`None` in Python (treating the array as a 1-d array). -.. c:function:: PyObject* PyArray_ArgMax(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_ArgMax( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.argmax<numpy.ndarray.argmax>` (*self*, *axis*). Return the index of the largest element of *self* along *axis*. -.. c:function:: PyObject* PyArray_ArgMin(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_ArgMin( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.argmin<numpy.ndarray.argmin>` (*self*, *axis*). Return the index of the smallest element of *self* along *axis*. @@ -1917,20 +1993,23 @@ Calculation is not NULL. The caller of the routine has the responsibility to ``DECREF`` out if not NULL or a memory-leak will occur. -.. c:function:: PyObject* PyArray_Max(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Max( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.max<numpy.ndarray.max>` (*self*, *axis*). Returns the largest element of *self* along the given *axis*. When the result is a single element, returns a numpy scalar instead of an ndarray. -.. c:function:: PyObject* PyArray_Min(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Min( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.min<numpy.ndarray.min>` (*self*, *axis*). Return the smallest element of *self* along the given *axis*. When the result is a single element, returns a numpy scalar instead of an ndarray. -.. c:function:: PyObject* PyArray_Ptp(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Ptp( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.ptp<numpy.ndarray.ptp>` (*self*, *axis*). Return the difference between the largest element of *self* along *axis* and the @@ -1949,14 +2028,17 @@ Calculation for the "add" and "multiply" ufuncs (which form the basis for mean, sum, cumsum, prod, and cumprod functions). -.. c:function:: PyObject* PyArray_Mean(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Mean( \ + PyArrayObject* self, int axis, int rtype, PyArrayObject* out) Equivalent to :meth:`ndarray.mean<numpy.ndarray.mean>` (*self*, *axis*, *rtype*). Returns the mean of the elements along the given *axis*, using the enumerated type *rtype* as the data type to sum in. Default sum behavior is obtained using :c:data:`NPY_NOTYPE` for *rtype*. -.. c:function:: PyObject* PyArray_Trace(PyArrayObject* self, int offset, int axis1, int axis2, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Trace( \ + PyArrayObject* self, int offset, int axis1, int axis2, int rtype, \ + PyArrayObject* out) Equivalent to :meth:`ndarray.trace<numpy.ndarray.trace>` (*self*, *offset*, *axis1*, *axis2*, *rtype*). Return the sum (using *rtype* as the data type of @@ -1965,7 +2047,8 @@ Calculation chooses diagonals above the main diagonal. A negative offset selects diagonals below the main diagonal. -.. c:function:: PyObject* PyArray_Clip(PyArrayObject* self, PyObject* min, PyObject* max) +.. c:function:: PyObject* PyArray_Clip( \ + PyArrayObject* self, PyObject* min, PyObject* max) Equivalent to :meth:`ndarray.clip<numpy.ndarray.clip>` (*self*, *min*, *max*). Clip an array, *self*, so that values larger than *max* are fixed to *max* and @@ -1977,50 +2060,58 @@ Calculation Return the complex conjugate of *self*. If *self* is not of complex data type, then return *self* with a reference. -.. c:function:: PyObject* PyArray_Round(PyArrayObject* self, int decimals, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Round( \ + PyArrayObject* self, int decimals, PyArrayObject* out) Equivalent to :meth:`ndarray.round<numpy.ndarray.round>` (*self*, *decimals*, *out*). Returns the array with elements rounded to the nearest decimal place. The decimal place is defined as the :math:`10^{-\textrm{decimals}}` digit so that negative *decimals* cause rounding to the nearest 10's, 100's, etc. If out is ``NULL``, then the output array is created, otherwise the output is placed in *out* which must be the correct size and type. -.. c:function:: PyObject* PyArray_Std(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Std( \ + PyArrayObject* self, int axis, int rtype, PyArrayObject* out) Equivalent to :meth:`ndarray.std<numpy.ndarray.std>` (*self*, *axis*, *rtype*). Return the standard deviation using data along *axis* converted to data type *rtype*. -.. c:function:: PyObject* PyArray_Sum(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Sum( \ + PyArrayObject* self, int axis, int rtype, PyArrayObject* out) Equivalent to :meth:`ndarray.sum<numpy.ndarray.sum>` (*self*, *axis*, *rtype*). Return 1-d vector sums of elements in *self* along *axis*. Perform the sum after converting data to data type *rtype*. -.. c:function:: PyObject* PyArray_CumSum(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_CumSum( \ + PyArrayObject* self, int axis, int rtype, PyArrayObject* out) Equivalent to :meth:`ndarray.cumsum<numpy.ndarray.cumsum>` (*self*, *axis*, *rtype*). Return cumulative 1-d sums of elements in *self* along *axis*. Perform the sum after converting data to data type *rtype*. -.. c:function:: PyObject* PyArray_Prod(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Prod( \ + PyArrayObject* self, int axis, int rtype, PyArrayObject* out) Equivalent to :meth:`ndarray.prod<numpy.ndarray.prod>` (*self*, *axis*, *rtype*). Return 1-d products of elements in *self* along *axis*. Perform the product after converting data to data type *rtype*. -.. c:function:: PyObject* PyArray_CumProd(PyArrayObject* self, int axis, int rtype, PyArrayObject* out) +.. c:function:: PyObject* PyArray_CumProd( \ + PyArrayObject* self, int axis, int rtype, PyArrayObject* out) Equivalent to :meth:`ndarray.cumprod<numpy.ndarray.cumprod>` (*self*, *axis*, *rtype*). Return 1-d cumulative products of elements in ``self`` along ``axis``. Perform the product after converting data to data type ``rtype``. -.. c:function:: PyObject* PyArray_All(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_All( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.all<numpy.ndarray.all>` (*self*, *axis*). Return an array with True elements for every 1-d sub-array of ``self`` defined by ``axis`` in which all the elements are True. -.. c:function:: PyObject* PyArray_Any(PyArrayObject* self, int axis, PyArrayObject* out) +.. c:function:: PyObject* PyArray_Any( \ + PyArrayObject* self, int axis, PyArrayObject* out) Equivalent to :meth:`ndarray.any<numpy.ndarray.any>` (*self*, *axis*). Return an array with True elements for every 1-d sub-array of *self* defined by *axis* @@ -2033,7 +2124,9 @@ Functions Array Functions ^^^^^^^^^^^^^^^ -.. c:function:: int PyArray_AsCArray(PyObject** op, void* ptr, npy_intp* dims, int nd, int typenum, int itemsize) +.. c:function:: int PyArray_AsCArray( \ + PyObject** op, void* ptr, npy_intp* dims, int nd, int typenum, \ + int itemsize) Sometimes it is useful to access a multidimensional array as a C-style multi-dimensional array so that algorithms can be @@ -2103,7 +2196,8 @@ Array Functions second-to-last dimension of *obj2*. For 2-d arrays this is a matrix-product. Neither array is conjugated. -.. c:function:: PyObject* PyArray_MatrixProduct2(PyObject* obj1, PyObject* obj, PyArrayObject* out) +.. c:function:: PyObject* PyArray_MatrixProduct2( \ + PyObject* obj1, PyObject* obj, PyArrayObject* out) .. versionadded:: 1.6 @@ -2111,7 +2205,10 @@ Array Functions output array must have the correct shape, type, and be C-contiguous, or an exception is raised. -.. c:function:: PyObject* PyArray_EinsteinSum(char* subscripts, npy_intp nop, PyArrayObject** op_in, PyArray_Descr* dtype, NPY_ORDER order, NPY_CASTING casting, PyArrayObject* out) +.. c:function:: PyObject* PyArray_EinsteinSum( \ + char* subscripts, npy_intp nop, PyArrayObject** op_in, \ + PyArray_Descr* dtype, NPY_ORDER order, NPY_CASTING casting, \ + PyArrayObject* out) .. versionadded:: 1.6 @@ -2131,7 +2228,8 @@ Array Functions A specialized copy and transpose function that works only for 2-d arrays. The returned array is a transposed copy of *op*. -.. c:function:: PyObject* PyArray_Correlate(PyObject* op1, PyObject* op2, int mode) +.. c:function:: PyObject* PyArray_Correlate( \ + PyObject* op1, PyObject* op2, int mode) Compute the 1-d correlation of the 1-d arrays *op1* and *op2* . The correlation is computed at each output point by multiplying @@ -2149,7 +2247,8 @@ Array Functions arguments are swapped, and the conjugate is never taken for complex arrays. See PyArray_Correlate2 for the usual signal processing correlation. -.. c:function:: PyObject* PyArray_Correlate2(PyObject* op1, PyObject* op2, int mode) +.. c:function:: PyObject* PyArray_Correlate2( \ + PyObject* op1, PyObject* op2, int mode) Updated version of PyArray_Correlate, which uses the usual definition of correlation for 1d arrays. The correlation is computed at each output point @@ -2166,7 +2265,8 @@ Array Functions z[k] = sum_n op1[n] * conj(op2[n+k]) -.. c:function:: PyObject* PyArray_Where(PyObject* condition, PyObject* x, PyObject* y) +.. c:function:: PyObject* PyArray_Where( \ + PyObject* condition, PyObject* x, PyObject* y) If both ``x`` and ``y`` are ``NULL``, then return :c:func:`PyArray_Nonzero` (*condition*). Otherwise, both *x* and *y* @@ -2178,7 +2278,9 @@ Array Functions Other functions ^^^^^^^^^^^^^^^ -.. c:function:: Bool PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp* dims, npy_intp* newstrides) +.. c:function:: Bool PyArray_CheckStrides( \ + int elsize, int nd, npy_intp numbytes, npy_intp* dims, \ + npy_intp* newstrides) Determine if *newstrides* is a strides array consistent with the memory of an *nd* -dimensional array with shape ``dims`` and @@ -2321,7 +2423,8 @@ this useful approach to looping over an array. negative then *\*axis* will be set to the axis having the smallest stride and that axis will be used. -.. c:function:: PyObject *PyArray_BroadcastToShape(PyObject* arr, npy_intp *dimensions, int nd) +.. c:function:: PyObject *PyArray_BroadcastToShape( \ + PyObject* arr, npy_intp *dimensions, int nd) Return an array iterator that is broadcast to iterate as an array of the shape provided by *dimensions* and *nd*. @@ -2346,7 +2449,8 @@ this useful approach to looping over an array. A pointer to the current element of the array. -.. c:function:: void PyArray_ITER_GOTO(PyObject* iterator, npy_intp* destination) +.. c:function:: void PyArray_ITER_GOTO( \ + PyObject* iterator, npy_intp* destination) Set the *iterator* index, dataptr, and coordinates members to the location in the array indicated by the N-dimensional c-array, @@ -2398,7 +2502,8 @@ Broadcasting (multi-iterators) Advance the pointer of only the *i* :math:`^{\textrm{th}}` iterator. -.. c:function:: void PyArray_MultiIter_GOTO(PyObject* multi, npy_intp* destination) +.. c:function:: void PyArray_MultiIter_GOTO( \ + PyObject* multi, npy_intp* destination) Advance each iterator in a multi-iterator object, *multi*, to the given :math:`N` -dimensional *destination* where :math:`N` is the @@ -2451,7 +2556,9 @@ hypercube. Neighborhood iterator automatically handle boundaries, thus making this kind of code much easier to write than manual boundaries handling, at the cost of a slight overhead. -.. c:function:: PyObject* PyArray_NeighborhoodIterNew(PyArrayIterObject* iter, npy_intp bounds, int mode, PyArrayObject* fill_value) +.. c:function:: PyObject* PyArray_NeighborhoodIterNew( \ + PyArrayIterObject* iter, npy_intp bounds, int mode, \ + PyArrayObject* fill_value) This function creates a new neighborhood iterator from an existing iterator. The neighborhood will be computed relatively to the position @@ -2518,13 +2625,15 @@ cost of a slight overhead. PyArrayNeighborhoodIter_Reset(neigh_iter); } -.. c:function:: int PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter) +.. c:function:: int PyArrayNeighborhoodIter_Reset( \ + PyArrayNeighborhoodIterObject* iter) Reset the iterator position to the first point of the neighborhood. This should be called whenever the iter argument given at PyArray_NeighborhoodIterObject is changed (see example) -.. c:function:: int PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter) +.. c:function:: int PyArrayNeighborhoodIter_Next( \ + PyArrayNeighborhoodIterObject* iter) After this call, iter->dataptr points to the next point of the neighborhood. Calling this function after every point of the @@ -2541,7 +2650,8 @@ Array Scalars if so, returns the appropriate array scalar. It should be used whenever 0-dimensional arrays could be returned to Python. -.. c:function:: PyObject* PyArray_Scalar(void* data, PyArray_Descr* dtype, PyObject* itemsize) +.. c:function:: PyObject* PyArray_Scalar( \ + void* data, PyArray_Descr* dtype, PyObject* itemsize) Return an array scalar object of the given enumerated *typenum* and *itemsize* by **copying** from memory pointed to by *data* @@ -2556,7 +2666,8 @@ Array Scalars *data* and swapping if the data in *arr* is not in machine byte-order. -.. c:function:: PyObject* PyArray_FromScalar(PyObject* scalar, PyArray_Descr* outcode) +.. c:function:: PyObject* PyArray_FromScalar( \ + PyObject* scalar, PyArray_Descr* outcode) Return a 0-dimensional array of type determined by *outcode* from *scalar* which should be an array-scalar object. If *outcode* is @@ -2571,7 +2682,8 @@ Array Scalars is copied into the memory of *ctypeptr*, for all other types, the actual data is copied into the address pointed to by *ctypeptr*. -.. c:function:: void PyArray_CastScalarToCtype(PyObject* scalar, void* ctypeptr, PyArray_Descr* outcode) +.. c:function:: void PyArray_CastScalarToCtype( \ + PyObject* scalar, void* ctypeptr, PyArray_Descr* outcode) Return the data (cast to the data type indicated by *outcode*) from the array-scalar, *scalar*, into the memory pointed to by @@ -2585,7 +2697,8 @@ Array Scalars except for reference counting and error-checking. Returns a new reference to the typeobject on success or ``NULL`` on failure. -.. c:function:: NPY_SCALARKIND PyArray_ScalarKind(int typenum, PyArrayObject** arr) +.. c:function:: NPY_SCALARKIND PyArray_ScalarKind( \ + int typenum, PyArrayObject** arr) See the function :c:func:`PyArray_MinScalarType` for an alternative mechanism introduced in NumPy 1.6.0. @@ -2601,7 +2714,8 @@ Array Scalars :c:data:`NPY_NOSCALAR` is also an enumerated value :c:type:`NPY_SCALARKIND` variables can take on. -.. c:function:: int PyArray_CanCoerceScalar(char thistype, char neededtype, NPY_SCALARKIND scalar) +.. c:function:: int PyArray_CanCoerceScalar( \ + char thistype, char neededtype, NPY_SCALARKIND scalar) See the function :c:func:`PyArray_ResultType` for details of NumPy type promotion, updated in NumPy 1.6.0. @@ -2650,7 +2764,8 @@ Data-type descriptors flexible data-types which need to have a new elsize member in order to be meaningful in array construction. -.. c:function:: PyArray_Descr* PyArray_DescrNewByteorder(PyArray_Descr* obj, char newendian) +.. c:function:: PyArray_Descr* PyArray_DescrNewByteorder( \ + PyArray_Descr* obj, char newendian) Create a new data-type object with the byteorder set according to *newendian*. All referenced data-type objects (in subdescr and @@ -2663,7 +2778,8 @@ Data-type descriptors referenced data-type descriptors) to have the corresponding byte- order. -.. c:function:: PyArray_Descr* PyArray_DescrFromObject(PyObject* op, PyArray_Descr* mintype) +.. c:function:: PyArray_Descr* PyArray_DescrFromObject( \ + PyObject* op, PyArray_Descr* mintype) Determine an appropriate data-type object from the object *op* (which should be a "nested" sequence object) and the minimum @@ -2696,7 +2812,8 @@ Data-type descriptors be used with the "O&" character code in :c:func:`PyArg_ParseTuple` processing. -.. c:function:: int PyArray_DescrConverter2(PyObject* obj, PyArray_Descr** dtype) +.. c:function:: int PyArray_DescrConverter2( \ + PyObject* obj, PyArray_Descr** dtype) Convert any compatible Python object, *obj*, to a data-type object in *dtype*. This version of the converter converts None @@ -2704,12 +2821,14 @@ Data-type descriptors can also be used with the "O&" character in PyArg_ParseTuple processing. -.. c:function:: int Pyarray_DescrAlignConverter(PyObject* obj, PyArray_Descr** dtype) +.. c:function:: int Pyarray_DescrAlignConverter( \ + PyObject* obj, PyArray_Descr** dtype) Like :c:func:`PyArray_DescrConverter` except it aligns C-struct-like objects on word-boundaries as the compiler would. -.. c:function:: int Pyarray_DescrAlignConverter2(PyObject* obj, PyArray_Descr** dtype) +.. c:function:: int Pyarray_DescrAlignConverter2( \ + PyObject* obj, PyArray_Descr** dtype) Like :c:func:`PyArray_DescrConverter2` except it aligns C-struct-like objects on word-boundaries as the compiler would. @@ -2753,7 +2872,8 @@ to. . No matter what is returned, you must DECREF the object returned by this routine in *address* when you are done with it. -.. c:function:: int PyArray_OutputConverter(PyObject* obj, PyArrayObject** address) +.. c:function:: int PyArray_OutputConverter( \ + PyObject* obj, PyArrayObject** address) This is a default converter for output arrays given to functions. If *obj* is :c:data:`Py_None` or ``NULL``, then *\*address* @@ -2814,7 +2934,8 @@ to. with 'q' or 'Q') , :c:data:`NPY_HEAPSORT` (starts with 'h' or 'H'), or :c:data:`NPY_MERGESORT` (starts with 'm' or 'M'). -.. c:function:: int PyArray_SearchsideConverter(PyObject* obj, NPY_SEARCHSIDE* side) +.. c:function:: int PyArray_SearchsideConverter( \ + PyObject* obj, NPY_SEARCHSIDE* side) Convert Python strings into one of :c:data:`NPY_SEARCHLEFT` (starts with 'l' or 'L'), or :c:data:`NPY_SEARCHRIGHT` (starts with 'r' or 'R'). @@ -2825,20 +2946,23 @@ to. enumeration :c:data:`NPY_CORDER`, :c:data:`NPY_FORTRANORDER`, :c:data:`NPY_ANYORDER`, and :c:data:`NPY_KEEPORDER`. -.. c:function:: int PyArray_CastingConverter(PyObject* obj, NPY_CASTING* casting) +.. c:function:: int PyArray_CastingConverter( \ + PyObject* obj, NPY_CASTING* casting) Convert the Python strings 'no', 'equiv', 'safe', 'same_kind', and 'unsafe' into the :c:type:`NPY_CASTING` enumeration :c:data:`NPY_NO_CASTING`, :c:data:`NPY_EQUIV_CASTING`, :c:data:`NPY_SAFE_CASTING`, :c:data:`NPY_SAME_KIND_CASTING`, and :c:data:`NPY_UNSAFE_CASTING`. -.. c:function:: int PyArray_ClipmodeConverter(PyObject* object, NPY_CLIPMODE* val) +.. c:function:: int PyArray_ClipmodeConverter( \ + PyObject* object, NPY_CLIPMODE* val) Convert the Python strings 'clip', 'wrap', and 'raise' into the :c:type:`NPY_CLIPMODE` enumeration :c:data:`NPY_CLIP`, :c:data:`NPY_WRAP`, and :c:data:`NPY_RAISE`. -.. c:function:: int PyArray_ConvertClipmodeSequence(PyObject* object, NPY_CLIPMODE* modes, int n) +.. c:function:: int PyArray_ConvertClipmodeSequence( \ + PyObject* object, NPY_CLIPMODE* modes, int n) Converts either a sequence of clipmodes or a single clipmode into a C array of :c:type:`NPY_CLIPMODE` values. The number of clipmodes *n* @@ -2864,7 +2988,8 @@ Other conversions scalars) to a (platform-pointer-sized) integer. On error, -1 is returned and an exception set. -.. c:function:: int PyArray_IntpFromSequence(PyObject* seq, npy_intp* vals, int maxvals) +.. c:function:: int PyArray_IntpFromSequence( \ + PyObject* seq, npy_intp* vals, int maxvals) Convert any Python sequence (or single Python number) passed in as *seq* to (up to) *maxvals* pointer-sized integers and place them |