[Numpy-discussion] Catching out-of-memory error before it happens
Daπid
davidmenhur at gmail.com
Sat Jan 25 10:48:05 EST 2014
On 24 January 2014 23:09, Dinesh Vadhia <dineshbvadhia at hotmail.com> wrote:
> Francesc: Thanks. I looked at numexpr a few years back but it didn't
> support array slicing/indexing. Has that changed?
>
No, but you can do it yourself.
big_array = np.empty(20000)
piece = big_array[30:-50]
ne.evaluate('sqrt(piece)')
Here, creating "piece" does not increase memory use, as slicing shares the
original data (well, actually, it adds a mere 80 bytes, the overhead of an
array).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140125/6646ac21/attachment.html>
More information about the NumPy-Discussion
mailing list