On 14 April 2014 18:17, Alan G Isaac alan.is...@gmail.com wrote:
I find it rather more convenient to use boolean arrays,
but I wonder if arrays of indexes might have other
advantages (which would suggest using the set operations
instead). In particular, might a[boolean_array] be slower
that
On 4/12/2014 5:20 PM, Alexander Belopolsky wrote:
The set routines [1] are in this category and may help
you deal with partitions, but I would recommend using
boolean arrays instead. If you commonly deal with both
a subset and a complement, set representation does not
give you a memory
From a 1d array, I want two arrays of indexes:
the first for elements that satisfy a criterion,
and the second for elements that do not. Naturally
there are many ways to do this. Is there a preferred way?
As a simple example, suppose for array `a` I want
np.flatnonzero(a0) and
On Sat, Apr 12, 2014 at 4:47 PM, Alan G Isaac alan.is...@gmail.com wrote:
As a simple example, suppose for array `a` I want
np.flatnonzero(a0) and np.flatnonzero(a=0).
Can I get them both in one go?
I don't think you can do better than
x = a 0
p, q = np.flatnonzero(x), np.flatnonzero(~x)
On Sa, 2014-04-12 at 16:47 -0400, Alan G Isaac wrote:
From a 1d array, I want two arrays of indexes:
the first for elements that satisfy a criterion,
and the second for elements that do not. Naturally
there are many ways to do this. Is there a preferred way?
As a simple example, suppose
On Sat, Apr 12, 2014 at 5:03 PM, Sebastian Berg
sebast...@sipsolutions.netwrote:
As a simple example, suppose for array `a` I want
np.flatnonzero(a0) and np.flatnonzero(a=0).
Can I get them both in one go?
Might be missing something, but I don't think there is a way to do it in
one go.