def restrict_map_fixed(func):
    r"""
    Returns the same map whose domain is restricted to its fixed points.
    """
    fxd = fixed_points(func)
    M = FiniteSetMaps(fxd)
    d = dict()
    for i in fxd:
        d[i] = func(i)
    return M.from_dict(d)
Beispiel #2
0
 def __init__(self, n):
     ambient_monoid = FiniteSetMaps(range(-n, 0) + range(1, n + 1),
                                    action="right")
     pi = Family(
         range(1, n), lambda j: ambient_monoid.from_dict(
             dict([(i, i) for i in range(1, n + 1) if i != j + 1] + [(
                 j + 1, j)] + [(i, i) for i in range(-n, 0)
                               if i != -j] + [(-j, -j - 1)])))
     category = Monoids().JTrivial().Finite() & Monoids().Transformation(
     ).Subobjects()
     AutomaticMonoid.__init__(self,
                              pi,
                              ambient_monoid,
                              one=ambient_monoid.one(),
                              mul=operator.mul,
                              category=category)
def _involution_dict(mat):
    r"""
    Returns a dictionary of arbitrary involutions on the entries of a Combinatorial Matrix.
    Note all weights must be 1 for this.  It may be extended upon in the future.
    """
    mat_gen_func = matrix_generating_function(mat)
    if mat_gen_func != mat_gen_func.parent().identity_matrix():
        raise ValueError, "Input needs to be equal to the identity."
    else:
        func = dict()
        for x in range(mat.nrows()):
            for y in range(mat.ncols()):
                if x <> y:
                    func[(x,y)] = mat[x,y].create_involution()
                else:
                    t = mat[x,y]
                    for i in t:
                        _M = FiniteSetMaps(t,t)
                        func[(x,y)] = _M.from_dict({i:i})
        return func