summaryrefslogtreecommitdiff
path: root/doc/source/reference
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/reference')
-rw-r--r--doc/source/reference/arrays.classes.rst8
-rw-r--r--doc/source/reference/arrays.dtypes.rst11
-rw-r--r--doc/source/reference/arrays.indexing.rst2
-rw-r--r--doc/source/reference/arrays.interface.rst28
-rw-r--r--doc/source/reference/arrays.ndarray.rst8
-rw-r--r--doc/source/reference/arrays.scalars.rst4
-rw-r--r--doc/source/reference/c-api/array.rst36
-rw-r--r--doc/source/reference/c-api/types-and-structures.rst11
-rw-r--r--doc/source/reference/internals.code-explanations.rst7
-rw-r--r--doc/source/reference/maskedarray.generic.rst18
-rw-r--r--doc/source/reference/random/c-api.rst3
-rw-r--r--doc/source/reference/routines.array-manipulation.rst1
-rw-r--r--doc/source/reference/routines.char.rst2
-rw-r--r--doc/source/reference/routines.io.rst2
-rw-r--r--doc/source/reference/routines.other.rst1
-rw-r--r--doc/source/reference/ufuncs.rst4
16 files changed, 77 insertions, 69 deletions
diff --git a/doc/source/reference/arrays.classes.rst b/doc/source/reference/arrays.classes.rst
index c5563bddd..3a4ed2168 100644
--- a/doc/source/reference/arrays.classes.rst
+++ b/doc/source/reference/arrays.classes.rst
@@ -480,16 +480,16 @@ Character arrays (:mod:`numpy.char`)
The `chararray` class exists for backwards compatibility with
Numarray, it is not recommended for new development. Starting from numpy
1.4, if one needs arrays of strings, it is recommended to use arrays of
- `dtype` `object_`, `string_` or `unicode_`, and use the free functions
+ `dtype` `object_`, `bytes_` or `str_`, and use the free functions
in the `numpy.char` module for fast vectorized string operations.
-These are enhanced arrays of either :class:`string_` type or
-:class:`unicode_` type. These arrays inherit from the
+These are enhanced arrays of either :class:`str_` type or
+:class:`bytes_` type. These arrays inherit from the
:class:`ndarray`, but specially-define the operations ``+``, ``*``,
and ``%`` on a (broadcasting) element-by-element basis. These
operations are not available on the standard :class:`ndarray` of
character type. In addition, the :class:`chararray` has all of the
-standard :class:`string <str>` (and :class:`unicode`) methods,
+standard :class:`str` (and :class:`bytes`) methods,
executing them on an element-by-element basis. Perhaps the easiest
way to create a chararray is to use :meth:`self.view(chararray)
<ndarray.view>` where *self* is an ndarray of str or unicode
diff --git a/doc/source/reference/arrays.dtypes.rst b/doc/source/reference/arrays.dtypes.rst
index 301e26c55..8f664cd19 100644
--- a/doc/source/reference/arrays.dtypes.rst
+++ b/doc/source/reference/arrays.dtypes.rst
@@ -264,9 +264,8 @@ Array-protocol type strings (see :ref:`arrays.interface`)
.. admonition:: Note on string types
For backward compatibility with Python 2 the ``S`` and ``a`` typestrings
- remain zero-terminated bytes and ``np.string_`` continues to map to
- ``np.bytes_``.
- To use actual strings in Python 3 use ``U`` or ``np.unicode_``.
+ remain zero-terminated bytes and `numpy.string_` continues to alias
+ `numpy.bytes_`. To use actual strings in Python 3 use ``U`` or `numpy.str_`.
For signed bytes that do not need zero-termination ``b`` or ``i1`` can be
used.
@@ -392,9 +391,9 @@ Type strings
their values must each be lists of the same length as the *names*
and *formats* lists. The *offsets* value is a list of byte offsets
(limited to `ctypes.c_int`) for each field, while the *titles* value is a
- list of titles for each field (None can be used if no title is
- desired for that field). The *titles* can be any :class:`string`
- or :class:`unicode` object and will add another entry to the
+ list of titles for each field (``None`` can be used if no title is
+ desired for that field). The *titles* can be any object, but when a
+ :class:`str` object will add another entry to the
fields dictionary keyed by the title and referencing the same
field tuple which will contain the title as an additional tuple
member.
diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst
index b2a9f1d21..9f82875ea 100644
--- a/doc/source/reference/arrays.indexing.rst
+++ b/doc/source/reference/arrays.indexing.rst
@@ -453,7 +453,7 @@ also supports boolean arrays and will work without any surprises.
array([[ 3, 5],
[ 9, 11]])
- Without the ``np.ix_`` call or only the diagonal elements would be
+ Without the ``np.ix_`` call, only the diagonal elements would be
selected.
Or without ``np.ix_`` (compare the integer array examples):
diff --git a/doc/source/reference/arrays.interface.rst b/doc/source/reference/arrays.interface.rst
index aeac66f82..d0a1c06c4 100644
--- a/doc/source/reference/arrays.interface.rst
+++ b/doc/source/reference/arrays.interface.rst
@@ -61,12 +61,12 @@ This approach to the interface consists of the object having an
**shape** (required)
Tuple whose elements are the array size in each dimension. Each
- entry is an integer (a Python int or long). Note that these
- integers could be larger than the platform "int" or "long"
- could hold (a Python int is a C long). It is up to the code
+ entry is an integer (a Python :py:class:`int`). Note that these
+ integers could be larger than the platform ``int`` or ``long``
+ could hold (a Python :py:class:`int` is a C ``long``). It is up to the code
using this attribute to handle this appropriately; either by
raising an error when overflow is possible, or by using
- :c:data:`Py_LONG_LONG` as the C type for the shapes.
+ ``long long`` as the C type for the shapes.
**typestr** (required)
A string providing the basic type of the homogeneous array The
@@ -132,7 +132,7 @@ This approach to the interface consists of the object having an
means the data area is read-only).
This attribute can also be an object exposing the
- :c:func:`buffer interface <PyObject_AsCharBuffer>` which
+ :ref:`buffer interface <bufferobjects>` which
will be used to share the data. If this key is not present (or
returns None), then memory sharing will be done
through the buffer interface of the object itself. In this
@@ -144,21 +144,21 @@ This approach to the interface consists of the object having an
**Default**: None
**strides** (optional)
- Either None to indicate a C-style contiguous array or
+ Either ``None`` to indicate a C-style contiguous array or
a Tuple of strides which provides the number of bytes needed
to jump to the next array element in the corresponding
dimension. Each entry must be an integer (a Python
- :const:`int` or :const:`long`). As with shape, the values may
- be larger than can be represented by a C "int" or "long"; the
+ :py:class:`int`). As with shape, the values may
+ be larger than can be represented by a C ``int`` or ``long``; the
calling code should handle this appropriately, either by
- raising an error, or by using :c:type:`Py_LONG_LONG` in C. The
- default is None which implies a C-style contiguous
- memory buffer. In this model, the last dimension of the array
+ raising an error, or by using ``long long`` in C. The
+ default is ``None`` which implies a C-style contiguous
+ memory buffer. In this model, the last dimension of the array
varies the fastest. For example, the default strides tuple
for an object whose array entries are 8 bytes long and whose
- shape is (10,20,30) would be (4800, 240, 8)
+ shape is ``(10, 20, 30)`` would be ``(4800, 240, 8)``
- **Default**: None (C-style contiguous)
+ **Default**: ``None`` (C-style contiguous)
**mask** (optional)
None or an object exposing the array interface. All
@@ -172,7 +172,7 @@ This approach to the interface consists of the object having an
**offset** (optional)
An integer offset into the array data region. This can only be
- used when data is None or returns a :class:`buffer`
+ used when data is ``None`` or returns a :class:`buffer`
object.
**Default**: 0.
diff --git a/doc/source/reference/arrays.ndarray.rst b/doc/source/reference/arrays.ndarray.rst
index 689240c7d..405ae8f6a 100644
--- a/doc/source/reference/arrays.ndarray.rst
+++ b/doc/source/reference/arrays.ndarray.rst
@@ -469,7 +469,7 @@ Comparison operators:
ndarray.__eq__
ndarray.__ne__
-Truth value of an array (:func:`bool()`):
+Truth value of an array (:class:`bool() <bool>`):
.. autosummary::
:toctree: generated/
@@ -604,9 +604,9 @@ Container customization: (see :ref:`Indexing <arrays.indexing>`)
ndarray.__setitem__
ndarray.__contains__
-Conversion; the operations :func:`int()`, :func:`float()` and
-:func:`complex()`.
-. They work only on arrays that have one element in them
+Conversion; the operations :class:`int() <int>`,
+:class:`float() <float>` and :class:`complex() <complex>`.
+They work only on arrays that have one element in them
and return the appropriate scalar.
.. autosummary::
diff --git a/doc/source/reference/arrays.scalars.rst b/doc/source/reference/arrays.scalars.rst
index 13d117af2..24393f1e7 100644
--- a/doc/source/reference/arrays.scalars.rst
+++ b/doc/source/reference/arrays.scalars.rst
@@ -30,8 +30,8 @@ present can be determined using other members of the data type
hierarchy. Thus, for example ``isinstance(val, np.complexfloating)``
will return :py:data:`True` if *val* is a complex valued type, while
``isinstance(val, np.flexible)`` will return true if *val* is one
-of the flexible itemsize array types (:class:`string`,
-:class:`unicode`, :class:`void`).
+of the flexible itemsize array types (:class:`str_`,
+:class:`bytes_`, :class:`void`).
.. figure:: figures/dtype-hierarchy.png
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst
index 637b6aaeb..ae39f980f 100644
--- a/doc/source/reference/c-api/array.rst
+++ b/doc/source/reference/c-api/array.rst
@@ -24,7 +24,7 @@ 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`
-and itssub-types).
+and its sub-types).
.. c:function:: int PyArray_NDIM(PyArrayObject *arr)
@@ -942,7 +942,7 @@ argument must be a :c:type:`PyObject *<PyObject>` that can be directly interpret
Type represents one of the flexible array types ( :c:data:`NPY_STRING`,
:c:data:`NPY_UNICODE`, or :c:data:`NPY_VOID` ).
-.. c:function:: int PyDataType_ISUNSIZED(PyArray_Descr* descr):
+.. c:function:: int PyDataType_ISUNSIZED(PyArray_Descr* descr)
Type has no size information attached, and can be resized. Should only be
called on flexible dtypes. Types that are attached to an array will always
@@ -1335,7 +1335,7 @@ Special functions for NPY_OBJECT
locations in the structure with object data-types. No checking is
performed but *arr* must be of data-type :c:type:`NPY_OBJECT` and be
single-segment and uninitialized (no previous objects in
- position). Use :c:func:`PyArray_DECREF` (*arr*) if you need to
+ position). Use :c:func:`PyArray_XDECREF` (*arr*) if you need to
decrement all the items in the object array prior to calling this
function.
@@ -1354,7 +1354,7 @@ Special functions for NPY_OBJECT
strides, ordering, etc.) Sets the :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag
and ``arr->base``, and set ``base`` to READONLY. Call
:c:func:`PyArray_ResolveWritebackIfCopy` before calling
- `Py_DECREF`` in order copy any changes back to ``base`` and
+ `Py_DECREF` in order copy any changes back to ``base`` and
reset the READONLY flag.
Returns 0 for success, -1 for failure.
@@ -3139,21 +3139,31 @@ calling the function). That's why several functions are provided to check for
numpy versions. The macros :c:data:`NPY_VERSION` and
:c:data:`NPY_FEATURE_VERSION` corresponds to the numpy version used to build the
extension, whereas the versions returned by the functions
-PyArray_GetNDArrayCVersion and PyArray_GetNDArrayCFeatureVersion corresponds to
-the runtime numpy's version.
+:c:func:`PyArray_GetNDArrayCVersion` and :c:func:`PyArray_GetNDArrayCFeatureVersion`
+corresponds to the runtime numpy's version.
The rules for ABI and API compatibilities can be summarized as follows:
- * Whenever :c:data:`NPY_VERSION` != PyArray_GetNDArrayCVersion, the
+ * Whenever :c:data:`NPY_VERSION` != ``PyArray_GetNDArrayCVersion()``, the
extension has to be recompiled (ABI incompatibility).
- * :c:data:`NPY_VERSION` == PyArray_GetNDArrayCVersion and
- :c:data:`NPY_FEATURE_VERSION` <= PyArray_GetNDArrayCFeatureVersion means
+ * :c:data:`NPY_VERSION` == ``PyArray_GetNDArrayCVersion()`` and
+ :c:data:`NPY_FEATURE_VERSION` <= ``PyArray_GetNDArrayCFeatureVersion()`` means
backward compatible changes.
ABI incompatibility is automatically detected in every numpy's version. API
incompatibility detection was added in numpy 1.4.0. If you want to supported
many different numpy versions with one extension binary, you have to build your
-extension with the lowest NPY_FEATURE_VERSION as possible.
+extension with the lowest :c:data:`NPY_FEATURE_VERSION` as possible.
+
+.. c:macro:: NPY_VERSION
+
+ The current version of the ndarray object (check to see if this
+ variable is defined to guarantee the ``numpy/arrayobject.h`` header is
+ being used).
+
+.. c:macro:: NPY_FEATURE_VERSION
+
+ The current version of the C-API.
.. c:function:: unsigned int PyArray_GetNDArrayCVersion(void)
@@ -3437,12 +3447,6 @@ Other constants
The maximum number of array arguments that can be used in functions.
-.. c:macro:: NPY_VERSION
-
- The current version of the ndarray object (check to see if this
- variable is defined to guarantee the numpy/arrayobject.h header is
- being used).
-
.. c:macro:: NPY_FALSE
Defined as 0 for use with Bool.
diff --git a/doc/source/reference/c-api/types-and-structures.rst b/doc/source/reference/c-api/types-and-structures.rst
index fb5753c02..8c1a679dc 100644
--- a/doc/source/reference/c-api/types-and-structures.rst
+++ b/doc/source/reference/c-api/types-and-structures.rst
@@ -69,6 +69,7 @@ PyArray_Type and PyArrayObject
typeobject.
.. c:type:: PyArrayObject
+ NPY_AO
The :c:type:`PyArrayObject` C-structure contains all of the required
information for an array. All instances of an ndarray (and its
@@ -77,7 +78,7 @@ PyArray_Type and PyArrayObject
provided macros. If you need a shorter name, then you can make use
of :c:type:`NPY_AO` (deprecated) which is defined to be equivalent to
:c:type:`PyArrayObject`. Direct access to the struct fields are
- deprecated. Use the `PyArray_*(arr)` form instead.
+ deprecated. Use the ``PyArray_*(arr)`` form instead.
.. code-block:: c
@@ -813,7 +814,9 @@ PyUFunc_Type and PyUFuncObject
.. c:member:: int identity
Either :c:data:`PyUFunc_One`, :c:data:`PyUFunc_Zero`,
- :c:data:`PyUFunc_None` or :c:data:`PyUFunc_AllOnes` to indicate
+ :c:data:`PyUFunc_MinusOne`, :c:data:`PyUFunc_None`,
+ :c:data:`PyUFunc_ReorderableNone`, or
+ :c:data:`PyUFunc_IdentityValue` to indicate
the identity for this operation. It is only used for a
reduce-like call on an empty array.
@@ -1216,8 +1219,8 @@ are ``Py{TYPE}ArrType_Type`` where ``{TYPE}`` can be
**Object**.
These type names are part of the C-API and can therefore be created in
-extension C-code. There is also a :c:data:`PyIntpArrType_Type` and a
-:c:data:`PyUIntpArrType_Type` that are simple substitutes for one of the
+extension C-code. There is also a ``PyIntpArrType_Type`` and a
+``PyUIntpArrType_Type`` that are simple substitutes for one of the
integer types that can hold a pointer on the platform. The structure
of these scalar objects is not exposed to C-code. The function
:c:func:`PyArray_ScalarAsCtype` (..) can be used to extract the C-type
diff --git a/doc/source/reference/internals.code-explanations.rst b/doc/source/reference/internals.code-explanations.rst
index 65553e07e..e8e428f2e 100644
--- a/doc/source/reference/internals.code-explanations.rst
+++ b/doc/source/reference/internals.code-explanations.rst
@@ -147,7 +147,8 @@ an iterator for each of the arrays being broadcast.
The :c:func:`PyArray_Broadcast` function takes the iterators that have already
been defined and uses them to determine the broadcast shape in each
dimension (to create the iterators at the same time that broadcasting
-occurs then use the :c:func:`PyMultiIter_New` function). Then, the iterators are
+occurs then use the :c:func:`PyArray_MultiIterNew` function).
+Then, the iterators are
adjusted so that each iterator thinks it is iterating over an array
with the broadcast size. This is done by adjusting the iterators
number of dimensions, and the shape in each dimension. This works
@@ -162,7 +163,7 @@ for the extended dimensions. It is done in exactly the same way in
NumPy. The big difference is that now the array of strides is kept
track of in a :c:type:`PyArrayIterObject`, the iterators involved in a
broadcast result are kept track of in a :c:type:`PyArrayMultiIterObject`,
-and the :c:func:`PyArray_BroadCast` call implements the broad-casting rules.
+and the :c:func:`PyArray_Broadcast` call implements the broad-casting rules.
Array Scalars
@@ -368,7 +369,7 @@ The output arguments (if any) are then processed and any missing
return arrays are constructed. If any provided output array doesn't
have the correct type (or is mis-aligned) and is smaller than the
buffer size, then a new output array is constructed with the special
-:c:data:`WRITEBACKIFCOPY` flag set. At the end of the function,
+:c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag set. At the end of the function,
:c:func:`PyArray_ResolveWritebackIfCopy` is called so that
its contents will be copied back into the output array.
Iterators for the output arguments are then processed.
diff --git a/doc/source/reference/maskedarray.generic.rst b/doc/source/reference/maskedarray.generic.rst
index 41c3ee564..d3849c50d 100644
--- a/doc/source/reference/maskedarray.generic.rst
+++ b/doc/source/reference/maskedarray.generic.rst
@@ -177,8 +177,8 @@ attribute. We must keep in mind that a ``True`` entry in the mask indicates an
*invalid* data.
Another possibility is to use the :func:`getmask` and :func:`getmaskarray`
-functions. :func:`getmask(x)` outputs the mask of ``x`` if ``x`` is a masked
-array, and the special value :data:`nomask` otherwise. :func:`getmaskarray(x)`
+functions. ``getmask(x)`` outputs the mask of ``x`` if ``x`` is a masked
+array, and the special value :data:`nomask` otherwise. ``getmaskarray(x)``
outputs the mask of ``x`` if ``x`` is a masked array. If ``x`` has no invalid
entry or is not a masked array, the function outputs a boolean array of
``False`` with as many elements as ``x``.
@@ -296,11 +296,11 @@ new valid values to them::
.. note::
Unmasking an entry by direct assignment will silently fail if the masked
- array has a *hard* mask, as shown by the :attr:`hardmask` attribute. This
- feature was introduced to prevent overwriting the mask. To force the
- unmasking of an entry where the array has a hard mask, the mask must first
- to be softened using the :meth:`soften_mask` method before the allocation.
- It can be re-hardened with :meth:`harden_mask`::
+ array has a *hard* mask, as shown by the :attr:`~MaskedArray.hardmask`
+ attribute. This feature was introduced to prevent overwriting the mask.
+ To force the unmasking of an entry where the array has a hard mask,
+ the mask must first to be softened using the :meth:`soften_mask` method
+ before the allocation. It can be re-hardened with :meth:`harden_mask`::
>>> x = ma.array([1, 2, 3], mask=[0, 0, 1], hard_mask=True)
>>> x
@@ -406,8 +406,8 @@ Operations on masked arrays
Arithmetic and comparison operations are supported by masked arrays.
As much as possible, invalid entries of a masked array are not processed,
-meaning that the corresponding :attr:`data` entries *should* be the same
-before and after the operation.
+meaning that the corresponding :attr:`~MaskedArray.data` entries
+*should* be the same before and after the operation.
.. warning::
We need to stress that this behavior may not be systematic, that masked
diff --git a/doc/source/reference/random/c-api.rst b/doc/source/reference/random/c-api.rst
index 63b0fdc2b..a79da7a49 100644
--- a/doc/source/reference/random/c-api.rst
+++ b/doc/source/reference/random/c-api.rst
@@ -181,6 +181,5 @@ Generate a single integer
Generate random uint64 numbers in closed interval [off, off + rng].
-.. c:function:: npy_uint64 random_bounded_uint64(bitgen_t *bitgen_state, npy_uint64 off, npy_uint64 rng, npy_uint64 mask, bint use_masked)
-
+.. c:function:: npy_uint64 random_bounded_uint64(bitgen_t *bitgen_state, npy_uint64 off, npy_uint64 rng, npy_uint64 mask, bool use_masked)
diff --git a/doc/source/reference/routines.array-manipulation.rst b/doc/source/reference/routines.array-manipulation.rst
index 8d13a1800..1c96495d9 100644
--- a/doc/source/reference/routines.array-manipulation.rst
+++ b/doc/source/reference/routines.array-manipulation.rst
@@ -74,6 +74,7 @@ Joining arrays
hstack
dstack
column_stack
+ row_stack
Splitting arrays
================
diff --git a/doc/source/reference/routines.char.rst b/doc/source/reference/routines.char.rst
index ed8393855..90df14125 100644
--- a/doc/source/reference/routines.char.rst
+++ b/doc/source/reference/routines.char.rst
@@ -6,7 +6,7 @@ String operations
.. module:: numpy.char
The `numpy.char` module provides a set of vectorized string
-operations for arrays of type `numpy.string_` or `numpy.unicode_`.
+operations for arrays of type `numpy.str_` or `numpy.bytes_`.
All of them are based on the string methods in the Python standard library.
String operations
diff --git a/doc/source/reference/routines.io.rst b/doc/source/reference/routines.io.rst
index 2e119af9a..3052ee1fb 100644
--- a/doc/source/reference/routines.io.rst
+++ b/doc/source/reference/routines.io.rst
@@ -88,4 +88,4 @@ Binary Format Description
.. autosummary::
:toctree: generated/
- lib.format
+ lib.format
diff --git a/doc/source/reference/routines.other.rst b/doc/source/reference/routines.other.rst
index def5b3e3c..aefd680bb 100644
--- a/doc/source/reference/routines.other.rst
+++ b/doc/source/reference/routines.other.rst
@@ -47,6 +47,7 @@ Utility
show_config
deprecate
deprecate_with_doc
+ broadcast_shapes
Matlab-like Functions
---------------------
diff --git a/doc/source/reference/ufuncs.rst b/doc/source/reference/ufuncs.rst
index c729f8d37..06fbe28dd 100644
--- a/doc/source/reference/ufuncs.rst
+++ b/doc/source/reference/ufuncs.rst
@@ -1,5 +1,7 @@
.. sectionauthor:: adapted from "Guide to NumPy" by Travis E. Oliphant
+.. currentmodule:: numpy
+
.. _ufuncs:
************************************
@@ -8,8 +10,6 @@ Universal functions (:class:`ufunc`)
.. note: XXX: section might need to be made more reference-guideish...
-.. currentmodule:: numpy
-
.. index: ufunc, universal function, arithmetic, operation
A universal function (or :term:`ufunc` for short) is a function that