summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorNathaniel J. Smith <njs@pobox.com>2012-05-19 16:27:01 +0100
committerNathaniel J. Smith <njs@pobox.com>2012-06-16 10:45:39 +0100
commit3626d0c4fe510d615ef3e5ef3cf4ed2bfb52b53e (patch)
tree53a99985deb79a13c103fcd8f01687593819657b /numpy/add_newdocs.py
parent605c2b45caa8838716b736e322f9e1b5d347daba (diff)
downloadnumpy-3626d0c4fe510d615ef3e5ef3cf4ed2bfb52b53e.tar.gz
Remove PyArray_ReduceWrapper from public API
There are two reasons to want to keep PyArray_ReduceWrapper out of the public multiarray API: - Its signature is likely to change if/when masked arrays are added - It is essentially a wrapper for array->scalar transformations (*not* just reductions as its name implies -- the whole reason it is in multiarray.so in the first place is to support count_nonzero, which is not actually a reduction!). It provides some nice conveniences (like making it easy to apply such functions to multiple axes simultaneously), but, we already have a general mechanism for writing array->scalar transformations -- generalized ufuncs. We do not want to have two independent, redundant implementations of this functionality, one in multiarray and one in umath! So in the long run we should add these nice features to the generalized ufunc machinery. And in the short run, we shouldn't add it to the public API and commit ourselves to supporting it. However, simply removing it from numpy_api.py is not easy, because this code was used in both multiarray and umath. This commit: - Moves ReduceWrapper and supporting code to umath/, and makes appropriate changes (e.g. renaming it to PyUFunc_ReduceWrapper and cleaning up the header files). - Reverts numpy.count_nonzero to its previous implementation, so that it loses the new axis= and keepdims= arguments. This is unfortunate, but this change isn't so urgent that it's worth tying our APIs in knots forever. (Perhaps in the future it can become a generalized ufunc.)
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py13
1 files changed, 0 insertions, 13 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index b8223f7c6..f550e2d41 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -901,14 +901,6 @@ add_newdoc('numpy.core.multiarray', 'count_nonzero',
----------
a : array_like
The array for which to count non-zeros.
- axis : None or int or tuple of ints, optional
- Axis or axes along which a reduction is performed.
- The default (`axis` = None) is perform a reduction over all
- the dimensions of the input array.
- keepdims : bool, optional
- If this is set to True, the axes which are reduced are left
- in the result as dimensions with size one. With this option,
- the result will broadcast correctly against the original `arr`.
Returns
-------
@@ -925,11 +917,6 @@ add_newdoc('numpy.core.multiarray', 'count_nonzero',
4
>>> np.count_nonzero([[0,1,7,0,0],[3,0,0,2,19]])
5
- >>> np.count_nonzero([[0,1,7,0,0],[3,0,0,2,19]], axis=1)
- array([2, 3])
- >>> np.count_nonzero([[0,1,7,0,0],[3,0,0,2,19]], axis=1, keepdims=True)
- array([[2],
- [3]])
""")
add_newdoc('numpy.core.multiarray','set_typeDict',