diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-17 17:06:54 -0800 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-17 17:06:54 -0800 |
commit | e916b9e44c1732fba94393056f80093a0e775134 (patch) | |
tree | 05f88fcccf3951f01451235e09f7d675f458af19 /numpy/add_newdocs.py | |
parent | 22d96096bf7d5fb199ca80f2fcd04e8d27815476 (diff) | |
download | numpy-e916b9e44c1732fba94393056f80093a0e775134.tar.gz |
ENH: core: Change PyArray_CopyAnyInto and PyArray_MoveAnyInto to use the new iterator
I also found that the tricky case of CopyAnyInto wasn't being triggered
by the test suite, so added a new function ndarray.setasflat, which
calls CopyAnyInto.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r-- | numpy/add_newdocs.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 2faf3ba16..5e6a07bb0 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -2642,6 +2642,37 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('itemset', """)) +add_newdoc('numpy.core.multiarray', 'ndarray', ('setasflat', + """ + a.setasflat(arr) + + Equivalent to a.flat = arr.flat, but is generally more efficient. + This function does not check for overlap, so if ``arr`` and ``a`` + are viewing the same data with different strides, the results will + be unpredictable. + + Parameters + ---------- + arr : array_like + The array to copy into a. + + Examples + -------- + >>> a = np.arange(2*4).reshape(2,4)[:,:-1]; a + array([[0, 1, 2], + [4, 5, 6]]) + >>> b = np.arange(3*3, dtype='f4').reshape(3,3).T[::-1,:-1]; b + array([[ 2., 5.], + [ 1., 4.], + [ 0., 3.]], dtype=float32) + >>> a.setasflat(b) + >>> a + array([[2, 5, 1], + [4, 0, 3]]) + + """)) + + add_newdoc('numpy.core.multiarray', 'ndarray', ('max', """ a.max(axis=None, out=None) |