diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-08-05 07:50:50 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-08-05 07:50:50 +0000 |
commit | d372798ae6bf88c3a4414027341d2b0322941c68 (patch) | |
tree | f0df1e8e8de70e6f0240cceee251838c31fcf864 /numpy/core/numeric.py | |
parent | 3457ac34f84f502de194ad825c0db4cb0d56dc82 (diff) | |
download | numpy-d372798ae6bf88c3a4414027341d2b0322941c68.tar.gz |
Move location of flatnonzero
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 9 |
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} |