[Numpy-discussion] index partition
Alan G Isaac
alan.isaac at gmail.com
Mon Apr 14 12:17:35 EDT 2014
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 advantage over a boolean mask.
I take it that by a lack of a memory advantage you mean
because boolean arrays are 8 bit representations.
That makes sense.
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 a[indexes]? (I'm just asking, not suggesting.)
Thanks!
Alan
More information about the NumPy-Discussion
mailing list