diff options
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/reference/arrays.ndarray.rst | 20 | ||||
-rw-r--r-- | doc/source/reference/c-api.array.rst | 21 |
2 files changed, 32 insertions, 9 deletions
diff --git a/doc/source/reference/arrays.ndarray.rst b/doc/source/reference/arrays.ndarray.rst index 5a528cbf6..85e41c215 100644 --- a/doc/source/reference/arrays.ndarray.rst +++ b/doc/source/reference/arrays.ndarray.rst @@ -273,15 +273,15 @@ more complete description.) For the following methods there are also corresponding functions in :mod:`numpy`: :func:`all`, :func:`any`, :func:`argmax`, -:func:`argmin`, :func:`argsort`, :func:`choose`, :func:`clip`, -:func:`compress`, :func:`copy`, :func:`cumprod`, :func:`cumsum`, -:func:`diagonal`, :func:`imag`, :func:`max <amax>`, :func:`mean`, -:func:`min <amin>`, :func:`nonzero`, :func:`prod`, :func:`ptp`, -:func:`put`, :func:`ravel`, :func:`real`, :func:`repeat`, -:func:`reshape`, :func:`round <around>`, :func:`searchsorted`, -:func:`sort`, :func:`squeeze`, :func:`std`, :func:`sum`, -:func:`swapaxes`, :func:`take`, :func:`trace`, :func:`transpose`, -:func:`var`. +:func:`argmin`, :func:`argpartition`, :func:`argsort`, :func:`choose`, +:func:`clip`, :func:`compress`, :func:`copy`, :func:`cumprod`, +:func:`cumsum`, :func:`diagonal`, :func:`imag`, :func:`max <amax>`, +:func:`mean`, :func:`min <amin>`, :func:`nonzero`, :func:`partition`, +:func:`prod`, :func:`ptp`, :func:`put`, :func:`ravel`, :func:`real`, +:func:`repeat`, :func:`reshape`, :func:`round <around>`, +:func:`searchsorted`, :func:`sort`, :func:`squeeze`, :func:`std`, +:func:`sum`, :func:`swapaxes`, :func:`take`, :func:`trace`, +:func:`transpose`, :func:`var`. Array conversion ---------------- @@ -339,6 +339,8 @@ the operation should proceed. ndarray.choose ndarray.sort ndarray.argsort + ndarray.partition + ndarray.argpartition ndarray.searchsorted ndarray.nonzero ndarray.compress diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst index cef400fad..34ef3318a 100644 --- a/doc/source/reference/c-api.array.rst +++ b/doc/source/reference/c-api.array.rst @@ -1810,6 +1810,27 @@ Item selection and manipulation would be placed. No checking is done on whether or not self is in ascending order. +.. cfunction:: int PyArray_Partition(PyArrayObject *self, PyArrayObject * ktharray, int axis, NPY_SELECTKIND which) + + Equivalent to :meth:`ndarray.partition` (*self*, *ktharray*, *axis*, + *kind*). Partitions the array so that the values of the element indexed by + *ktharray* are in the positions they would be if the array is fully sorted + and places all elements smaller than the kth before and all elements equal + or greater after the kth element. The ordering of all elements within the + partitions is undefined. + If *self*->descr is a data-type with fields defined, then + self->descr->names is used to determine the sort order. A comparison where + the first field is equal will use the second field and so on. To alter the + sort order of a record array, create a new data-type with a different + order of names and construct a view of the array with that new data-type. + Returns zero on success and -1 on failure. + +.. cfunction:: PyObject* PyArray_ArgPartition(PyArrayObject *op, PyArrayObject * ktharray, int axis, NPY_SELECTKIND which) + + Equivalent to :meth:`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*. + .. cfunction:: PyObject* PyArray_Diagonal(PyArrayObject* self, int offset, int axis1, int axis2) Equivalent to :meth:`ndarray.diagonal` (*self*, *offset*, *axis1*, *axis2* |