diff --git a/pytato/array.py b/pytato/array.py index be55c4ecbd00cea69749bdb56738aae23a228b04..1b5406f163b444070f0eaf1435e4a899f29470eb 100644 --- a/pytato/array.py +++ b/pytato/array.py @@ -684,6 +684,10 @@ class Array: indices = tuple(var(f"_{i}") for i in range(self.ndim)) return val[indices] + if isinstance(other, Array): + if self.namespace is not other.namespace: + raise ValueError("Operands must belong to the same namespace.") + if isinstance(other, Number): first_expr = add_indices(var("_in0")) second_expr = other @@ -931,7 +935,7 @@ class IndexLambda(_SuppliedShapeAndDtypeMixin, Array): else: return False - if index != tuple(var("_%d") % i for i in range(len(self.shape))): + if index != tuple(var("_%d" % i) for i in range(len(self.shape))): return False try: