From 6714e0b601486d1a0d24efda661ad12b6a7347ac Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Fri, 8 Aug 2025 17:58:36 +0100 Subject: [PATCH] GEM: Fix Delta performance regression --- gem/gem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gem/gem.py b/gem/gem.py index 974556754..f3cf45900 100644 --- a/gem/gem.py +++ b/gem/gem.py @@ -985,10 +985,10 @@ def __new__(cls, i, j, dtype=None): if isinstance(i, Integral) and isinstance(j, Integral): return one if i == j else Zero() - if isinstance(i, Integral): + if isinstance(i, Integral) and not isinstance(j, Index): return Indexed(Literal(numpy.eye(j.extent)[i]), (j,)) - if isinstance(j, Integral): + if isinstance(j, Integral) and not isinstance(i, Index): return Indexed(Literal(numpy.eye(i.extent)[j]), (i,)) self = super(Delta, cls).__new__(cls)