summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/reference/arrays.indexing.rst4
-rw-r--r--doc/source/reference/arrays.ndarray.rst8
-rw-r--r--doc/source/reference/arrays.scalars.rst15
-rw-r--r--doc/source/reference/c-api.array.rst8
-rw-r--r--doc/source/reference/maskedarray.baseclass.rst2
-rw-r--r--doc/source/user/quickstart.rst27
6 files changed, 33 insertions, 31 deletions
diff --git a/doc/source/reference/arrays.indexing.rst b/doc/source/reference/arrays.indexing.rst
index b7bc3a655..6a5f428da 100644
--- a/doc/source/reference/arrays.indexing.rst
+++ b/doc/source/reference/arrays.indexing.rst
@@ -36,8 +36,8 @@ objects, the :const:`Ellipsis` object, or the :const:`newaxis` object,
but not for integer arrays or other embedded sequences.
.. index::
- triple: ndarray; special methods; getslice
- triple: ndarray; special methods; setslice
+ triple: ndarray; special methods; getitem
+ triple: ndarray; special methods; setitem
single: ellipsis
single: newaxis
diff --git a/doc/source/reference/arrays.ndarray.rst b/doc/source/reference/arrays.ndarray.rst
index 14d35271e..4c8bbf66d 100644
--- a/doc/source/reference/arrays.ndarray.rst
+++ b/doc/source/reference/arrays.ndarray.rst
@@ -119,12 +119,12 @@ strided scheme, and correspond to memory that can be *addressed* by the strides:
.. math::
- s_k^{\mathrm{column}} = \prod_{j=0}^{k-1} d_j ,
- \quad s_k^{\mathrm{row}} = \prod_{j=k+1}^{N-1} d_j .
+ s_k^{\mathrm{column}} = \mathrm{itemsize} \prod_{j=0}^{k-1} d_j ,
+ \quad s_k^{\mathrm{row}} = \mathrm{itemsize} \prod_{j=k+1}^{N-1} d_j .
.. index:: single-segment, contiguous, non-contiguous
-where :math:`d_j` `= self.itemsize * self.shape[j]`.
+where :math:`d_j` `= self.shape[j]`.
Both the C and Fortran orders are :term:`contiguous`, *i.e.,*
:term:`single-segment`, memory layouts, in which every part of the
@@ -595,8 +595,6 @@ Container customization: (see :ref:`Indexing <arrays.indexing>`)
ndarray.__len__
ndarray.__getitem__
ndarray.__setitem__
- ndarray.__getslice__
- ndarray.__setslice__
ndarray.__contains__
Conversion; the operations :func:`complex()`, :func:`int()`,
diff --git a/doc/source/reference/arrays.scalars.rst b/doc/source/reference/arrays.scalars.rst
index 4acaf1b3b..f76087ce2 100644
--- a/doc/source/reference/arrays.scalars.rst
+++ b/doc/source/reference/arrays.scalars.rst
@@ -248,7 +248,8 @@ Indexing
Array scalars can be indexed like 0-dimensional arrays: if *x* is an
array scalar,
-- ``x[()]`` returns a 0-dimensional :class:`ndarray`
+- ``x[()]`` returns a copy of array scalar
+- ``x[...]`` returns a 0-dimensional :class:`ndarray`
- ``x['field-name']`` returns the array scalar in the field *field-name*.
(*x* can have fields, for example, when it corresponds to a structured data type.)
@@ -282,10 +283,10 @@ Defining new types
==================
There are two ways to effectively define a new array scalar type
-(apart from composing structured types :ref:`dtypes <arrays.dtypes>` from
-the built-in scalar types): One way is to simply subclass the
-:class:`ndarray` and overwrite the methods of interest. This will work to
-a degree, but internally certain behaviors are fixed by the data type of
-the array. To fully customize the data type of an array you need to
-define a new data-type, and register it with NumPy. Such new types can only
+(apart from composing structured types :ref:`dtypes <arrays.dtypes>` from
+the built-in scalar types): One way is to simply subclass the
+:class:`ndarray` and overwrite the methods of interest. This will work to
+a degree, but internally certain behaviors are fixed by the data type of
+the array. To fully customize the data type of an array you need to
+define a new data-type, and register it with NumPy. Such new types can only
be defined in C, using the :ref:`NumPy C-API <c-api>`.
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst
index 3574282a4..2a7bb3a32 100644
--- a/doc/source/reference/c-api.array.rst
+++ b/doc/source/reference/c-api.array.rst
@@ -1686,12 +1686,12 @@ Shape Manipulation
different total number of elements then the old shape. If
reallocation is necessary, then *self* must own its data, have
*self* - ``>base==NULL``, have *self* - ``>weakrefs==NULL``, and
- (unless refcheck is 0) not be referenced by any other array. A
- reference to the new array is returned. The fortran argument can
- be :c:data:`NPY_ANYORDER`, :c:data:`NPY_CORDER`, or
- :c:data:`NPY_FORTRANORDER`. It currently has no effect. Eventually
+ (unless refcheck is 0) not be referenced by any other array.
+ The fortran argument can be :c:data:`NPY_ANYORDER`, :c:data:`NPY_CORDER`,
+ or :c:data:`NPY_FORTRANORDER`. It currently has no effect. Eventually
it could be used to determine how the resize operation should view
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)
diff --git a/doc/source/reference/maskedarray.baseclass.rst b/doc/source/reference/maskedarray.baseclass.rst
index a1c90a45d..f35b0ea88 100644
--- a/doc/source/reference/maskedarray.baseclass.rst
+++ b/doc/source/reference/maskedarray.baseclass.rst
@@ -417,8 +417,6 @@ Container customization: (see :ref:`Indexing <arrays.indexing>`)
MaskedArray.__getitem__
MaskedArray.__setitem__
MaskedArray.__delitem__
- MaskedArray.__getslice__
- MaskedArray.__setslice__
MaskedArray.__contains__
diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst
index 65840c724..f69eb3ace 100644
--- a/doc/source/user/quickstart.rst
+++ b/doc/source/user/quickstart.rst
@@ -713,27 +713,32 @@ Several arrays can be stacked together along different axes::
The function `column_stack`
stacks 1D arrays as columns into a 2D array. It is equivalent to
-`vstack` only for 1D arrays::
+`hstack` only for 2D arrays::
>>> from numpy import newaxis
- >>> np.column_stack((a,b)) # With 2D arrays
+ >>> np.column_stack((a,b)) # with 2D arrays
array([[ 8., 8., 1., 8.],
[ 0., 0., 0., 4.]])
>>> a = np.array([4.,2.])
- >>> b = np.array([2.,8.])
- >>> a[:,newaxis] # This allows to have a 2D columns vector
+ >>> b = np.array([3.,8.])
+ >>> np.column_stack((a,b)) # returns a 2D array
+ array([[ 4., 3.],
+ [ 2., 8.]])
+ >>> np.hstack((a,b)) # the result is different
+ array([ 4., 2., 3., 8.])
+ >>> a[:,newaxis] # this allows to have a 2D columns vector
array([[ 4.],
[ 2.]])
>>> np.column_stack((a[:,newaxis],b[:,newaxis]))
- array([[ 4., 2.],
+ array([[ 4., 3.],
+ [ 2., 8.]])
+ >>> np.hstack((a[:,newaxis],b[:,newaxis])) # the result is the same
+ array([[ 4., 3.],
[ 2., 8.]])
- >>> np.vstack((a[:,newaxis],b[:,newaxis])) # The behavior of vstack is different
- array([[ 4.],
- [ 2.],
- [ 2.],
- [ 8.]])
-For arrays of with more than two dimensions,
+On the other hand, the function `row_stack` is equivalent to `vstack`
+for any input arrays.
+In general, for arrays of with more than two dimensions,
`hstack` stacks along their second
axes, `vstack` stacks along their
first axes, and `concatenate`