Skip to content

Commit

Permalink
Fix for Delta(int, Index)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Jan 22, 2025
1 parent fdff8da commit e77ed6f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gem/gem.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,12 @@ 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):
return Indexed(Identity(j.extent), (i, j))

if isinstance(j, Integral):
return Indexed(Identity(i.extent), (i, j))

self = super(Delta, cls).__new__(cls)
self.i = i
self.j = j
Expand Down

0 comments on commit e77ed6f

Please sign in to comment.