numexpr icon indicating copy to clipboard operation
numexpr copied to clipboard

-sum(a) does not work

Open FrancescAlted opened this issue 11 years ago • 3 comments

From [email protected] on March 19, 2012 15:03:51

import numexpr as ne

ne.evaluate('-sum(1)') ne.evaluate('-1_sum(1)') ne.evaluate('sum(1)_(-1)')

All of these fail with the following message.

RuntimeError: invalid program: reduction operations must occur last

This bug does not happen if 'sum' is replaced with 'abs', 'exp', or 'log', and presumably all the other ones.

This is on numexpr version 2.0.1.

Original issue: http://code.google.com/p/numexpr/issues/detail?id=76

FrancescAlted avatar Jan 22 '14 10:01 FrancescAlted

From [email protected] on March 19, 2012 07:15:50

Looks like replacing 'sum' with 'prod' also reproduces the error message.

FrancescAlted avatar Jan 22 '14 10:01 FrancescAlted

From [email protected] on March 19, 2012 09:31:26

Hmm, I just realized this behavior may be intended. I can't find documentation on it though.

FrancescAlted avatar Jan 22 '14 10:01 FrancescAlted

From [email protected] on April 29, 2013 03:38:09

Yes, this is a known limitation. Now it is properly documented in a new note in: https://code.google.com/p/numexpr/wiki/UsersGuide?ts=1367231786&updated=UsersGuide#Supported_reduction_operations

Status: Accepted

FrancescAlted avatar Jan 22 '14 10:01 FrancescAlted

Message to comment on stale issues. If none provided, will not mark issues stale

github-actions[bot] avatar Feb 23 '24 01:02 github-actions[bot]