I am currently working with large numpy array multiplications, using numpy.einsum
, and have been facing MemoryError
issue. That is why I'm trying to evaluate expressions, wherever possible, with numexpr
. As far as I understand:
np.einsum('ij,j -> ij', a, b)
is technically the same as
numexpr.evaluate("a*b")
However, things seems to be not so straightforward in other cases. Suppose I have three expressions:
np.einsum('i, j -> ij', a, b)
np.einsum('ij, i -> ij', a, b)
np.einsum(ijk, kl -> ijkl', a, b)
What would be the equivalent way of achieving these three using numexpr
?