Skip to content

Commit

Permalink
Fix symmetry bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Feb 15, 2025
1 parent 1ab30c2 commit 93f9ad8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ufl/tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def sub(e, *indices):
return sub(e0, 0) if j == () else sub(e0, 0)[(*j, slice(None))]
except ValueError:
pass

# Simplify [v[0,:], v[1,:], ..., v[k,:]] -> v
if (
all(
Expand All @@ -85,7 +84,8 @@ def sub(e, *indices):
and all(sub(e, 0, 0) == sub(e0, 0, 0) for e in expressions[1:])
):
indices = [sub(e, 0, 1).indices() for e in expressions]
if all(i[0] == k for k, i in enumerate(indices)):
if all(i[0] == k and all(isinstance(subindex, Index) for subindex in i[1:])
for k, i in enumerate(indices)):
return sub(e0, 0, 0)

# Construct a new instance to be initialised
Expand Down

0 comments on commit 93f9ad8

Please sign in to comment.