From 2eb0b12b75363f539870a09e155bf8e7a6ca8afa Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 26 Nov 2020 12:08:23 +0100 Subject: DOC: Clarify docs of np.resize(). - Iteration is done in C-order, not in memory storage order, and does not disregard strides during iteration (the implementation starts with calling `ravel()`). - This applies even when the new shape is larger, except that on top of that there's cycling in that case. The previous wording made it sound like "larger" was handled completely differently. --- numpy/core/fromnumeric.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index d65e26827..efb052bc2 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1375,7 +1375,7 @@ def resize(a, new_shape): reshaped_array : ndarray The new array is formed from the data in the old array, repeated if necessary to fill out the required number of elements. The - data are repeated in the order that they are stored in memory. + data are repeated iterating over the array in C-order. See Also -------- @@ -1392,11 +1392,11 @@ def resize(a, new_shape): Warning: This functionality does **not** consider axes separately, i.e. it does not apply interpolation/extrapolation. - It fills the return array with the required number of elements, taken - from `a` as they are laid out in memory, disregarding strides and axes. - (This is in case the new shape is smaller. For larger, see above.) - This functionality is therefore not suitable to resize images, - or data where each axis represents a separate and distinct entity. + It fills the return array with the required number of elements, iterating + over `a` in C-order, disregarding axes (and cycling back from the start if + the new shape is larger). This functionality is therefore not suitable to + resize images, or data where each axis represents a separate and distinct + entity. Examples -------- -- cgit v1.2.1