diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/neps/ufunc-overrides.rst | 2 | ||||
-rw-r--r-- | doc/source/reference/c-api.array.rst | 12 | ||||
-rw-r--r-- | doc/source/reference/c-api.types-and-structures.rst | 70 | ||||
-rw-r--r-- | doc/source/reference/swig.testing.rst | 4 | ||||
-rw-r--r-- | doc/source/user/basics.io.genfromtxt.rst | 4 |
5 files changed, 63 insertions, 29 deletions
diff --git a/doc/neps/ufunc-overrides.rst b/doc/neps/ufunc-overrides.rst index 5a0a0334f..be3b8b4aa 100644 --- a/doc/neps/ufunc-overrides.rst +++ b/doc/neps/ufunc-overrides.rst @@ -3,7 +3,7 @@ A Mechanism for Overriding Ufuncs ================================= :Author: Blake Griffith -:Contact: blake.g@utexa.edu +:Contact: blake.g@utexas.edu :Date: 2013-07-10 :Author: Pauli Virtanen diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst index 5911eaa68..f5f753292 100644 --- a/doc/source/reference/c-api.array.rst +++ b/doc/source/reference/c-api.array.rst @@ -593,18 +593,16 @@ From other objects .. cfunction:: PyObject* PyArray_FromStructInterface(PyObject* op) Returns an ndarray object from a Python object that exposes the - :obj:`__array_struct__`` method and follows the array interface - protocol. If the object does not contain this method then a + :obj:`__array_struct__` attribute and follows the array interface + protocol. If the object does not contain this attribute then a borrowed reference to :cdata:`Py_NotImplemented` is returned. .. cfunction:: PyObject* PyArray_FromInterface(PyObject* op) Returns an ndarray object from a Python object that exposes the - :obj:`__array_shape__` and :obj:`__array_typestr__` - methods following - the array interface protocol. If the object does not contain one - of these method then a borrowed reference to :cdata:`Py_NotImplemented` - is returned. + :obj:`__array_interface__` attribute following the array interface + protocol. If the object does not contain this attribute then a + borrowed reference to :cdata:`Py_NotImplemented` is returned. .. cfunction:: PyObject* PyArray_FromArrayAttr(PyObject* op, PyArray_Descr* dtype, PyObject* context) diff --git a/doc/source/reference/c-api.types-and-structures.rst b/doc/source/reference/c-api.types-and-structures.rst index 473e25010..43abe24c7 100644 --- a/doc/source/reference/c-api.types-and-structures.rst +++ b/doc/source/reference/c-api.types-and-structures.rst @@ -407,7 +407,10 @@ PyArrayDescr_Type PyArray_ScalarKindFunc *scalarkind; int **cancastscalarkindto; int *cancastto; - int listpickle + PyArray_FastClipFunc *fastclip; + PyArray_FastPutmaskFunc *fastputmask; + PyArray_FastTakeFunc *fasttake; + PyArray_ArgFunc *argmin; } PyArray_ArrFuncs; The concept of a behaved segment is used in the description of the @@ -417,8 +420,7 @@ PyArrayDescr_Type functions can (and must) deal with mis-behaved arrays. The other functions require behaved memory segments. - .. cmember:: void cast(void *from, void *to, npy_intp n, void *fromarr, - void *toarr) + .. cmember:: void cast(void *from, void *to, npy_intp n, void *fromarr, void *toarr) An array of function pointers to cast from the current type to all of the other builtin types. Each function casts a @@ -444,8 +446,7 @@ PyArrayDescr_Type a zero is returned, otherwise, a negative one is returned (and a Python error set). - .. cmember:: void copyswapn(void *dest, npy_intp dstride, void *src, - npy_intp sstride, npy_intp n, int swap, void *arr) + .. cmember:: void copyswapn(void *dest, npy_intp dstride, void *src, npy_intp sstride, npy_intp n, int swap, void *arr) .. cmember:: void copyswap(void *dest, void *src, int swap, void *arr) @@ -471,8 +472,7 @@ PyArrayDescr_Type ``d2``, and -1 if * ``d1`` < * ``d2``. The array object ``arr`` is used to retrieve itemsize and field information for flexible arrays. - .. cmember:: int argmax(void* data, npy_intp n, npy_intp* max_ind, - void* arr) + .. cmember:: int argmax(void* data, npy_intp n, npy_intp* max_ind, void* arr) A pointer to a function that retrieves the index of the largest of ``n`` elements in ``arr`` beginning at the element @@ -481,8 +481,7 @@ PyArrayDescr_Type always 0. The index of the largest element is returned in ``max_ind``. - .. cmember:: void dotfunc(void* ip1, npy_intp is1, void* ip2, npy_intp is2, - void* op, npy_intp n, void* arr) + .. cmember:: void dotfunc(void* ip1, npy_intp is1, void* ip2, npy_intp is2, void* op, npy_intp n, void* arr) A pointer to a function that multiplies two ``n`` -length sequences together, adds them, and places the result in @@ -532,8 +531,7 @@ PyArrayDescr_Type computed by repeatedly adding this computed delta. The data buffer must be well-behaved. - .. cmember:: void fillwithscalar(void* buffer, npy_intp length, - void* value, void* arr) + .. cmember:: void fillwithscalar(void* buffer, npy_intp length, void* value, void* arr) A pointer to a function that fills a contiguous ``buffer`` of the given ``length`` with a single scalar ``value`` whose @@ -548,14 +546,13 @@ PyArrayDescr_Type :cdata:`NPY_MERGESORT` are defined). These sorts are done in-place assuming contiguous and aligned data. - .. cmember:: int argsort(void* start, npy_intp* result, npy_intp length, - void \*arr) + .. cmember:: int argsort(void* start, npy_intp* result, npy_intp length, void *arr) An array of function pointers to sorting algorithms for this data type. The same sorting algorithms as for sort are available. The indices producing the sort are returned in - result (which must be initialized with indices 0 to length-1 - inclusive). + ``result`` (which must be initialized with indices 0 to + ``length-1`` inclusive). .. cmember:: PyObject *castdict @@ -587,9 +584,48 @@ PyArrayDescr_Type can be cast to safely (this usually means without losing precision). - .. cmember:: int listpickle + .. cmember:: void fastclip(void *in, npy_intp n_in, void *min, void *max, void *out) + + A function that reads ``n_in`` items from ``in``, and writes to + ``out`` the read value if it is within the limits pointed to by + ``min`` and ``max``, or the corresponding limit if outside. The + memory segments must be contiguous and behaved, and either + ``min`` or ``max`` may be ``NULL``, but not both. + + .. cmember:: void fastputmask(void *in, void *mask, npy_intp n_in, void *values, npy_intp nv) + + A function that takes a pointer ``in`` to an array of ``n_in`` + items, a pointer ``mask`` to an array of ``n_in`` boolean + values, and a pointer ``vals`` to an array of ``nv`` items. + Items from ``vals`` are copied into ``in`` wherever the value + in ``mask`` is non-zero, tiling ``vals`` as needed if + ``nv < n_in``. All arrays must be contiguous and behaved. + + .. cmember:: void fasttake(void *dest, void *src, npy_intp *indarray, npy_intp nindarray, npy_intp n_outer, npy_intp m_middle, npy_intp nelem, NPY_CLIPMODE clipmode) + + A function that takes a pointer ``src`` to a C contiguous, + behaved segment, interpreted as a 3-dimensional array of shape + ``(n_outer, nindarray, nelem)``, a pointer ``indarray`` to a + contiguous, behaved segment of ``m_middle`` integer indices, + and a pointer ``dest`` to a C contiguous, behaved segment, + interpreted as a 3-dimensional array of shape + ``(n_outer, m_middle, nelem)``. The indices in ``indarray`` are + used to index ``src`` along the second dimension, and copy the + corresponding chunks of ``nelem`` items into ``dest``. + ``clipmode`` (which can take on the values :cdata:`NPY_RAISE`, + :cdata:`NPY_WRAP` or :cdata:`NPY_CLIP`) determines how will + indices smaller than 0 or larger than ``nindarray`` will be + handled. + + .. cmember:: int argmin(void* data, npy_intp n, npy_intp* min_ind, void* arr) + + A pointer to a function that retrieves the index of the + smallest of ``n`` elements in ``arr`` beginning at the element + pointed to by ``data``. This function requires that the + memory segment be contiguous and behaved. The return value is + always 0. The index of the smallest element is returned in + ``min_ind``. - Unused. The :cdata:`PyArray_Type` typeobject implements many of the features of Python objects including the tp_as_number, tp_as_sequence, diff --git a/doc/source/reference/swig.testing.rst b/doc/source/reference/swig.testing.rst index decc681c5..c0daaec66 100644 --- a/doc/source/reference/swig.testing.rst +++ b/doc/source/reference/swig.testing.rst @@ -10,8 +10,8 @@ data types are supported, each with 74 different argument signatures, for a total of 888 typemaps supported "out of the box". Each of these typemaps, in turn, might require several unit tests in order to verify expected behavior for both proper and improper inputs. Currently, -this results in 1,427 individual unit tests that are performed when -``make test`` is run in the ``numpy/docs/swig`` subdirectory. +this results in more than 1,000 individual unit tests executed when +``make test`` is run in the ``numpy/tools/swig`` subdirectory. To facilitate this many similar unit tests, some high-level programming techniques are employed, including C and `SWIG`_ macros, diff --git a/doc/source/user/basics.io.genfromtxt.rst b/doc/source/user/basics.io.genfromtxt.rst index edf48bc15..11205e555 100644 --- a/doc/source/user/basics.io.genfromtxt.rst +++ b/doc/source/user/basics.io.genfromtxt.rst @@ -94,12 +94,12 @@ This behavior can be overwritten by setting the optional argument >>> data = "1, abc , 2\n 3, xxx, 4" >>> # Without autostrip - >>> np.genfromtxt(StringIO(data), dtype="|S5") + >>> np.genfromtxt(StringIO(data), delimiter=",", dtype="|S5") array([['1', ' abc ', ' 2'], ['3', ' xxx', ' 4']], dtype='|S5') >>> # With autostrip - >>> np.genfromtxt(StringIO(data), dtype="|S5", autostrip=True) + >>> np.genfromtxt(StringIO(data), delimiter=",", dtype="|S5", autostrip=True) array([['1', 'abc', '2'], ['3', 'xxx', '4']], dtype='|S5') |