M = list(M) T = [[-1 for x in range(n)] for x in xrange(n)] for i, a in enumerate(M): for j, b in enumerate(M): T[i][j] = M.index(funcs.compose(a, b)) return T def isAbelian(M): for a, b in itertools.combinations(M, 2): if funcs.compose(a, b) != funcs.compose(b, a): return False return True ops = ladr_python.opsInFile(sys.stdin) i = 1 for (down_table, up_table) in ops: up_grp = generate(map(tuple, zip(*up_table))) dn_grp = generate(map(tuple, zip(*down_table))) print "Up:" print ladr_python.matrixToLadr(table(up_grp), i) print "Abelian=" + str(isAbelian(up_grp)) + ", cycle=" + str( max([len(generate([x])) for x in up_grp])) print "Dn:" print ladr_python.matrixToLadr(table(dn_grp), i) print "Abelian=" + str(isAbelian(dn_grp)) + ", cycle=" + str( max([len(generate([x])) for x in dn_grp])) print "Wh:" whole_grp = generate(up_grp.union(dn_grp)) print ladr_python.matrixToLadr(table(whole_grp), i)
#!/usr/bin/python import ladr_python import sys import funcs (down_table, up_table) = ladr_python.opsInFile(sys.stdin).next() down_cols = [funcs.cycles(p) for p in zip(*down_table)] up_cols = [funcs.cycles(p) for p in zip(*up_table)] print "------ up ------" for c in up_cols: print " ".join(map(lambda(s): str(list(s)), c)) print "------ down ------" for c in down_cols: print " ".join(map(lambda(s): str(list(s)), c))
#!/usr/bin/python import ladr_python import funcs import sys if len(sys.argv) < 3: sys.exit('Usage: %s smalls bigs small_prefix big_prefix' % sys.argv[0]) (pref1, pref2) = (sys.argv[3], sys.argv[4]) smalls = ladr_python.opsInFile(open(sys.argv[1])) i = 0 for (sd, su) in smalls: j = 0 i += 1 bigs = ladr_python.opsInFile(open(sys.argv[2])) for (bd, bu) in bigs: j += 1 if funcs.embeds([(sd, bd), (su, bu)]): print "\t\"%s_%i\" -> \"%s_%i\";" % (pref1, i, pref2, j)
#!/usr/bin/python import ladr_python import sys import congruences ops = ladr_python.opsInFile(open(sys.argv[1])) i = 1 for (d, u) in ops: print "%i\t%i" % (i, len(list(congruences.congruences(u, d)))) i += 1
def table(M): n = len(M) M = list(M) T = [[-1 for x in range(n)] for x in xrange(n)] for i, a in enumerate(M): for j, b in enumerate(M): T[i][j] = M.index( funcs.compose(a,b) ) return T def isAbelian(M): for a, b in itertools.combinations(M, 2): if funcs.compose(a,b) != funcs.compose(b,a): return False return True ops = ladr_python.opsInFile(sys.stdin) i = 1 for (down_table, up_table) in ops: up_grp = generate(map(tuple, zip(*up_table))) dn_grp = generate(map(tuple, zip(*down_table))) print "Up:" print ladr_python.matrixToLadr(table(up_grp), i) print "Abelian=" + str(isAbelian(up_grp)) + ", cycle=" + str(max([len(generate([x])) for x in up_grp])) print "Dn:" print ladr_python.matrixToLadr(table(dn_grp), i) print "Abelian=" + str(isAbelian(dn_grp)) + ", cycle=" + str(max([len(generate([x])) for x in dn_grp])) print "Wh:" whole_grp = generate(up_grp.union(dn_grp)) print ladr_python.matrixToLadr(table(whole_grp), i) print "Abelian=" + str(isAbelian(whole_grp)) + ", cycle=" + str(max([len(generate([x])) for x in whole_grp]))
#!/usr/bin/python import ladr_python import funcs import sys if len(sys.argv) < 3: sys.exit('Usage: %s bigs smalls big_prefix small_prefix' % sys.argv[0]) (pref1, pref2) = (sys.argv[3], sys.argv[4]) bigs = ladr_python.opsInFile(open(sys.argv[1])) i = 0 for (bd, bu) in bigs: j = 0 i += 1 smalls = ladr_python.opsInFile(open(sys.argv[2])) for (sd, su) in smalls: j += 1 if funcs.mapsonto([ (bd, sd), (bu, su) ]): print "\t\"%s_%i\" -> \"%s_%i\";" % (pref1, i, pref2, j)