Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Some code for the r-number, not tested.

def r_number(P): 
    H = P.hasse_diagram() 
    M = Matroid(H.to_undirected()) 
    b = FreeModule(GF(2), tuple(H.edges(labels=False))).basis() 
    vecs = [sum(b[e] for e in ci).to_vector() for ci in M.circuits()] 
    return matrix(vecs).rank()

Remains only to do the same thing for the subspace that defines s.

Some code for the r-number, not tested.

def r_number(P): 
    H = P.hasse_diagram() 
    M = Matroid(H.to_undirected()) 
    b = FreeModule(GF(2), tuple(H.edges(labels=False))).basis() 
    vecs = [sum(b[e] for e in ci).to_vector() for ci in M.circuits()] 
    return matrix(vecs).rank()

Remains only to do the same thing for the subspace that defines s.

EDIT: here is a tentative, not tested either

def s_number(P):
    H = P.hasse_diagram()
    b = FreeModule(GF(2), tuple(H.edges(labels=False))).basis()
    vecs = []
    for x, y in P.relations():
        chains = H.all_paths(x, y, report_edges=True)
        if len(chains) <= 1:
            continue
        v0 = sum(b[e] for e in chains[0]).to_vector()
        vecs += [v0 + sum(b[e] for e in ci).to_vector() for ci in chains[1:]]
    return matrix(vecs).rank()