def simplify_indices_F(F, coords):
    # Safety check: Clearly if it's not the identity it cannot be equal to ()
    R = get_R_from_F_coords(F, coords)
    if not (R == F):
        return coords

    # generic test
    i0 = get_id_indices(F)
    # compose
    i0coords = compose_indices(F, i0, coords, list)
    if i0 == i0coords:
        return ()

    if coords == [0] and len(F) == 1:
        return ()
    if coords == [0, 1] and len(F) == 2:
        return ()
    if coords == [0, (1,)] and len(F) == 2:
        return ()
    if coords == [0, 1, 2] and len(F) == 3:
        return ()

    mcdp_dev_warning('need a double check here')
    if coords == [[(0, 0)], [(1, 0)]]:
        return ()

    if coords == [[(0, 0)], [(1, 0), (1, 1)]]:
        return ()

    # [[(0, 1)], [(1, 0), (0, 0)]]
    return coords
Example #2
0
def test_right_inverse():
    P = parse_poset('((J x W) x s) x (m x Hz)')
    coords = [(1, 1), [(0, 0, 1), (1, 0), (0, 0, 0), (0, 1)]]
    #print 'coords', coords    
    i0 = get_id_indices(P)
    #print 'i0', i0
    # compose
    _i0coords = compose_indices(P, i0, coords, list)

    #print 'i0coords', i0coords

    _Q, _coords2 = transform_right_inverse(P, coords, PosetProduct)