add group setup utilities
This commit is contained in:
46
.idea/workspace.xml
generated
46
.idea/workspace.xml
generated
@@ -2,6 +2,8 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="d9bcf4a3-5128-4140-a8b2-98cb9536d00e" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/groups.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/speedy_gonzolas.py" beforeDir="false" afterPath="$PROJECT_DIR$/speedy_gonzolas.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@@ -38,6 +40,7 @@
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="TEXT" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
@@ -52,7 +55,29 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<component name="RunManager" selected="Python.speedy_gonzolas">
|
||||
<configuration name="groups" type="PythonConfigurationType" factoryName="Python" temporary="true">
|
||||
<module name="tc-fast" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/groups.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="speedy_gonzolas" type="PythonConfigurationType" factoryName="Python" temporary="true">
|
||||
<module name="tc-fast" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
@@ -78,6 +103,7 @@
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.speedy_gonzolas" />
|
||||
<item itemvalue="Python.groups" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
@@ -91,7 +117,7 @@
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1576105095293</updated>
|
||||
<workItem from="1576105097677" duration="8524000" />
|
||||
<workItem from="1576105097677" duration="10641000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@@ -111,24 +137,13 @@
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/speedy_gonzolas.py</url>
|
||||
<line>87</line>
|
||||
<option name="timeStamp" value="11" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/speedy_gonzolas.py</url>
|
||||
<line>97</line>
|
||||
<option name="timeStamp" value="14" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
<default-breakpoints>
|
||||
<breakpoint type="python-exception">
|
||||
<properties notifyOnTerminate="true" exception="BaseException">
|
||||
<option name="notifyOnTerminate" value="true" />
|
||||
</properties>
|
||||
</breakpoint>
|
||||
<breakpoint enabled="true" type="javascript-exception" />
|
||||
</default-breakpoints>
|
||||
</breakpoint-manager>
|
||||
<watches-manager>
|
||||
@@ -139,6 +154,7 @@
|
||||
</watches-manager>
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/tc_fast$speedy_gonzolas.coverage" NAME="speedy_gonzolas Coverage Results" MODIFIED="1576113489878" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/tc_fast$groups.coverage" NAME="groups Coverage Results" MODIFIED="1576115373200" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/tc_fast$speedy_gonzolas.coverage" NAME="speedy_gonzolas Coverage Results" MODIFIED="1576115478633" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
||||
BIN
__pycache__/groups.cpython-38.pyc
Normal file
BIN
__pycache__/groups.cpython-38.pyc
Normal file
Binary file not shown.
45
groups.py
Normal file
45
groups.py
Normal file
@@ -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))
|
||||
@@ -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('--')
|
||||
|
||||
Reference in New Issue
Block a user