diff --git a/ufl/tensors.py b/ufl/tensors.py index 3b956e1a5..5b821f792 100644 --- a/ufl/tensors.py +++ b/ufl/tensors.py @@ -61,7 +61,7 @@ def __new__(cls, *expressions): # Simplify [v[0], v[1], ..., v[k]] -> v if ( all(isinstance(e, Indexed) for e in expressions) - and e0.ufl_operands[0].ufl_shape == (len(expressions),) + and e0.ufl_operands[0].ufl_shape[0] == len(expressions) and all(e.ufl_operands[0] == e0.ufl_operands[0] for e in expressions) ): indices = list(chain.from_iterable(e.ufl_operands[1].indices() for e in expressions))