def lower_aliases(cluster, aliases, in_writeto, maxpar):
    '\n    Create a Schedule from an AliasMapper.\n    '
    dmapper = {}
    processed = []
    for (alias, v) in aliases.items():
        imapper = {**{i.dim: i for i in v.intervals}, **{i.dim.parent: i for i in v.intervals if i.dim.is_NonlinearDerived}}
        intervals = []
        writeto = []
        sub_iterators = {}
        indicess = [[] for _ in v.distances]
        for i in cluster.ispace.intervals:
            try:
                interval = imapper[i.dim]
            except KeyError:
                intervals.append(i)
                continue
            assert (i.stamp >= interval.stamp)
            if (not (writeto or (interval != interval.zero()) or in_writeto(i.dim, cluster))):
                intervals.append(i)
                continue
            assert (not i.dim.is_NonlinearDerived)
            interval = interval.lift(i.stamp)
            interval = interval.lift((interval.stamp + int(maxpar)))
            writeto.append(interval)
            intervals.append(interval)
            if i.dim.is_Incr:
                try:
                    d = dmapper[i.dim]
                except KeyError:
                    dd = i.dim.parent
                    assert dd.is_Incr
                    if dd.parent.is_Incr:
                        m = (i.dim.symbolic_min - i.dim.parent.symbolic_min)
                    else:
                        m = 0
                    d = dmapper[i.dim] = IncrDimension(('%ss' % i.dim.name), i.dim, m, dd.symbolic_size, 1, dd.step)
                sub_iterators[i.dim] = d
            else:
                d = i.dim
            for (distance, indices) in zip(v.distances, indicess):
                indices.append(((d - interval.lower) + distance[interval.dim]))
        writeto = IterationSpace(IntervalGroup(writeto), sub_iterators)
        intervals = IntervalGroup(intervals, cluster.ispace.relations)
        ispace = IterationSpace(intervals, cluster.sub_iterators, cluster.directions)
        ispace = ispace.augment(sub_iterators)
        processed.append(ScheduledAlias(alias, writeto, ispace, v.aliaseds, indicess))
    processed = sorted(processed, key=(lambda i: cit(cluster.ispace, i.ispace)))
    return Schedule(*processed, dmapper=dmapper)
Create a Schedule from an AliasMapper.
def lower_aliases(cluster, aliases, in_writeto, maxpar):
    '\n    \n    '
    dmapper = {}
    processed = []
    for (alias, v) in aliases.items():
        imapper = {**{i.dim: i for i in v.intervals}, **{i.dim.parent: i for i in v.intervals if i.dim.is_NonlinearDerived}}
        intervals = []
        writeto = []
        sub_iterators = {}
        indicess = [[] for _ in v.distances]
        for i in cluster.ispace.intervals:
            try:
                interval = imapper[i.dim]
            except KeyError:
                intervals.append(i)
                continue
            assert (i.stamp >= interval.stamp)
            if (not (writeto or (interval != interval.zero()) or in_writeto(i.dim, cluster))):
                intervals.append(i)
                continue
            assert (not i.dim.is_NonlinearDerived)
            interval = interval.lift(i.stamp)
            interval = interval.lift((interval.stamp + int(maxpar)))
            writeto.append(interval)
            intervals.append(interval)
            if i.dim.is_Incr:
                try:
                    d = dmapper[i.dim]
                except KeyError:
                    dd = i.dim.parent
                    assert dd.is_Incr
                    if dd.parent.is_Incr:
                        m = (i.dim.symbolic_min - i.dim.parent.symbolic_min)
                    else:
                        m = 0
                    d = dmapper[i.dim] = IncrDimension(('%ss' % i.dim.name), i.dim, m, dd.symbolic_size, 1, dd.step)
                sub_iterators[i.dim] = d
            else:
                d = i.dim
            for (distance, indices) in zip(v.distances, indicess):
                indices.append(((d - interval.lower) + distance[interval.dim]))
        writeto = IterationSpace(IntervalGroup(writeto), sub_iterators)
        intervals = IntervalGroup(intervals, cluster.ispace.relations)
        ispace = IterationSpace(intervals, cluster.sub_iterators, cluster.directions)
        ispace = ispace.augment(sub_iterators)
        processed.append(ScheduledAlias(alias, writeto, ispace, v.aliaseds, indicess))
    processed = sorted(processed, key=(lambda i: cit(cluster.ispace, i.ispace)))
    return Schedule(*processed, dmapper=dmapper)