From dea361c6f87d3b4ed46b09621e49cdb95c3c71d2 Mon Sep 17 00:00:00 2001 From: George Bisbas Date: Fri, 8 Sep 2023 12:31:56 +0100 Subject: [PATCH] docs: flake8 and others --- devito/ir/support/basic.py | 21 +++++++++------------ tests/test_ir.py | 13 ++++++------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/devito/ir/support/basic.py b/devito/ir/support/basic.py index 05338471be..60de20ed05 100644 --- a/devito/ir/support/basic.py +++ b/devito/ir/support/basic.py @@ -425,27 +425,24 @@ def distance(self, other): ret.append(S.Zero) else: v = i - j - # If (i-j) is a finite number, then we potentially have an Imaginary dependence if v.is_Number and v.is_finite: # If i and j are numbers, we append an (I) distance if i.is_Number and j.is_Number: return Vector(S.ImaginaryUnit) - # If i and j are not numbers, there may be dimension-dependent dependencies - # so we append the distance + # If both i and j are not numbers, there may be dimension-dependent + # dependencies so we append the distance else: ret.append(v) # We are writing over an entire dimension but reading from one point. # If there are overlaps between the two then we would have a dependency - # This is a conservative estimation as there are cases (example below) where - # we potentially don't actually have a dependency given that we don't write - # over the entire dimension - # But we would need the exact iteration intervals to compute this, - # which is only known at compile time - - # No Dependency Example: - # Eq(u[0,y], 1) - # Eq(u[1, y+1], u[0,1]) + # This is a conservative estimation as there are cases (example below) + # where we may or may not have a dependency given that we don't write + # depending on domain size, which is not compilation-time known + + # For example: + # Eq(u[0, y], 1) + # Eq(u[1, y+1], u[0, 1]) elif i.is_Number and not j.is_Number: ret.append(S.Infinity) diff --git a/tests/test_ir.py b/tests/test_ir.py index a65838fade..2ad58495d6 100644 --- a/tests/test_ir.py +++ b/tests/test_ir.py @@ -839,12 +839,11 @@ def test_2194(self): op = Operator([eq_1, eq_3]) op.apply() - expected = np.array([[ 1., 1., 1.], + expected = np.array([[1., 1., 1.], [-1., 0., -1.]]) assert(np.all(u.data[:] == expected[:])) - @pytest.mark.parametrize('eqns', [ ['Eq(u0[0, y], 1)', 'Eq(u0[1, y], u0[0, y + 1])'], ]) @@ -874,12 +873,12 @@ def test_2194_v3(self): eq1 = Eq(u[1, y], u[0, 2]) op = Operator([eq0, eq1]) - op.apply() + op.apply() + + expected = np.array([[1., 1., 1.], + [1., 1., 1.], + [0., 0., 0.]]) - expected = np.array([[1.,1.,1.], - [1.,1.,1.], - [0.,0.,0.]]) - assert(np.all(u.data[:] == expected[:]))