summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/_templates/autosummary/module.rst40
-rw-r--r--doc/source/conf.py10
-rw-r--r--doc/source/reference/arrays.scalars.rst99
-rw-r--r--doc/source/reference/c-api/array.rst90
-rw-r--r--doc/source/reference/c-api/coremath.rst10
-rw-r--r--doc/source/reference/c-api/dtype.rst134
-rw-r--r--doc/source/reference/c-api/iterator.rst4
-rw-r--r--doc/source/reference/c-api/types-and-structures.rst22
-rw-r--r--doc/source/reference/random/bit_generators/mt19937.rst3
-rw-r--r--doc/source/reference/random/bit_generators/pcg64.rst3
-rw-r--r--doc/source/reference/random/bit_generators/philox.rst3
-rw-r--r--doc/source/reference/random/bit_generators/sfc64.rst3
-rw-r--r--doc/source/reference/random/generator.rst3
-rw-r--r--doc/source/reference/random/legacy.rst3
-rw-r--r--doc/source/reference/routines.polynomials.rst164
-rw-r--r--doc/source/user/basics.rst14
-rw-r--r--doc/source/user/c-info.beyond-basics.rst6
-rw-r--r--doc/source/user/c-info.how-to-extend.rst10
-rw-r--r--doc/source/user/theory.broadcasting.rst2
19 files changed, 439 insertions, 184 deletions
diff --git a/doc/source/_templates/autosummary/module.rst b/doc/source/_templates/autosummary/module.rst
new file mode 100644
index 000000000..e1f428d65
--- /dev/null
+++ b/doc/source/_templates/autosummary/module.rst
@@ -0,0 +1,40 @@
+{% extends "!autosummary/module.rst" %}
+
+{# This file is almost the same as the default, but adds :toctree: to the autosummary directives.
+ The original can be found at `sphinx/ext/autosummary/templates/autosummary/module.rst`. #}
+
+{% block attributes %}
+{% if attributes %}
+ .. rubric:: Module Attributes
+
+ .. autosummary::
+ :toctree:
+ {% for item in attributes %}
+ {{ item }}
+ {%- endfor %}
+{% endif %}
+{% endblock %}
+
+{% block functions %}
+{% if functions %}
+ .. rubric:: Functions
+
+ .. autosummary::
+ :toctree:
+ {% for item in functions %}
+ {{ item }}
+ {%- endfor %}
+{% endif %}
+{% endblock %}
+
+{% block classes %}
+{% if classes %}
+ .. rubric:: Classes
+
+ .. autosummary::
+ :toctree:
+ {% for item in classes %}
+ {{ item }}
+ {%- endfor %}
+{% endif %}
+{% endblock %}
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 381a01612..e76f60063 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -4,7 +4,7 @@ import re
import sys
# Minimum version, enforced by sphinx
-needs_sphinx = '2.2.0'
+needs_sphinx = '3.2.0'
# This is a nasty hack to use platform-agnostic names for types in the
@@ -146,6 +146,14 @@ def setup(app):
app.add_config_value('python_version_major', str(sys.version_info.major), 'env')
app.add_lexer('NumPyC', NumPyLexer)
+# While these objects do have type `module`, the names are aliases for modules
+# elsewhere. Sphinx does not support referring to modules by an aliases name,
+# so we make the alias look like a "real" module for it.
+# If we deemed it desirable, we could in future make these real modules, which
+# would make `from numpy.char import split` work.
+sys.modules['numpy.char'] = numpy.char
+sys.modules['numpy.testing.dec'] = numpy.testing.dec
+
# -----------------------------------------------------------------------------
# HTML output
# -----------------------------------------------------------------------------
diff --git a/doc/source/reference/arrays.scalars.rst b/doc/source/reference/arrays.scalars.rst
index 4b5da2e13..29438f70f 100644
--- a/doc/source/reference/arrays.scalars.rst
+++ b/doc/source/reference/arrays.scalars.rst
@@ -94,112 +94,141 @@ Python Boolean scalar.
.. tip:: The default data type in NumPy is :class:`float_`.
.. autoclass:: numpy.generic
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.number
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Integer types
~~~~~~~~~~~~~
.. autoclass:: numpy.integer
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Signed integer types
++++++++++++++++++++
.. autoclass:: numpy.signedinteger
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.byte
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.short
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.intc
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.int_
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.longlong
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Unsigned integer types
++++++++++++++++++++++
.. autoclass:: numpy.unsignedinteger
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.ubyte
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.ushort
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.uintc
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.uint
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.ulonglong
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Inexact types
~~~~~~~~~~~~~
.. autoclass:: numpy.inexact
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Floating-point types
++++++++++++++++++++
.. autoclass:: numpy.floating
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.half
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.single
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.double
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.longdouble
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Complex floating-point types
++++++++++++++++++++++++++++
.. autoclass:: numpy.complexfloating
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.csingle
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.cdouble
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.clongdouble
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Other types
~~~~~~~~~~~
.. autoclass:: numpy.bool_
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.datetime64
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.timedelta64
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.object_
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. note::
@@ -222,16 +251,20 @@ arrays. (In the character codes ``#`` is an integer denoting how many
elements the data type consists of.)
.. autoclass:: numpy.flexible
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.bytes_
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.str_
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. autoclass:: numpy.void
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
.. warning::
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.
diff --git a/doc/source/reference/c-api/coremath.rst b/doc/source/reference/c-api/coremath.rst
index 338c584a1..cec83b150 100644
--- a/doc/source/reference/c-api/coremath.rst
+++ b/doc/source/reference/c-api/coremath.rst
@@ -46,30 +46,30 @@ Floating point classification
corresponding single and extension precision macro are available with the
suffix F and L.
-.. c:function:: int npy_isnan(x)
+.. c:macro:: npy_isnan(x)
This is a macro, and is equivalent to C99 isnan: works for single, double
and extended precision, and return a non 0 value is x is a NaN.
-.. c:function:: int npy_isfinite(x)
+.. c:macro:: npy_isfinite(x)
This is a macro, and is equivalent to C99 isfinite: works for single,
double and extended precision, and return a non 0 value is x is neither a
NaN nor an infinity.
-.. c:function:: int npy_isinf(x)
+.. c:macro:: npy_isinf(x)
This is a macro, and is equivalent to C99 isinf: works for single, double
and extended precision, and return a non 0 value is x is infinite (positive
and negative).
-.. c:function:: int npy_signbit(x)
+.. c:macro:: npy_signbit(x)
This is a macro, and is equivalent to C99 signbit: works for single, double
and extended precision, and return a non 0 value is x has the signbit set
(that is the number is negative).
-.. c:function:: double npy_copysign(double x, double y)
+.. c:macro:: npy_copysign(x, y)
This is a function equivalent to C99 copysign: return x with the same sign
as y. Works for any value, including inf and nan. Single and extended
diff --git a/doc/source/reference/c-api/dtype.rst b/doc/source/reference/c-api/dtype.rst
index a1a53cdb6..382e45dc0 100644
--- a/doc/source/reference/c-api/dtype.rst
+++ b/doc/source/reference/c-api/dtype.rst
@@ -25,157 +25,157 @@ select the precision desired.
Enumerated Types
----------------
-.. c:var:: NPY_TYPES
+.. c:enumerator:: NPY_TYPES
There is a list of enumerated types defined providing the basic 24
data types plus some useful generic names. Whenever the code requires
a type number, one of these enumerated types is requested. The types
are all called ``NPY_{NAME}``:
-.. c:var:: NPY_BOOL
+.. c:enumerator:: NPY_BOOL
The enumeration value for the boolean type, stored as one byte.
It may only be set to the values 0 and 1.
-.. c:var:: NPY_BYTE
-.. c:var:: NPY_INT8
+.. c:enumerator:: NPY_BYTE
+.. c:enumerator:: NPY_INT8
The enumeration value for an 8-bit/1-byte signed integer.
-.. c:var:: NPY_SHORT
-.. c:var:: NPY_INT16
+.. c:enumerator:: NPY_SHORT
+.. c:enumerator:: NPY_INT16
The enumeration value for a 16-bit/2-byte signed integer.
-.. c:var:: NPY_INT
-.. c:var:: NPY_INT32
+.. c:enumerator:: NPY_INT
+.. c:enumerator:: NPY_INT32
The enumeration value for a 32-bit/4-byte signed integer.
-.. c:var:: NPY_LONG
+.. c:enumerator:: NPY_LONG
Equivalent to either NPY_INT or NPY_LONGLONG, depending on the
platform.
-.. c:var:: NPY_LONGLONG
-.. c:var:: NPY_INT64
+.. c:enumerator:: NPY_LONGLONG
+.. c:enumerator:: NPY_INT64
The enumeration value for a 64-bit/8-byte signed integer.
-.. c:var:: NPY_UBYTE
-.. c:var:: NPY_UINT8
+.. c:enumerator:: NPY_UBYTE
+.. c:enumerator:: NPY_UINT8
The enumeration value for an 8-bit/1-byte unsigned integer.
-.. c:var:: NPY_USHORT
-.. c:var:: NPY_UINT16
+.. c:enumerator:: NPY_USHORT
+.. c:enumerator:: NPY_UINT16
The enumeration value for a 16-bit/2-byte unsigned integer.
-.. c:var:: NPY_UINT
-.. c:var:: NPY_UINT32
+.. c:enumerator:: NPY_UINT
+.. c:enumerator:: NPY_UINT32
The enumeration value for a 32-bit/4-byte unsigned integer.
-.. c:var:: NPY_ULONG
+.. c:enumerator:: NPY_ULONG
Equivalent to either NPY_UINT or NPY_ULONGLONG, depending on the
platform.
-.. c:var:: NPY_ULONGLONG
-.. c:var:: NPY_UINT64
+.. c:enumerator:: NPY_ULONGLONG
+.. c:enumerator:: NPY_UINT64
The enumeration value for a 64-bit/8-byte unsigned integer.
-.. c:var:: NPY_HALF
-.. c:var:: NPY_FLOAT16
+.. c:enumerator:: NPY_HALF
+.. c:enumerator:: NPY_FLOAT16
The enumeration value for a 16-bit/2-byte IEEE 754-2008 compatible floating
point type.
-.. c:var:: NPY_FLOAT
-.. c:var:: NPY_FLOAT32
+.. c:enumerator:: NPY_FLOAT
+.. c:enumerator:: NPY_FLOAT32
The enumeration value for a 32-bit/4-byte IEEE 754 compatible floating
point type.
-.. c:var:: NPY_DOUBLE
-.. c:var:: NPY_FLOAT64
+.. c:enumerator:: NPY_DOUBLE
+.. c:enumerator:: NPY_FLOAT64
The enumeration value for a 64-bit/8-byte IEEE 754 compatible floating
point type.
-.. c:var:: NPY_LONGDOUBLE
+.. c:enumerator:: NPY_LONGDOUBLE
The enumeration value for a platform-specific floating point type which is
at least as large as NPY_DOUBLE, but larger on many platforms.
-.. c:var:: NPY_CFLOAT
-.. c:var:: NPY_COMPLEX64
+.. c:enumerator:: NPY_CFLOAT
+.. c:enumerator:: NPY_COMPLEX64
The enumeration value for a 64-bit/8-byte complex type made up of
two NPY_FLOAT values.
-.. c:var:: NPY_CDOUBLE
-.. c:var:: NPY_COMPLEX128
+.. c:enumerator:: NPY_CDOUBLE
+.. c:enumerator:: NPY_COMPLEX128
The enumeration value for a 128-bit/16-byte complex type made up of
two NPY_DOUBLE values.
-.. c:var:: NPY_CLONGDOUBLE
+.. c:enumerator:: NPY_CLONGDOUBLE
The enumeration value for a platform-specific complex floating point
type which is made up of two NPY_LONGDOUBLE values.
-.. c:var:: NPY_DATETIME
+.. c:enumerator:: NPY_DATETIME
The enumeration value for a data type which holds dates or datetimes with
a precision based on selectable date or time units.
-.. c:var:: NPY_TIMEDELTA
+.. c:enumerator:: NPY_TIMEDELTA
The enumeration value for a data type which holds lengths of times in
integers of selectable date or time units.
-.. c:var:: NPY_STRING
+.. c:enumerator:: NPY_STRING
The enumeration value for ASCII strings of a selectable size. The
strings have a fixed maximum size within a given array.
-.. c:var:: NPY_UNICODE
+.. c:enumerator:: NPY_UNICODE
The enumeration value for UCS4 strings of a selectable size. The
strings have a fixed maximum size within a given array.
-.. c:var:: NPY_OBJECT
+.. c:enumerator:: NPY_OBJECT
The enumeration value for references to arbitrary Python objects.
-.. c:var:: NPY_VOID
+.. c:enumerator:: NPY_VOID
Primarily used to hold struct dtypes, but can contain arbitrary
binary data.
Some useful aliases of the above types are
-.. c:var:: NPY_INTP
+.. c:enumerator:: NPY_INTP
The enumeration value for a signed integer type which is the same
size as a (void \*) pointer. This is the type used by all
arrays of indices.
-.. c:var:: NPY_UINTP
+.. c:enumerator:: NPY_UINTP
The enumeration value for an unsigned integer type which is the
same size as a (void \*) pointer.
-.. c:var:: NPY_MASK
+.. c:enumerator:: NPY_MASK
The enumeration value of the type used for masks, such as with
the :c:data:`NPY_ITER_ARRAYMASK` iterator flag. This is equivalent
to :c:data:`NPY_UINT8`.
-.. c:var:: NPY_DEFAULT_TYPE
+.. c:enumerator:: NPY_DEFAULT_TYPE
The default type to use when no dtype is explicitly specified, for
example when calling np.zero(shape). This is equivalent to
@@ -297,9 +297,13 @@ Boolean
Unsigned versions of the integers can be defined by pre-pending a 'u'
to the front of the integer name.
-.. c:type:: npy_(u)byte
+.. c:type:: npy_byte
- (unsigned) char
+ char
+
+.. c:type:: npy_ubyte
+
+ unsigned char
.. c:type:: npy_short
@@ -309,14 +313,14 @@ to the front of the integer name.
unsigned short
-.. c:type:: npy_uint
-
- unsigned int
-
.. c:type:: npy_int
int
+.. c:type:: npy_uint
+
+ unsigned int
+
.. c:type:: npy_int16
16-bit integer
@@ -341,13 +345,21 @@ to the front of the integer name.
64-bit unsigned integer
-.. c:type:: npy_(u)long
+.. c:type:: npy_long
- (unsigned) long int
+ long int
-.. c:type:: npy_(u)longlong
+.. c:type:: npy_ulong
- (unsigned long long int)
+ unsigned long int
+
+.. c:type:: npy_longlong
+
+ long long int
+
+.. c:type:: npy_ulonglong
+
+ unsigned long long int
.. c:type:: npy_intp
@@ -367,18 +379,30 @@ to the front of the integer name.
16-bit float
-.. c:type:: npy_(c)float
+.. c:type:: npy_float
32-bit float
-.. c:type:: npy_(c)double
+.. c:type:: npy_cfloat
+
+ 32-bit complex float
+
+.. c:type:: npy_double
64-bit double
-.. c:type:: npy_(c)longdouble
+.. c:type:: npy_cdouble
+
+ 64-bit complex double
+
+.. c:type:: npy_longdouble
long double
+.. c:type:: npy_clongdouble
+
+ long complex double
+
complex types are structures with **.real** and **.imag** members (in
that order).
diff --git a/doc/source/reference/c-api/iterator.rst b/doc/source/reference/c-api/iterator.rst
index ae96bb3fb..add96e3b4 100644
--- a/doc/source/reference/c-api/iterator.rst
+++ b/doc/source/reference/c-api/iterator.rst
@@ -370,7 +370,7 @@ Construction and Destruction
arrays or structured arrays containing an object type)
may be accepted and used in the iterator. If this flag
is enabled, the caller must be sure to check whether
- :c:func:`NpyIter_IterationNeedsAPI(iter)` is true, in which case
+ :c:expr:`NpyIter_IterationNeedsAPI(iter)` is true, in which case
it may not release the GIL during iteration.
.. c:macro:: NPY_ITER_ZEROSIZE_OK
@@ -738,7 +738,7 @@ Construction and Destruction
the iterator. Any cached functions or pointers from the iterator
must be retrieved again!
- After calling this function, :c:func:`NpyIter_HasMultiIndex(iter)` will
+ After calling this function, :c:expr:`NpyIter_HasMultiIndex(iter)` will
return false.
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
diff --git a/doc/source/reference/c-api/types-and-structures.rst b/doc/source/reference/c-api/types-and-structures.rst
index 763f985a6..ab82fda87 100644
--- a/doc/source/reference/c-api/types-and-structures.rst
+++ b/doc/source/reference/c-api/types-and-structures.rst
@@ -7,7 +7,7 @@ Python Types and C-Structures
Several new types are defined in the C-code. Most of these are
accessible from Python, but a few are not exposed due to their limited
-use. Every new Python type has an associated :c:type:`PyObject *<PyObject>` with an
+use. Every new Python type has an associated :c:expr:`PyObject *` with an
internal structure that includes a pointer to a "method table" that
defines how the new object behaves in Python. When you receive a
Python object into C code, you always get a pointer to a
@@ -61,7 +61,7 @@ hierarchy of actual Python types.
PyArray_Type and PyArrayObject
------------------------------
-.. c:var:: PyArray_Type
+.. c:var:: PyTypeObject PyArray_Type
The Python type of the ndarray is :c:data:`PyArray_Type`. In C, every
ndarray is a pointer to a :c:type:`PyArrayObject` structure. The ob_type
@@ -201,7 +201,7 @@ PyArray_Type and PyArrayObject
PyArrayDescr_Type and PyArray_Descr
-----------------------------------
-.. c:var:: PyArrayDescr_Type
+.. c:var:: PyTypeObject PyArrayDescr_Type
The :c:data:`PyArrayDescr_Type` is the built-in type of the
data-type-descriptor objects used to describe how the bytes comprising
@@ -636,7 +636,7 @@ PyArrayDescr_Type and PyArray_Descr
Either ``NULL`` or a dictionary containing low-level casting
functions for user- defined data-types. Each function is
- wrapped in a :c:type:`PyCapsule *<PyCapsule>` and keyed by
+ wrapped in a :c:expr:`PyCapsule *` and keyed by
the data-type number.
.. c:member:: NPY_SCALARKIND scalarkind(PyArrayObject* arr)
@@ -754,7 +754,7 @@ The :c:data:`PyArray_Type` can also be sub-typed.
PyUFunc_Type and PyUFuncObject
------------------------------
-.. c:var:: PyUFunc_Type
+.. c:var:: PyTypeObject PyUFunc_Type
The ufunc object is implemented by creation of the
:c:data:`PyUFunc_Type`. It is a very simple type that implements only
@@ -1006,7 +1006,7 @@ PyUFunc_Type and PyUFuncObject
PyArrayIter_Type and PyArrayIterObject
--------------------------------------
-.. c:var:: PyArrayIter_Type
+.. c:var:: PyTypeObject PyArrayIter_Type
This is an iterator object that makes it easy to loop over an
N-dimensional array. It is the object returned from the flat
@@ -1110,13 +1110,13 @@ the internal structure of the iterator object, and merely interact
with it through the use of the macros :c:func:`PyArray_ITER_NEXT` (it),
:c:func:`PyArray_ITER_GOTO` (it, dest), or :c:func:`PyArray_ITER_GOTO1D`
(it, index). All of these macros require the argument *it* to be a
-:c:type:`PyArrayIterObject *`.
+:c:expr:`PyArrayIterObject *`.
PyArrayMultiIter_Type and PyArrayMultiIterObject
------------------------------------------------
-.. c:var:: PyArrayMultiIter_Type
+.. c:var:: PyTypeObject PyArrayMultiIter_Type
This type provides an iterator that encapsulates the concept of
broadcasting. It allows :math:`N` arrays to be broadcast together
@@ -1178,7 +1178,7 @@ PyArrayMultiIter_Type and PyArrayMultiIterObject
PyArrayNeighborhoodIter_Type and PyArrayNeighborhoodIterObject
--------------------------------------------------------------
-.. c:var:: PyArrayNeighborhoodIter_Type
+.. c:var:: PyTypeObject PyArrayNeighborhoodIter_Type
This is an iterator object that makes it easy to loop over an
N-dimensional neighborhood.
@@ -1217,7 +1217,7 @@ PyArrayNeighborhoodIter_Type and PyArrayNeighborhoodIterObject
PyArrayFlags_Type and PyArrayFlagsObject
----------------------------------------
-.. c:var:: PyArrayFlags_Type
+.. c:var:: PyTypeObject PyArrayFlags_Type
When the flags attribute is retrieved from Python, a special
builtin object of this type is constructed. This special type makes
@@ -1466,7 +1466,7 @@ for completeness and assistance in understanding the code.
to define a 1-d loop for a ufunc for every defined signature of a
user-defined data-type.
-.. c:var:: PyArrayMapIter_Type
+.. c:var:: PyTypeObject PyArrayMapIter_Type
Advanced indexing is handled with this Python type. It is simply a
loose wrapper around the C-structure containing the variables
diff --git a/doc/source/reference/random/bit_generators/mt19937.rst b/doc/source/reference/random/bit_generators/mt19937.rst
index 71875db4e..d05ea7c6f 100644
--- a/doc/source/reference/random/bit_generators/mt19937.rst
+++ b/doc/source/reference/random/bit_generators/mt19937.rst
@@ -4,7 +4,8 @@ Mersenne Twister (MT19937)
.. currentmodule:: numpy.random
.. autoclass:: MT19937
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
State
=====
diff --git a/doc/source/reference/random/bit_generators/pcg64.rst b/doc/source/reference/random/bit_generators/pcg64.rst
index edac4620b..889965f77 100644
--- a/doc/source/reference/random/bit_generators/pcg64.rst
+++ b/doc/source/reference/random/bit_generators/pcg64.rst
@@ -4,7 +4,8 @@ Permuted Congruential Generator (64-bit, PCG64)
.. currentmodule:: numpy.random
.. autoclass:: PCG64
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
State
=====
diff --git a/doc/source/reference/random/bit_generators/philox.rst b/doc/source/reference/random/bit_generators/philox.rst
index 8eba2d351..3c2fa4cc5 100644
--- a/doc/source/reference/random/bit_generators/philox.rst
+++ b/doc/source/reference/random/bit_generators/philox.rst
@@ -4,7 +4,8 @@ Philox Counter-based RNG
.. currentmodule:: numpy.random
.. autoclass:: Philox
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
State
=====
diff --git a/doc/source/reference/random/bit_generators/sfc64.rst b/doc/source/reference/random/bit_generators/sfc64.rst
index d34124a33..8cb255bc1 100644
--- a/doc/source/reference/random/bit_generators/sfc64.rst
+++ b/doc/source/reference/random/bit_generators/sfc64.rst
@@ -4,7 +4,8 @@ SFC64 Small Fast Chaotic PRNG
.. currentmodule:: numpy.random
.. autoclass:: SFC64
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
State
=====
diff --git a/doc/source/reference/random/generator.rst b/doc/source/reference/random/generator.rst
index 8706e1de2..a359d2253 100644
--- a/doc/source/reference/random/generator.rst
+++ b/doc/source/reference/random/generator.rst
@@ -15,7 +15,8 @@ can be changed by passing an instantized BitGenerator to ``Generator``.
.. autofunction:: default_rng
.. autoclass:: Generator
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Accessing the BitGenerator
==========================
diff --git a/doc/source/reference/random/legacy.rst b/doc/source/reference/random/legacy.rst
index 6cf4775b8..42437dbb6 100644
--- a/doc/source/reference/random/legacy.rst
+++ b/doc/source/reference/random/legacy.rst
@@ -48,7 +48,8 @@ using the state of the `RandomState`:
.. autoclass:: RandomState
- :exclude-members:
+ :members: __init__
+ :exclude-members: __init__
Seeding and State
=================
diff --git a/doc/source/reference/routines.polynomials.rst b/doc/source/reference/routines.polynomials.rst
index e74c5a683..da481ae4c 100644
--- a/doc/source/reference/routines.polynomials.rst
+++ b/doc/source/reference/routines.polynomials.rst
@@ -9,24 +9,165 @@ of the `numpy.polynomial` package, introduced in NumPy 1.4.
Prior to NumPy 1.4, `numpy.poly1d` was the class of choice and it is still
available in order to maintain backward compatibility.
-However, the newer Polynomial package is more complete than `numpy.poly1d`
-and its convenience classes are better behaved in the numpy environment.
+However, the newer `polynomial package <numpy.polynomial>` is more complete
+and its `convenience classes <routines.polynomials.classes>` provide a
+more consistent, better-behaved interface for working with polynomial
+expressions.
Therefore :mod:`numpy.polynomial` is recommended for new coding.
-Transition notice
------------------
-The various routines in the Polynomial package all deal with
-series whose coefficients go from degree zero upward,
-which is the *reverse order* of the Poly1d convention.
-The easy way to remember this is that indexes
-correspond to degree, i.e., coef[i] is the coefficient of the term of
-degree i.
+.. note:: **Terminology**
+ The term *polynomial module* refers to the old API defined in
+ `numpy.lib.polynomial`, which includes the :class:`numpy.poly1d` class and
+ the polynomial functions prefixed with *poly* accessible from the `numpy`
+ namespace (e.g. `numpy.polyadd`, `numpy.polyval`, `numpy.polyfit`, etc.).
+
+ The term *polynomial package* refers to the new API definied in
+ `numpy.polynomial`, which includes the convenience classes for the
+ different kinds of polynomials (`numpy.polynomial.Polynomial`,
+ `numpy.polynomial.Chebyshev`, etc.).
+
+Transitioning from `numpy.poly1d` to `numpy.polynomial`
+-------------------------------------------------------
+
+As noted above, the :class:`poly1d class <numpy.poly1d>` and associated
+functions defined in ``numpy.lib.polynomial``, such as `numpy.polyfit`
+and `numpy.poly`, are considered legacy and should **not** be used in new
+code.
+Since NumPy version 1.4, the `numpy.polynomial` package is preferred for
+working with polynomials.
+
+Quick Reference
+~~~~~~~~~~~~~~~
+
+The following table highlights some of the main differences between the
+legacy polynomial module and the polynomial package for common tasks.
+The `~numpy.polynomial.polynomial.Polynomial` class is imported for brevity::
+
+ from numpy.polynomial import Polynomial
+
+
++------------------------+------------------------------+---------------------------------------+
+| **How to...** | Legacy (`numpy.poly1d`) | `numpy.polynomial` |
++------------------------+------------------------------+---------------------------------------+
+| Create a | ``p = np.poly1d([1, 2, 3])`` | ``p = Polynomial([3, 2, 1])`` |
+| polynomial object | | |
+| from coefficients [1]_ | | |
++------------------------+------------------------------+---------------------------------------+
+| Create a polynomial | ``r = np.poly([-1, 1])`` | ``p = Polynomial.fromroots([-1, 1])`` |
+| object from roots | ``p = np.poly1d(r)`` | |
++------------------------+------------------------------+---------------------------------------+
+| Fit a polynomial of | | |
+| degree ``deg`` to data | ``np.polyfit(x, y, deg)`` | ``Polynomial.fit(x, y, deg)`` |
++------------------------+------------------------------+---------------------------------------+
+
+
+.. [1] Note the reversed ordering of the coefficients
+
+Transition Guide
+~~~~~~~~~~~~~~~~
+
+There are significant differences between ``numpy.lib.polynomial`` and
+`numpy.polynomial`.
+The most significant difference is the ordering of the coefficients for the
+polynomial expressions.
+The various routines in `numpy.polynomial` all
+deal with series whose coefficients go from degree zero upward,
+which is the *reverse order* of the poly1d convention.
+The easy way to remember this is that indices
+correspond to degree, i.e., ``coef[i]`` is the coefficient of the term of
+degree *i*.
+
+Though the difference in convention may be confusing, it is straightforward to
+convert from the legacy polynomial API to the new.
+For example, the following demonstrates how you would convert a `numpy.poly1d`
+instance representing the expression :math:`x^{2} + 2x + 3` to a
+`~numpy.polynomial.polynomial.Polynomial` instance representing the same
+expression::
+
+ >>> p1d = np.poly1d([1, 2, 3])
+ >>> p = np.polynomial.Polynomial(p1d.coef[::-1])
+
+In addition to the ``coef`` attribute, polynomials from the polynomial
+package also have ``domain`` and ``window`` attributes.
+These attributes are most relevant when fitting
+polynomials to data, though it should be noted that polynomials with
+different ``domain`` and ``window`` attributes are not considered equal, and
+can't be mixed in arithmetic::
+
+ >>> p1 = np.polynomial.Polynomial([1, 2, 3])
+ >>> p1
+ Polynomial([1., 2., 3.], domain=[-1, 1], window=[-1, 1])
+ >>> p2 = np.polynomial.Polynomial([1, 2, 3], domain=[-2, 2])
+ >>> p1 == p2
+ False
+ >>> p1 + p2
+ Traceback (most recent call last):
+ ...
+ TypeError: Domains differ
+
+See the documentation for the
+`convenience classes <routines.polynomials.classes>`_ for further details on
+the ``domain`` and ``window`` attributes.
+
+Another major difference bewteen the legacy polynomial module and the
+polynomial package is polynomial fitting. In the old module, fitting was
+done via the `~numpy.polyfit` function. In the polynomial package, the
+`~numpy.polynomial.polynomial.Polynomial.fit` class method is preferred. For
+example, consider a simple linear fit to the following data:
+
+.. ipython:: python
+
+ rg = np.random.default_rng()
+ x = np.arange(10)
+ y = np.arange(10) + rg.standard_normal(10)
+
+With the legacy polynomial module, a linear fit (i.e. polynomial of degree 1)
+could be applied to these data with `~numpy.polyfit`:
+
+.. ipython:: python
+
+ np.polyfit(x, y, deg=1)
+
+With the new polynomial API, the `~numpy.polynomial.polynomial.Polynomial.fit`
+class method is preferred:
+
+.. ipython:: python
+
+ p_fitted = np.polynomial.Polynomial.fit(x, y, deg=1)
+ p_fitted
+
+Note that the coefficients are given *in the scaled domain* defined by the
+linear mapping between the ``window`` and ``domain``.
+`~numpy.polynomial.polynomial.Polynomial.convert` can be used to get the
+coefficients in the unscaled data domain.
+
+.. ipython:: python
+
+ p_fitted.convert()
+
+Documentation for the `~numpy.polynomial` Package
+-------------------------------------------------
+
+In addition to standard power series polynomials, the polynomial package
+provides several additional kinds of polynomials including Chebyshev,
+Hermite (two subtypes), Laguerre, and Legendre polynomials.
+Each of these has an associated
+`convenience class <routines.polynomials.classes>` available from the
+`numpy.polynomial` namespace that provides a consistent interface for working
+with polynomials regardless of their type.
.. toctree::
:maxdepth: 1
routines.polynomials.classes
+
+Documentation pertaining to specific functions defined for each kind of
+polynomial individually can be found in the corresponding module documentation:
+
+.. toctree::
+ :maxdepth: 1
+
routines.polynomials.polynomial
routines.polynomials.chebyshev
routines.polynomials.hermite
@@ -36,6 +177,9 @@ degree i.
routines.polynomials.polyutils
+Documentation for Legacy Polynomials
+------------------------------------
+
.. toctree::
:maxdepth: 2
diff --git a/doc/source/user/basics.rst b/doc/source/user/basics.rst
index e0fc0ece3..66f3f9ee9 100644
--- a/doc/source/user/basics.rst
+++ b/doc/source/user/basics.rst
@@ -1,14 +1,18 @@
-************
-NumPy basics
-************
+******************
+NumPy fundamentals
+******************
+
+These documents clarify concepts, design decisions, and technical
+constraints in NumPy. This is a great place to understand the
+fundamental NumPy ideas and philosophy.
.. toctree::
:maxdepth: 1
- basics.types
basics.creation
- basics.io
basics.indexing
+ basics.io
+ basics.types
basics.broadcasting
basics.byteswapping
basics.rec
diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/c-info.beyond-basics.rst
index 124162d6c..289a7951b 100644
--- a/doc/source/user/c-info.beyond-basics.rst
+++ b/doc/source/user/c-info.beyond-basics.rst
@@ -172,8 +172,8 @@ iterators so that all that needs to be done to advance to the next element in
each array is for PyArray_ITER_NEXT to be called for each of the inputs. This
incrementing is automatically performed by
:c:func:`PyArray_MultiIter_NEXT` ( ``obj`` ) macro (which can handle a
-multiterator ``obj`` as either a :c:type:`PyArrayMultiObject *` or a
-:c:type:`PyObject *<PyObject>`). The data from input number ``i`` is available using
+multiterator ``obj`` as either a :c:expr:`PyArrayMultiObject *` or a
+:c:expr:`PyObject *`). The data from input number ``i`` is available using
:c:func:`PyArray_MultiIter_DATA` ( ``obj``, ``i`` ) and the total (broadcasted)
size as :c:func:`PyArray_MultiIter_SIZE` ( ``obj``). An example of using this
feature follows.
@@ -400,7 +400,7 @@ describe the desired behavior of the type. Typically, a new
C-structure is also created to contain the instance-specific
information needed for each object of the type as well. For example,
:c:data:`&PyArray_Type<PyArray_Type>` is a pointer to the type-object table for the ndarray
-while a :c:type:`PyArrayObject *` variable is a pointer to a particular instance
+while a :c:expr:`PyArrayObject *` variable is a pointer to a particular instance
of an ndarray (one of the members of the ndarray structure is, in
turn, a pointer to the type- object table :c:data:`&PyArray_Type<PyArray_Type>`). Finally
:c:func:`PyType_Ready` (<pointer_to_type_object>) must be called for
diff --git a/doc/source/user/c-info.how-to-extend.rst b/doc/source/user/c-info.how-to-extend.rst
index 845ce0a74..ebb4b7518 100644
--- a/doc/source/user/c-info.how-to-extend.rst
+++ b/doc/source/user/c-info.how-to-extend.rst
@@ -174,7 +174,7 @@ rule. There are several converter functions defined in the NumPy C-API
that may be of use. In particular, the :c:func:`PyArray_DescrConverter`
function is very useful to support arbitrary data-type specification.
This function transforms any valid data-type Python object into a
-:c:type:`PyArray_Descr *` object. Remember to pass in the address of the
+:c:expr:`PyArray_Descr *` object. Remember to pass in the address of the
C-variables that should be filled in.
There are lots of examples of how to use :c:func:`PyArg_ParseTuple`
@@ -192,7 +192,7 @@ It is important to keep in mind that you get a *borrowed* reference to
the object when using the "O" format string. However, the converter
functions usually require some form of memory handling. In this
example, if the conversion is successful, *dtype* will hold a new
-reference to a :c:type:`PyArray_Descr *` object, while *input* will hold a
+reference to a :c:expr:`PyArray_Descr *` object, while *input* will hold a
borrowed reference. Therefore, if this conversion were mixed with
another conversion (say to an integer) and the data-type conversion
was successful but the integer conversion failed, then you would need
@@ -213,9 +213,9 @@ The :c:func:`Py_BuildValue` (format_string, c_variables...) function makes
it easy to build tuples of Python objects from C variables. Pay
special attention to the difference between 'N' and 'O' in the format
string or you can easily create memory leaks. The 'O' format string
-increments the reference count of the :c:type:`PyObject *<PyObject>` C-variable it
+increments the reference count of the :c:expr:`PyObject *` C-variable it
corresponds to, while the 'N' format string steals a reference to the
-corresponding :c:type:`PyObject *<PyObject>` C-variable. You should use 'N' if you have
+corresponding :c:expr:`PyObject *` C-variable. You should use 'N' if you have
already created a reference for the object and just want to give that
reference to the tuple. You should use 'O' if you only have a borrowed
reference to an object and need to create one to provide for the
@@ -510,7 +510,7 @@ by providing default values for common use cases.
Getting at ndarray memory and accessing elements of the ndarray
---------------------------------------------------------------
-If obj is an ndarray (:c:type:`PyArrayObject *`), then the data-area of the
+If obj is an ndarray (:c:expr:`PyArrayObject *`), then the data-area of the
ndarray is pointed to by the void* pointer :c:func:`PyArray_DATA` (obj) or
the char* pointer :c:func:`PyArray_BYTES` (obj). Remember that (in general)
this data-area may not be aligned according to the data-type, it may
diff --git a/doc/source/user/theory.broadcasting.rst b/doc/source/user/theory.broadcasting.rst
index b37edeacc..a82d78e6c 100644
--- a/doc/source/user/theory.broadcasting.rst
+++ b/doc/source/user/theory.broadcasting.rst
@@ -69,7 +69,7 @@ numpy on Windows 2000 with one million element arrays.
*Figure 1*
*In the simplest example of broadcasting, the scalar ``b`` is
- stretched to become an array of with the same shape as ``a`` so the shapes
+ stretched to become an array of same shape as ``a`` so the shapes
are compatible for element-by-element multiplication.*