summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 252ba70cd..aaf8989c3 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -16,7 +16,7 @@ __all__ = ['newaxis', 'ndarray', 'flatiter', 'ufunc',
'load', 'loads', 'isscalar', 'binary_repr', 'base_repr',
'ones', 'identity', 'allclose',
'seterr', 'geterr', 'setbufsize', 'getbufsize',
- 'seterrcall', 'geterrcall',
+ 'seterrcall', 'geterrcall', 'flatnonzero',
'Inf', 'inf', 'infty', 'Infinity',
'nan', 'NaN', 'False_', 'True_']
@@ -178,6 +178,13 @@ def argwhere(a):
"""
return transpose(a.nonzero())
+def flatnonzero(a):
+ """Return indicies that are not-zero in flattened version of a
+
+ Equivalent to a.ravel().nonzero()[0]
+ """
+ return a.ravel().nonzero()[0]
+
_mode_from_name_dict = {'v': 0,
's' : 1,
'f' : 2}