remove AndNode.__floordiv__ special case (#2996)

* remove AndNode.__floordiv__

AndNode produces a Node that min/max is bounded by [0, 1] so `//` on top of that is almost always 0.
we don't really use that either

* keep the test
This commit is contained in:
chenyu
2024-01-03 17:44:55 -05:00
committed by GitHub
parent a0c7cb2564
commit 74cc6fd3c2
2 changed files with 1 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ class TestSymbolic(unittest.TestCase):
self.helper_test_variable(expr, 0, 1, "((idx1<128) and (idx2<128))")
expr = Node.ands([(Variable("idx1", 0, 511)*4 + Variable("FLOAT4_INDEX", 0, 3)) < 512,
(Variable("idx2", 0, 511)*4 + Variable("FLOAT8_INDEX", 0, 7)) < 512])
self.helper_test_variable(expr//4, 0, 1, "((((FLOAT8_INDEX//4)+idx2)<128) and ((idx1//4)<32))")
self.helper_test_variable(expr//4, 0, 0, "0")
def test_lt_factors(self):
expr = Node.ands([(Variable("idx1", 0, 511)*4 + Variable("FLOAT4_INDEX", 0, 256)) < 512])

View File

@@ -291,7 +291,6 @@ class SumNode(RedNode):
def flat_components(self): return [y for x in self.nodes for y in (x.flat_components if isinstance(x, SumNode) else [x])]
class AndNode(RedNode):
def __floordiv__(self, b: Union[Node, int], _=True): return Node.ands([x//b for x in self.nodes])
def substitute(self, var_vals: Dict[Variable, Node]) -> Node:
subed = []
for node in self.nodes: