mapFolding 0.15.0__py3-none-any.whl → 0.15.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mapFolding/__init__.py +1 -0
- mapFolding/_oeisFormulas/A001010.py +18 -0
- mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py +6 -1
- mapFolding/_theTypes.py +1 -1
- mapFolding/basecamp.py +89 -9
- mapFolding/daoOfMapFolding.py +2 -1
- mapFolding/oeis.py +1 -5
- mapFolding/reference/jaxCount.py +1 -1
- mapFolding/reference/rotatedEntryPoint.py +1 -1
- mapFolding/someAssemblyRequired/A007822rawMaterials.py +46 -0
- mapFolding/someAssemblyRequired/makeAllModules.py +192 -199
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +2 -2
- mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +2 -2
- mapFolding/syntheticModules/algorithmA007822.py +166 -0
- mapFolding/syntheticModules/algorithmA007822Numba.py +95 -0
- mapFolding/syntheticModules/{countParallel.py → countParallelNumba.py} +4 -6
- mapFolding/syntheticModules/{daoOfMapFolding.py → daoOfMapFoldingNumba.py} +4 -5
- mapFolding/syntheticModules/dataPacking.py +4 -5
- mapFolding/syntheticModules/{initializeCount.py → initializeState.py} +1 -1
- mapFolding/syntheticModules/initializeStateA007822.py +69 -0
- mapFolding/syntheticModules/theorem2.py +2 -1
- mapFolding/syntheticModules/theorem2A007822.py +70 -0
- mapFolding/syntheticModules/theorem2A007822Numba.py +67 -0
- mapFolding/syntheticModules/theorem2A007822Trimmed.py +64 -0
- mapFolding/syntheticModules/theorem2Numba.py +2 -1
- mapFolding/syntheticModules/theorem2Trimmed.py +2 -1
- mapFolding/tests/test_computations.py +29 -4
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.1.dist-info}/METADATA +1 -1
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.1.dist-info}/RECORD +33 -26
- mapFolding/_A007822.py +0 -181
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.1.dist-info}/WHEEL +0 -0
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.1.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.1.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.1.dist-info}/top_level.txt +0 -0
|
@@ -39,5 +39,6 @@ def count(state: MapFoldingState) -> MapFoldingState:
|
|
|
39
39
|
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leaf1ndex
|
|
40
40
|
state.gapRangeStart[state.leaf1ndex] = state.gap1ndex
|
|
41
41
|
state.leaf1ndex += 1
|
|
42
|
-
|
|
42
|
+
else:
|
|
43
|
+
state.groupsOfFolds *= 2
|
|
43
44
|
return state
|
|
@@ -30,7 +30,7 @@ from mapFolding.dataBaskets import MapFoldingState
|
|
|
30
30
|
from mapFolding.oeis import dictionaryOEIS
|
|
31
31
|
from mapFolding.someAssemblyRequired.makeAllModules import parametersNumbaLight
|
|
32
32
|
from mapFolding.someAssemblyRequired.RecipeJob import RecipeJobTheorem2
|
|
33
|
-
from mapFolding.syntheticModules.
|
|
33
|
+
from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
|
|
34
34
|
from mapFolding.tests.conftest import registrarRecordsTemporaryFilesystemObject, standardizedEqualToCallableReturn
|
|
35
35
|
from pathlib import Path, PurePosixPath
|
|
36
36
|
from typing import Literal
|
|
@@ -41,8 +41,8 @@ import pytest
|
|
|
41
41
|
if __name__ == '__main__':
|
|
42
42
|
multiprocessing.set_start_method('spawn')
|
|
43
43
|
|
|
44
|
-
@pytest.mark.parametrize('flow', ['daoOfMapFolding', '
|
|
45
|
-
def test_flowControl(mapShapeTestCountFolds: tuple[int, ...], flow:
|
|
44
|
+
@pytest.mark.parametrize('flow', ['daoOfMapFolding', 'numba', 'theorem2', 'theorem2numba', 'theorem2Trimmed'])
|
|
45
|
+
def test_flowControl(mapShapeTestCountFolds: tuple[int, ...], flow: str) -> None:
|
|
46
46
|
"""Validate that different computational flows produce identical results.
|
|
47
47
|
|
|
48
48
|
(AI generated docstring)
|
|
@@ -86,6 +86,31 @@ def test_aOFn_calculate_value(oeisID: str) -> None:
|
|
|
86
86
|
for n in dictionaryOEIS[oeisID]['valuesTestValidation']:
|
|
87
87
|
standardizedEqualToCallableReturn(dictionaryOEIS[oeisID]['valuesKnown'][n], oeisIDfor_n, oeisID, n)
|
|
88
88
|
|
|
89
|
+
@pytest.mark.parametrize('flow', ['numba', 'theorem2', 'theorem2numba', 'theorem2Trimmed'])
|
|
90
|
+
def test_flowControlByOEISid(flow: str) -> None:
|
|
91
|
+
"""Crappy.
|
|
92
|
+
|
|
93
|
+
I'm making this while pushing through pain, so it's not great but it's a step in the right direction.
|
|
94
|
+
|
|
95
|
+
Notes for future me:
|
|
96
|
+
|
|
97
|
+
`oeisID` is a fixture: don't use it here.
|
|
98
|
+
|
|
99
|
+
`OEISid` matches `test_flowControlByOEISid`. It's pseudo-hardcoded to A007822 because that's currently the only OEISid that needs this test.
|
|
100
|
+
I tried:
|
|
101
|
+
`def test_flowControlByOEISid(OEISid: str | None, flow: str) -> None:`
|
|
102
|
+
|
|
103
|
+
But that's wrong.
|
|
104
|
+
|
|
105
|
+
So, I'm changing the local identifier `OEISid` back to `oeisID` because I use `oeisID` everywhere else.
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
oeisID = 'A007822'
|
|
109
|
+
|
|
110
|
+
for n in dictionaryOEIS[oeisID]['valuesTestValidation']:
|
|
111
|
+
mapShape = dictionaryOEIS[oeisID]['getMapShape'](n)
|
|
112
|
+
standardizedEqualToCallableReturn(dictionaryOEIS[oeisID]['valuesKnown'][n], countFolds, None, None, None, None, mapShape, oeisID, None, flow)
|
|
113
|
+
|
|
89
114
|
@pytest.mark.parametrize('pathFilename_tmpTesting', ['.py'], indirect=True)
|
|
90
115
|
def test_writeJobNumba(oneTestCuzTestsOverwritingTests: tuple[int, ...], pathFilename_tmpTesting: Path) -> None:
|
|
91
116
|
"""Test dynamic code generation and execution for computational modules.
|
|
@@ -111,7 +136,7 @@ def test_writeJobNumba(oneTestCuzTestsOverwritingTests: tuple[int, ...], pathFil
|
|
|
111
136
|
from mapFolding.someAssemblyRequired.makeJobTheorem2Numba import makeJobNumba # noqa: PLC0415
|
|
112
137
|
from mapFolding.someAssemblyRequired.toolkitNumba import SpicesJobNumba # noqa: PLC0415
|
|
113
138
|
mapShape = oneTestCuzTestsOverwritingTests
|
|
114
|
-
state =
|
|
139
|
+
state = transitionOnGroupsOfFolds(MapFoldingState(mapShape))
|
|
115
140
|
|
|
116
141
|
pathFilenameModule = pathFilename_tmpTesting.absolute()
|
|
117
142
|
pathFilenameFoldsTotal = pathFilenameModule.with_suffix('.foldsTotalTesting')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.1
|
|
4
4
|
Summary: Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations and code optimization.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
mapFolding/
|
|
2
|
-
mapFolding/__init__.py,sha256=mtABkOaPaJSdabbrGrVOzYV330UrSU6ObgOqKtd4p3M,3665
|
|
1
|
+
mapFolding/__init__.py,sha256=UqUsMLADRoBiWI7YTwQqdP7gnoQ2HrerquHXPRTPeFM,3703
|
|
3
2
|
mapFolding/_theSSOT.py,sha256=s2yx72OMJIQEFM_x-UpPuS8uzGEyt9hS4aCKU2GWERA,4832
|
|
4
|
-
mapFolding/_theTypes.py,sha256=
|
|
5
|
-
mapFolding/basecamp.py,sha256=
|
|
3
|
+
mapFolding/_theTypes.py,sha256=wzr05TeV6gp7OlMNKvmP2yR5LI94BrBUWHe_7zXJRyM,3677
|
|
4
|
+
mapFolding/basecamp.py,sha256=h0NszV2Abm_x6_mOitv-wrhmPES4Cr-RTrZufxK4pv4,12968
|
|
6
5
|
mapFolding/beDRY.py,sha256=iYATcrYrAWkKaAecjA_awELBtZP5Q3snU4053dIsEwU,13941
|
|
7
|
-
mapFolding/daoOfMapFolding.py,sha256=
|
|
6
|
+
mapFolding/daoOfMapFolding.py,sha256=yLqaAqMwHIVFAtig3T46aZZQLAjCtQzYoAi0iMs_2CY,5482
|
|
8
7
|
mapFolding/dataBaskets.py,sha256=04tVULSbWbPkKkLjTofWfVOr6gWcs38XILvU0-ftHIU,15191
|
|
9
8
|
mapFolding/filesystemToolkit.py,sha256=Ex5tyugRQurXIgUNVtkQYfWMq8fM4e-izX01MBXU5_8,11006
|
|
10
|
-
mapFolding/oeis.py,sha256=
|
|
9
|
+
mapFolding/oeis.py,sha256=nP_-cSNMkEsC0VWD93AqTO4lA7VFfkVsG-c3DnkwsaU,19093
|
|
11
10
|
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
11
|
mapFolding/_oeisFormulas/A000136.py,sha256=G_vqOdb6s_YBbrCkHKjQDnlYfOZ4suXRtie6bRI7hhE,105
|
|
13
12
|
mapFolding/_oeisFormulas/A000560.py,sha256=sN5-BAjL0oDk7YXZ2kx7ffBDX-gC28mmOj4CxHkM36c,113
|
|
14
13
|
mapFolding/_oeisFormulas/A000682.py,sha256=w1u9ECjqw32IA_crWkdcFt_iojfmA7Js1ps8AEYb6es,516
|
|
14
|
+
mapFolding/_oeisFormulas/A001010.py,sha256=RNjqbxr50ENSy9ygIo3kbQwDHDh1_NbkNrCc3r8Av_I,403
|
|
15
15
|
mapFolding/_oeisFormulas/A005315.py,sha256=g1P52zUuWCLFbTb_i6U75sVzXfUGaCM3rJonXNRgVr4,109
|
|
16
16
|
mapFolding/_oeisFormulas/A005316.py,sha256=3B4_2TT_ip3CcYngEaFS-rTNDx-x2TZ0r_J0f8IMJbQ,234
|
|
17
17
|
mapFolding/_oeisFormulas/A223094.py,sha256=z7t6RcRQlhXdbYImIER15KwG1_W7iV4MNIRDx9Q_Efs,284
|
|
18
18
|
mapFolding/_oeisFormulas/A259702.py,sha256=9hUs8jzwOnJGmBsueS1yGsLjau4YVa0Yd9lYMG8UFso,123
|
|
19
19
|
mapFolding/_oeisFormulas/A301620.py,sha256=pY0OJsCLhIEDHQUKpeSMTZ2SUFvcqt83uCOPE_lZCsw,225
|
|
20
20
|
mapFolding/_oeisFormulas/Z0Z_aOFn.py,sha256=HadJifbcq8s5KrdhlPCP9r3gsh6AZHyN_M4_JTNoXiY,728
|
|
21
|
-
mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py,sha256=
|
|
21
|
+
mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py,sha256=YAWQQ1DgCtok3DBBRsTIaYJiTntnPoOHwolxIonkluo,1981
|
|
22
22
|
mapFolding/_oeisFormulas/__init__.py,sha256=n83beVb7HHplXYAM5HveaIAuR7KrJG99OaNHJGMb_uc,44
|
|
23
23
|
mapFolding/_oeisFormulas/matrixMeanders.py,sha256=Qk7S2dTpfZp-5bg--Qsspb2voOTBeLLQd7J_iQH3OpE,7356
|
|
24
24
|
mapFolding/_oeisFormulas/matrixMeandersAnnex.py,sha256=UdSZCI9PtiuPCFTT6kLQZY7uoalaOkYzcR5VXUN8v1U,5793
|
|
@@ -33,47 +33,54 @@ mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInW
|
|
|
33
33
|
mapFolding/reference/flattened.py,sha256=0eHgLFIeIeVUsI5zF5oSy5iWYrjOMzxr7KjDxiTe01k,16078
|
|
34
34
|
mapFolding/reference/hunterNumba.py,sha256=iLfyqwGdAh6c5GbapnKsWhAsNsR3O-fyGGHAdohluLw,7258
|
|
35
35
|
mapFolding/reference/irvineJavaPort.py,sha256=XnsL4g33LRrYwAhcrAVt-ujsP6QD6fbyCsGYzcm9g_k,3724
|
|
36
|
-
mapFolding/reference/jaxCount.py,sha256=
|
|
36
|
+
mapFolding/reference/jaxCount.py,sha256=t8ons45zyWNJQ-nmn1qbhNsTkTnRzf7ATauaYvIlkRI,14853
|
|
37
37
|
mapFolding/reference/lunnonNumpy.py,sha256=mMgrgbrBpe4nmo72ThEI-MGH0OwEHmfMPczSXHp2qKo,4357
|
|
38
38
|
mapFolding/reference/lunnonWhile.py,sha256=ZL8GAQtPs5nJZSgoDl5USrLSS_zs03y98y1Z9E4jOmQ,3799
|
|
39
39
|
mapFolding/reference/matrixMeandersBaseline.py,sha256=8Z98MMfhTCdoa75HWZz4DO166EiHZCu5eHeFzhgK42s,3003
|
|
40
40
|
mapFolding/reference/matrixMeandersBaselineAnnex.py,sha256=d2Oh4JZxz53ox_ArhIxpMTOuA7rtE9wnEPojpFcnlfc,5817
|
|
41
41
|
mapFolding/reference/matrixMeandersSimpleQueue.py,sha256=pOfaS315OKIBG9GSqSJwUDcEhfnV2XduM9IPqHrBvJg,4083
|
|
42
42
|
mapFolding/reference/matrixMeandersSlicePop.py,sha256=XyiesSQAH1dRplYx_CdR1FzcXvgmmxzj27V4aIqPp7o,5353
|
|
43
|
-
mapFolding/reference/rotatedEntryPoint.py,sha256=
|
|
43
|
+
mapFolding/reference/rotatedEntryPoint.py,sha256=3IJU7Hc2PDSE71wmSkDs4Z3t0Px9NBSzmCsVrgQuQyU,10274
|
|
44
44
|
mapFolding/reference/total_countPlus1vsPlusN.py,sha256=yJZAVLVdoXqHag2_N6_6CT-Q6HXBgRro-eny93-Rlpw,9307
|
|
45
45
|
mapFolding/reference/jobsCompleted/__init__.py,sha256=TU93ZGUW1xEkT6d9mQFn_rp5DvRy0ZslEB2Q6MF5ZDc,2596
|
|
46
46
|
mapFolding/reference/jobsCompleted/[2x19]/p2x19.py,sha256=_tvYtfzMWVo2VtUbIAieoscb4N8FFflgTdW4-ljBUuA,19626
|
|
47
47
|
mapFolding/reference/jobsCompleted/p2x19/p2x19.py,sha256=eZEw4Me4ocTt6VXoK2-Sbd5SowZtxRIbN9dZmc7OCVg,6395
|
|
48
|
+
mapFolding/someAssemblyRequired/A007822rawMaterials.py,sha256=I1lZyQ_4H7Ey07diN-0Ai7c-NUaV4ffFsZCUWdELXjc,1701
|
|
48
49
|
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=yGGPHq9JX-Gf7QlJz50EPpkO7sADwGvSZNA1aC_F_PQ,9866
|
|
49
50
|
mapFolding/someAssemblyRequired/__init__.py,sha256=UNDh6O86jT5ywlw9LgeWsUHwOfNvoMJRDAzYXbwCbeM,5779
|
|
50
51
|
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=VDZC10Xo3E1Y5n6FmaBBbOBR-rinV9DFkpgw8zrDyzg,6339
|
|
51
52
|
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=Xbo1QJT8KtrWcAvQ-eLzOEzR8N78WfF43fJKGRIebA4,13625
|
|
52
53
|
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=tY0-2K0BFkwLAAjSrFJLPoG8CevDHOFc3OH3TxXANzg,2806
|
|
53
54
|
mapFolding/someAssemblyRequired/infoBooth.py,sha256=GWiqnHbqk7te_pvVuk4G_gbFa_W2aeSx19w4pakvqfM,2300
|
|
54
|
-
mapFolding/someAssemblyRequired/makeAllModules.py,sha256=
|
|
55
|
-
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=
|
|
56
|
-
mapFolding/someAssemblyRequired/makeJobTheorem2codon.py,sha256=
|
|
55
|
+
mapFolding/someAssemblyRequired/makeAllModules.py,sha256=iDFHyRLifADM3Uv2kI71G35uw2te0PVecfS0uNggZcM,44981
|
|
56
|
+
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=wflkPttFID9vao4C4CohoUCYgbMWD7GhZ7TO9h5mwtE,17196
|
|
57
|
+
mapFolding/someAssemblyRequired/makeJobTheorem2codon.py,sha256=EPcrnHrK_TBqVB5uLvHz-XLcjaNYUhfQZCNaROCS1Oo,11326
|
|
57
58
|
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=nCCVsGidAlcKRVAvA__hu4bXtat3B-cO9YloKtqOAc4,14919
|
|
58
59
|
mapFolding/someAssemblyRequired/transformationTools.py,sha256=nPGZsvb5GquaCCxdDh_XzNIZYSiVJpWKd7wfhfRvxnk,11512
|
|
59
60
|
mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
60
|
-
mapFolding/syntheticModules/
|
|
61
|
-
mapFolding/syntheticModules/
|
|
62
|
-
mapFolding/syntheticModules/
|
|
63
|
-
mapFolding/syntheticModules/
|
|
64
|
-
mapFolding/syntheticModules/
|
|
65
|
-
mapFolding/syntheticModules/
|
|
66
|
-
mapFolding/syntheticModules/
|
|
61
|
+
mapFolding/syntheticModules/algorithmA007822.py,sha256=0Nsi-l9it4Wd9TACEecvOh02as_6gZJ9IsLcbVhZLFE,7078
|
|
62
|
+
mapFolding/syntheticModules/algorithmA007822Numba.py,sha256=Tiychj5ST0Mxsw7KVp9Movdor5-deRb0tnfTbXA_RTc,7226
|
|
63
|
+
mapFolding/syntheticModules/countParallelNumba.py,sha256=6sHWzGc6ch3HjKVB8krvaBec_KoHv3gpfN_F5Vl1SP8,7870
|
|
64
|
+
mapFolding/syntheticModules/daoOfMapFoldingNumba.py,sha256=5oMb8pttNKslN6wss9JIQXSnmjgE2q_2-3fIrh1pEW0,6033
|
|
65
|
+
mapFolding/syntheticModules/dataPacking.py,sha256=SzRmDNr2OZP6Xk4krLqxTuWAUtUJxBDXmHEqlBHzNPI,2407
|
|
66
|
+
mapFolding/syntheticModules/initializeState.py,sha256=OTiVi1Ywnlwk8tbwSIFjPJa_yBCINoapaCzGXDAJq_k,3121
|
|
67
|
+
mapFolding/syntheticModules/initializeStateA007822.py,sha256=7Qd-ggF5RcSKXyCnw7PehEVuAlfED6rnqlJokqmSuJ4,4348
|
|
68
|
+
mapFolding/syntheticModules/theorem2.py,sha256=QeXkBScihDatBk4iEMOMSntvhyJISb0G8zwZMQe7JFc,3031
|
|
69
|
+
mapFolding/syntheticModules/theorem2A007822.py,sha256=SaJpHt0juljfHYR1XZMYHkYmLCHu-bpGhf3fky39RUc,4258
|
|
70
|
+
mapFolding/syntheticModules/theorem2A007822Numba.py,sha256=YczC1RX4G7-vCmTlfAZb6YOeZSR9chH2oumaTPzul9Q,4646
|
|
71
|
+
mapFolding/syntheticModules/theorem2A007822Trimmed.py,sha256=gaTWsTJoDgCf-cW3gyheU9j2cj_R8CNvrnAp7lzv_8s,3926
|
|
72
|
+
mapFolding/syntheticModules/theorem2Numba.py,sha256=QpOpNdgjXTqlkgamgEKYSUxm3W9WXIUuci6HN-ZeHd0,3421
|
|
73
|
+
mapFolding/syntheticModules/theorem2Trimmed.py,sha256=geKX3So1SqhENlKeEO2dV6S3rGsxBp-AItB4hRbwbBI,2699
|
|
67
74
|
mapFolding/tests/__init__.py,sha256=QVCHSMFVvTxV3mAyYOLkMFAFyBJ514zdoVnDmpBJnTo,1336
|
|
68
75
|
mapFolding/tests/conftest.py,sha256=VZ9l0Vd2d-hdp6cVBmsTkYA7FZIH0cEgdeJx844oe3A,14624
|
|
69
|
-
mapFolding/tests/test_computations.py,sha256=
|
|
76
|
+
mapFolding/tests/test_computations.py,sha256=I1FJ5YRat16TCn_YfgiQQgej1bfE986WhV6k0YRXKhA,7461
|
|
70
77
|
mapFolding/tests/test_filesystem.py,sha256=0rYQ62f4e3HOoymXrxDWbqNEBJQ7DGN8RUOMI84tE2Q,3892
|
|
71
78
|
mapFolding/tests/test_oeis.py,sha256=ejqaOMB61c1oUEBblPPBG9hFFXffpKuIS0CJMe7Rd1o,5497
|
|
72
79
|
mapFolding/tests/test_other.py,sha256=ScBiJ78LnyAaW-RhxcouX6Xw10wgpSdqfvT4LO3WjnQ,4766
|
|
73
80
|
mapFolding/tests/test_tasks.py,sha256=_pr9JRWjjNKA7sww70XvkJJdGPruBVzubM63RmD_Du0,4013
|
|
74
|
-
mapfolding-0.15.
|
|
75
|
-
mapfolding-0.15.
|
|
76
|
-
mapfolding-0.15.
|
|
77
|
-
mapfolding-0.15.
|
|
78
|
-
mapfolding-0.15.
|
|
79
|
-
mapfolding-0.15.
|
|
81
|
+
mapfolding-0.15.1.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
82
|
+
mapfolding-0.15.1.dist-info/METADATA,sha256=tkbrNRprL4Wz2OaQ7p-9bk-yOKyqO6hR1KCHu4ktj-M,5144
|
|
83
|
+
mapfolding-0.15.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
84
|
+
mapfolding-0.15.1.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
85
|
+
mapfolding-0.15.1.dist-info/top_level.txt,sha256=aG3bjFBoxxuaV3Iu1wZAd241Ubs3cdaJtKYBQBDIjsg,11
|
|
86
|
+
mapfolding-0.15.1.dist-info/RECORD,,
|
mapFolding/_A007822.py
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
from mapFolding import Array1DLeavesTotal, makeDataContainer, NumPyLeavesTotal
|
|
2
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
3
|
-
from mapFolding.oeis import dictionaryOEIS
|
|
4
|
-
import numpy
|
|
5
|
-
import sys
|
|
6
|
-
import time
|
|
7
|
-
|
|
8
|
-
def activeLeafGreaterThan0(state: MapFoldingState) -> bool:
|
|
9
|
-
return state.leaf1ndex > 0
|
|
10
|
-
|
|
11
|
-
def activeLeafGreaterThanLeavesTotal(state: MapFoldingState) -> bool:
|
|
12
|
-
return state.leaf1ndex > state.leavesTotal
|
|
13
|
-
|
|
14
|
-
def activeLeafIsTheFirstLeaf(state: MapFoldingState) -> bool:
|
|
15
|
-
return state.leaf1ndex <= 1
|
|
16
|
-
|
|
17
|
-
def activeLeafIsUnconstrainedInAllDimensions(state: MapFoldingState) -> bool:
|
|
18
|
-
return not state.dimensionsUnconstrained
|
|
19
|
-
|
|
20
|
-
def activeLeafUnconstrainedInThisDimension(state: MapFoldingState) -> MapFoldingState:
|
|
21
|
-
state.dimensionsUnconstrained -= 1
|
|
22
|
-
return state
|
|
23
|
-
|
|
24
|
-
def filterCommonGaps(state: MapFoldingState) -> MapFoldingState:
|
|
25
|
-
state.gapsWhere[state.gap1ndex] = state.gapsWhere[state.indexMiniGap]
|
|
26
|
-
if state.countDimensionsGapped[state.gapsWhere[state.indexMiniGap]] == state.dimensionsUnconstrained:
|
|
27
|
-
state = incrementActiveGap(state)
|
|
28
|
-
state.countDimensionsGapped[state.gapsWhere[state.indexMiniGap]] = 0
|
|
29
|
-
return state
|
|
30
|
-
|
|
31
|
-
def gapAvailable(state: MapFoldingState) -> bool:
|
|
32
|
-
return state.leaf1ndex > 0
|
|
33
|
-
|
|
34
|
-
def incrementActiveGap(state: MapFoldingState) -> MapFoldingState:
|
|
35
|
-
state.gap1ndex += 1
|
|
36
|
-
return state
|
|
37
|
-
|
|
38
|
-
def incrementGap1ndexCeiling(state: MapFoldingState) -> MapFoldingState:
|
|
39
|
-
state.gap1ndexCeiling += 1
|
|
40
|
-
return state
|
|
41
|
-
|
|
42
|
-
def incrementIndexMiniGap(state: MapFoldingState) -> MapFoldingState:
|
|
43
|
-
state.indexMiniGap += 1
|
|
44
|
-
return state
|
|
45
|
-
|
|
46
|
-
def initializeIndexMiniGap(state: MapFoldingState) -> MapFoldingState:
|
|
47
|
-
state.indexMiniGap = state.gap1ndex
|
|
48
|
-
return state
|
|
49
|
-
|
|
50
|
-
def initializeVariablesToFindGaps(state: MapFoldingState) -> MapFoldingState:
|
|
51
|
-
state.dimensionsUnconstrained = state.dimensionsTotal
|
|
52
|
-
state.gap1ndexCeiling = state.gapRangeStart[state.leaf1ndex - 1]
|
|
53
|
-
state.indexDimension = 0
|
|
54
|
-
return state
|
|
55
|
-
|
|
56
|
-
def insertActiveLeaf(state: MapFoldingState) -> MapFoldingState:
|
|
57
|
-
state.indexLeaf = 0
|
|
58
|
-
while state.indexLeaf < state.leaf1ndex:
|
|
59
|
-
state.gapsWhere[state.gap1ndexCeiling] = state.indexLeaf
|
|
60
|
-
state.gap1ndexCeiling += 1
|
|
61
|
-
state.indexLeaf += 1
|
|
62
|
-
return state
|
|
63
|
-
|
|
64
|
-
def insertActiveLeafAtGap(state: MapFoldingState) -> MapFoldingState:
|
|
65
|
-
state.gap1ndex -= 1
|
|
66
|
-
state.leafAbove[state.leaf1ndex] = state.gapsWhere[state.gap1ndex]
|
|
67
|
-
state.leafBelow[state.leaf1ndex] = state.leafBelow[state.leafAbove[state.leaf1ndex]]
|
|
68
|
-
state.leafBelow[state.leafAbove[state.leaf1ndex]] = state.leaf1ndex
|
|
69
|
-
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leaf1ndex
|
|
70
|
-
state.gapRangeStart[state.leaf1ndex] = state.gap1ndex
|
|
71
|
-
state.leaf1ndex += 1
|
|
72
|
-
return state
|
|
73
|
-
|
|
74
|
-
def leafBelowSentinelIs1(state: MapFoldingState) -> bool:
|
|
75
|
-
return state.leafBelow[0] == 1
|
|
76
|
-
|
|
77
|
-
def leafConnecteeIsActiveLeaf(state: MapFoldingState) -> bool:
|
|
78
|
-
return state.leafConnectee == state.leaf1ndex
|
|
79
|
-
|
|
80
|
-
def lookForGaps(state: MapFoldingState) -> MapFoldingState:
|
|
81
|
-
state.gapsWhere[state.gap1ndexCeiling] = state.leafConnectee
|
|
82
|
-
if state.countDimensionsGapped[state.leafConnectee] == 0:
|
|
83
|
-
state = incrementGap1ndexCeiling(state)
|
|
84
|
-
state.countDimensionsGapped[state.leafConnectee] += 1
|
|
85
|
-
return state
|
|
86
|
-
|
|
87
|
-
def lookupLeafConnecteeInConnectionGraph(state: MapFoldingState) -> MapFoldingState:
|
|
88
|
-
state.leafConnectee = state.connectionGraph[state.indexDimension, state.leaf1ndex, state.leaf1ndex]
|
|
89
|
-
return state
|
|
90
|
-
|
|
91
|
-
def loopingLeavesConnectedToActiveLeaf(state: MapFoldingState) -> bool:
|
|
92
|
-
return state.leafConnectee != state.leaf1ndex
|
|
93
|
-
|
|
94
|
-
def loopingThroughTheDimensions(state: MapFoldingState) -> bool:
|
|
95
|
-
return state.indexDimension < state.dimensionsTotal
|
|
96
|
-
|
|
97
|
-
def loopingToActiveGapCeiling(state: MapFoldingState) -> bool:
|
|
98
|
-
return state.indexMiniGap < state.gap1ndexCeiling
|
|
99
|
-
|
|
100
|
-
def noGapsHere(state: MapFoldingState) -> bool:
|
|
101
|
-
return (state.leaf1ndex > 0) and (state.gap1ndex == state.gapRangeStart[state.leaf1ndex - 1])
|
|
102
|
-
|
|
103
|
-
def tryAnotherLeafConnectee(state: MapFoldingState) -> MapFoldingState:
|
|
104
|
-
state.leafConnectee = state.connectionGraph[state.indexDimension, state.leaf1ndex, state.leafBelow[state.leafConnectee]]
|
|
105
|
-
return state
|
|
106
|
-
|
|
107
|
-
def tryNextDimension(state: MapFoldingState) -> MapFoldingState:
|
|
108
|
-
state.indexDimension += 1
|
|
109
|
-
return state
|
|
110
|
-
|
|
111
|
-
def undoLastLeafPlacement(state: MapFoldingState) -> MapFoldingState:
|
|
112
|
-
state.leaf1ndex -= 1
|
|
113
|
-
state.leafBelow[state.leafAbove[state.leaf1ndex]] = state.leafBelow[state.leaf1ndex]
|
|
114
|
-
state.leafAbove[state.leafBelow[state.leaf1ndex]] = state.leafAbove[state.leaf1ndex]
|
|
115
|
-
return state
|
|
116
|
-
|
|
117
|
-
def filterAsymmetricFolds(state: MapFoldingState) -> MapFoldingState:
|
|
118
|
-
lengthLeafBelow = len(state.leafBelow)
|
|
119
|
-
|
|
120
|
-
indexLeaf: int = 0
|
|
121
|
-
for leafConnectee in range(lengthLeafBelow):
|
|
122
|
-
leafNumber = int(state.leafBelow[indexLeaf])
|
|
123
|
-
state.leafComparison[leafConnectee] = (leafNumber - indexLeaf + lengthLeafBelow - 1) % (lengthLeafBelow - 1)
|
|
124
|
-
indexLeaf = leafNumber
|
|
125
|
-
|
|
126
|
-
indexInMiddle = (lengthLeafBelow - 1) // 2
|
|
127
|
-
for delta in range(lengthLeafBelow):
|
|
128
|
-
ImaSymmetricFold = True
|
|
129
|
-
for leafConnectee in range(indexInMiddle):
|
|
130
|
-
if state.leafComparison[(delta + leafConnectee) % lengthLeafBelow] != state.leafComparison[(delta + lengthLeafBelow - 2 - leafConnectee) % lengthLeafBelow]:
|
|
131
|
-
ImaSymmetricFold = False
|
|
132
|
-
break
|
|
133
|
-
if ImaSymmetricFold:
|
|
134
|
-
state.groupsOfFolds += 1
|
|
135
|
-
|
|
136
|
-
return state
|
|
137
|
-
|
|
138
|
-
def count(state: MapFoldingState) -> MapFoldingState:
|
|
139
|
-
while activeLeafGreaterThan0(state):
|
|
140
|
-
if activeLeafIsTheFirstLeaf(state) or leafBelowSentinelIs1(state):
|
|
141
|
-
if activeLeafGreaterThanLeavesTotal(state):
|
|
142
|
-
state = filterAsymmetricFolds(state)
|
|
143
|
-
else:
|
|
144
|
-
state = initializeVariablesToFindGaps(state)
|
|
145
|
-
while loopingThroughTheDimensions(state):
|
|
146
|
-
state = lookupLeafConnecteeInConnectionGraph(state)
|
|
147
|
-
if leafConnecteeIsActiveLeaf(state):
|
|
148
|
-
state = activeLeafUnconstrainedInThisDimension(state)
|
|
149
|
-
else:
|
|
150
|
-
while loopingLeavesConnectedToActiveLeaf(state):
|
|
151
|
-
state = lookForGaps(state)
|
|
152
|
-
state = tryAnotherLeafConnectee(state)
|
|
153
|
-
state = tryNextDimension(state)
|
|
154
|
-
if activeLeafIsUnconstrainedInAllDimensions(state):
|
|
155
|
-
state = insertActiveLeaf(state)
|
|
156
|
-
state = initializeIndexMiniGap(state)
|
|
157
|
-
while loopingToActiveGapCeiling(state):
|
|
158
|
-
state = filterCommonGaps(state)
|
|
159
|
-
state = incrementIndexMiniGap(state)
|
|
160
|
-
while noGapsHere(state):
|
|
161
|
-
state = undoLastLeafPlacement(state)
|
|
162
|
-
if gapAvailable(state):
|
|
163
|
-
state = insertActiveLeafAtGap(state)
|
|
164
|
-
return state
|
|
165
|
-
|
|
166
|
-
def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
|
|
167
|
-
state = count(state)
|
|
168
|
-
state.groupsOfFolds = (state.groupsOfFolds + 1) // 2
|
|
169
|
-
return state
|
|
170
|
-
|
|
171
|
-
def Z0Z_flowNeedsFixing(mapShape: tuple[int, ...]) -> int:
|
|
172
|
-
return doTheNeedful(MapFoldingState(mapShape)).groupsOfFolds
|
|
173
|
-
|
|
174
|
-
if __name__ == '__main__':
|
|
175
|
-
for n in range(3, 7):
|
|
176
|
-
mapShape = dictionaryOEIS['A007822']['getMapShape'](n)
|
|
177
|
-
|
|
178
|
-
state = MapFoldingState(mapShape)
|
|
179
|
-
timeStart = time.perf_counter()
|
|
180
|
-
foldsTotal = doTheNeedful(state).groupsOfFolds
|
|
181
|
-
sys.stdout.write(f"{foldsTotal == dictionaryOEIS['A007822']['valuesKnown'][n]} {n} {foldsTotal = } {time.perf_counter() - timeStart:.2f}\n")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|