diff --git a/loopy/library/reduction.py b/loopy/library/reduction.py index 865ed1d66fd060716743b0c8ee499c3b05f017cb..650d1e45218ff21a8140288cb3e84762b98046ef 100644 --- a/loopy/library/reduction.py +++ b/loopy/library/reduction.py @@ -40,6 +40,14 @@ class ReductionOperation(object): def neutral_element(self, dtype, inames): raise NotImplementedError + def __hash__(self): + # Force subclasses to override + raise NotImplementedError + + def __eq__(self, other): + # Force subclasses to override + raise NotImplementedError + def __call__(self, dtype, operand1, operand2, inames): raise NotImplementedError @@ -142,6 +150,12 @@ class _ArgExtremumReductionOperation(ReductionOperation): def neutral_element(self, dtype, inames): return ArgExtFunction(self, dtype, "init", inames)() + def __hash__(self): + return hash(type(self)) + + def __eq__(self, other): + return type(self) == type(other) + def __call__(self, dtype, operand1, operand2, inames): iname, = inames