Is it safe in python numexpr to assign values to the same array you are operating on to avoid creating a temporary array?
From the description of memory usage on the project homepage it looks okay, but without diving into the source code, that is hardly a solid answer.
I tried the following which works fine, but I am hoping for confirmation from someone more familiar with this package:
import numpy as np
import numexpr as ne
a = np.ones(5)
b = a.copy()
ne.evaluate("a+b",out=a)
array([ 2., 2., 2., 2., 2.])
np.add(a, b, out=a)
.numexpr
is extremely nice, but it is possible to avoid temporary arrays without it, if you don't want another dependency. – Engrail