|
13 | 13 | from devito.tools import ( |
14 | 14 | Pickable, Tag, as_hashable, filter_sorted, frozendict, reuse_if_unchanged |
15 | 15 | ) |
16 | | -from devito.types import Eq, Inc, ReduceMax, ReduceMin, ReduceMinMax, relational_min |
| 16 | +from devito.symbolics import IntDiv, limits_mapper, uxreplace |
| 17 | +from devito.tools import Pickable, Tag, frozendict |
| 18 | +from devito.types import Eq, Inc, ReduceMax, ReduceMin, ReduceMinMax, relational_min, relational_shift |
17 | 19 |
|
18 | 20 | __all__ = [ |
19 | 21 | 'ClusterizedEq', |
@@ -308,13 +310,10 @@ def __new__(cls, *args, **kwargs): |
308 | 310 | index = d.index |
309 | 311 | if d.condition is not None and d in expr.free_symbols: |
310 | 312 | index = index - relational_min(d.condition, d.parent) |
311 | | - # If there is a condition we might access on a non-factor |
312 | | - # index and need to make sure we don't overwrite the previous |
313 | | - # index |
314 | | - num = index + d.symbolic_factor - 1 |
| 313 | + shift = relational_shift(d.condition, d.parent) |
315 | 314 | else: |
316 | | - num = index |
317 | | - expr = uxreplace(expr, {d: IntDiv(num, d.symbolic_factor)}) |
| 315 | + shift = 0 |
| 316 | + expr = uxreplace(expr, {d: IntDiv(index, d.symbolic_factor) + shift}) |
318 | 317 |
|
319 | 318 | conditionals = frozendict(conditionals) |
320 | 319 |
|
|
0 commit comments