[Numpy-discussion] MemoryError with fancy indexing

Sebastian Haase seb.haase at gmail.com
Wed Sep 30 10:08:13 EDT 2009


Hi,

Maybe someone could explain to me what is going on here!?
>>> N.who()
Name            Shape             Bytes            Type
============================================================
SLmap           2048 x 2048       16777216         int32
SLmap_fast      2048 x 2048       16777216         int32
SLmap_slow      2048 x 2048       16777216         int32
<snip>
>>> SLmap[:]=0
>>> SLmap[SLmap_fast]|=2
Traceback (most recent call last):
  File "<input>", line 1, in <module>
MemoryError
>>> SLmap[SLmap_fast]=2
>>> SLmap[SLmap_slow]+=1
Traceback (most recent call last):
  File "<input>", line 1, in <module>
MemoryError
>>> SLmap[SLmap_fast.astype(N.bool)]+=2

>>> SLmap[:]=0
>>> SLmap[SLmap_fast.astype(bool)]|=2
>>> SLmap[SLmap_slow.astype(bool)]|=1
>>>

Why do I run into memory problems using an int32 array as index -
while not having any problem when converting it first to dtype=bool ?
(I'm on 64-bit Linux, having many GBs physical ram)

Thanks,
Sebastian Haase



More information about the NumPy-Discussion mailing list