From 64847072159e30cdc5ae1fc912d0744580d062b0 Mon Sep 17 00:00:00 2001 From: allem Date: Wed, 11 Dec 2019 20:57:02 -0500 Subject: [PATCH] add group setup utilities --- .idea/workspace.xml | 46 ++++++++++++++++++++---------- __pycache__/groups.cpython-38.pyc | Bin 0 -> 1744 bytes groups.py | 45 +++++++++++++++++++++++++++++ speedy_gonzolas.py | 38 +++++++++++++++++------- 4 files changed, 103 insertions(+), 26 deletions(-) create mode 100644 __pycache__/groups.cpython-38.pyc create mode 100644 groups.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9215353..2162d72 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,6 +2,8 @@ + + - + + + + @@ -91,7 +117,7 @@ @@ -111,24 +137,13 @@ - - - file://$PROJECT_DIR$/speedy_gonzolas.py - 87 - - - file://$PROJECT_DIR$/speedy_gonzolas.py - 97 - - + @@ -139,6 +154,7 @@ - + + \ No newline at end of file diff --git a/__pycache__/groups.cpython-38.pyc b/__pycache__/groups.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b584cd8bb7a0123327b3f131a6229f8bcf8d78b GIT binary patch literal 1744 zcmZ`(O>ZMb5bf&u@W(o4S)yd)@Ff-`eAsw@fMtOog2T#M34xH6V0ow8jyK~Or+X~1 z(O5!wCH92G9dXZJnky2Lk6bzNswd7mL5$Va?VhfxSFhgmw>vv^f#L+)VGdM7?O+adMK#Z*`Cfi##P{dOdgV)O8tM}%Q_VRCVd{9g+aIeiDK1bnD}CEBu( z)2#4ytY?OB(wToAch1t8?u=q=cb>hB&PHbT%%m@Ll-W)eJsyv2)|r@eF}FwamxUjt ziDhr=!w9OA2{7NnRK*5wKEkj+!Tch|q)5qE)l9q=EBX>+DRa!HAD_q*x%8I)GRT8m z=H7wG{jP9pA8W5GE?VrRyob*7^k^AoA`g|f&#@$8w3d}T%qwFF{}4Wv12L9d`^66z zPhI_fKVr3CxHj-C`WyrLpVCOWYt zha9G;cjKweqI5RzRX8MXhG@&>p}w3g;>;d(<1`w@wui;$U8o6*Mj=D`-~Gw4fJd!WvE)m$h;oJj9M|!U)=v_o+cm*au`-4J?bBhl}CEUt!o! zVZb9eRkSablv9RLDmIh6&s|!{u>=u*-!yRk7KyBQ#$kDU1Op0N=%wo{B8h!;A&0-~ zgj9q$(uL`ljCzL2G7n$|J{MdT=%ncitaZV&{&8-4T#94WM*)|IHad$(<9ND7>*i$J zE4)}IuK1#+lf_J%QKpfZ8FC!oO;g>3V zRG@r^i?(ouB?}JAnhP=S!2sNcJjtT@xwYD4(=<6YCN+*^^FE(*ZGY2ye;TEh0bVzx zB@Jur7F;g=hO8d`fGl#5Btud@lT|7b+Lj8cW)jEH;#jUE-#}10-dw9Z=sUEIPbXC1 z=AO2_5~r(&rHG9drczB#S9j3U@h5n1*;!DF_Q*WKs;CZ!v(Ype4%d7|_S+42cRH<> z8Mr%!t9HfSI3=T*9u5l{74*Ca=4P7U9_Nc>i?uh@RlBoPEn?l{Ez6>=2Gs_Jk6(x% Hu84mD;`}j! literal 0 HcmV?d00001 diff --git a/groups.py b/groups.py new file mode 100644 index 0000000..563e24e --- /dev/null +++ b/groups.py @@ -0,0 +1,45 @@ +def cons(it, elem): + yield from it + yield elem + + +def ezmults(ngens, rels): + mults = [[2] * ngens for _ in range(ngens)] + + for (f, t), m in rels: + mults[f][t] = m + mults[t][f] = m + + for i in range(ngens - 1): + for j in range(i + 1, ngens): + yield ((i, j), mults[i][j]) + + +def schlafli(*mults): + ngens = len(mults) + 1 + return ngens, ezmults(ngens, (((i, i + 1), mult) for i, mult in enumerate(mults))) + + +def torus(n): + return schlafli(n, 2, n) + + +def cube(dim): + return schlafli(4, *[3] * (dim - 2)) + + +def icos(dim): + assert 2 <= dim <= 4 + + return schlafli(5, *[3] * (dim - 2)) + + +def E(n): + ngens, mults = schlafli(*[3] * (n - 2), 2) + mults = cons(mults, ((2, n - 1), 3)) + return ngens, ezmults(ngens, mults) + + +if __name__ == '__main__': + a, b = E(8) + print(list(b)) diff --git a/speedy_gonzolas.py b/speedy_gonzolas.py index a20d506..42604bc 100644 --- a/speedy_gonzolas.py +++ b/speedy_gonzolas.py @@ -1,5 +1,7 @@ from typing import List +import groups + class Cosets: def __init__(self, ngens, data=()): @@ -132,22 +134,36 @@ def solve(cosets: Cosets, rel_tables: List[RelTable]): if count == 1: rel.gen[target] = -1 + return cosets + + +def init(ngens, mults, sub_gens=()): + initial_row = [-1] * ngens + for s in sub_gens: + initial_row[s] = 0 + + cosets = Cosets(ngens, initial_row) + rel_tables = [RelTable(*a) for a in mults] + return cosets, rel_tables + if __name__ == '__main__': - # cosets = Cosets(3) - # mults = [((0, 1), 50000), ((1, 2), 2), ((0, 2), 2)] + # result = solve(*init_schlafli(5, 3, 3)) + # result = solve(*init_schlafli(300, 2, 300)) - cosets = Cosets(4) - n = 100 - mults = [((0, 1), 5), ((1, 2), 3), ((2, 3), 3), - ((0, 2), 2), ((1, 3), 2), ((0, 3), 2)] + # group = groups.schlafli(4, 3, 3, 3, 3) + group = groups.E(6) - rel_tables = [RelTable(*args) for args in mults] + import time - solve(cosets, rel_tables) + s = time.time() + result = solve(*init(*group)) + e = time.time() - print(len(cosets)) - if len(cosets) < 20: - print(cosets) + print(e - s, 's') + + print(len(result)) + if len(result) < 20: + print(result) else: print('--')