
numexpr - issue #96
Algebra for boolean values doesn't work on arrays (interpret as 0 / 1 integer)
What steps will reproduce the problem? 1. a = arange(10) 2. numexpr.evaluate('(a == a) + (a == a)')
What is the expected output? What do you see instead? boolean array of length 10 with values 2. Python also treats boolean values as integers for addition / multiplication
What version of the product are you using? On what operating system? numexpr 1.4.2 on Ubuntu 12.04 64bit
Please provide any additional information below. Workaround would be numexpr.evaluate('1 * (a == a) + (a == a)') which causes a cast to integer. In this specific case i used boolean algebra as a workaround to implement sign(): sign(a) := (a > 0) - (a < 0)
Comment #1
Posted on Feb 8, 2013 by Swift DogComment deleted
Status: New
Labels:
Type-Defect
Priority-Medium