From ec18618813bd28f66f8e2d2b05c27b4e02c26efe Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Tue, 29 Sep 2020 23:03:00 -0500 Subject: [PATCH 1/2] check namespace equivalence for arrays a, b in "a op b" --- pytato/array.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytato/array.py b/pytato/array.py index be55c4e..8f9d1c8 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 -- GitLab From 6402f6ff4aad3c8dc79272e38f946a7fddd3fe3b Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Tue, 29 Sep 2020 23:03:15 -0500 Subject: [PATCH 2/2] fix typo --- pytato/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytato/array.py b/pytato/array.py index 8f9d1c8..1b5406f 100644 --- a/pytato/array.py +++ b/pytato/array.py @@ -935,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: -- GitLab