mapFolding 0.16.1__py3-none-any.whl → 0.16.4__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.
- easyRun/A000682.py +1 -1
- easyRun/A005316.py +2 -3
- easyRun/NOTcountingFolds.py +6 -5
- easyRun/countFolds.py +1 -1
- easyRun/generateAllModules.py +14 -0
- easyRun/meanders.py +16 -18
- mapFolding/__init__.py +1 -0
- mapFolding/_theSSOT.py +3 -2
- mapFolding/_theTypes.py +3 -0
- mapFolding/algorithms/A086345.py +75 -0
- mapFolding/algorithms/matrixMeanders.py +15 -28
- mapFolding/algorithms/matrixMeandersBeDry.py +34 -116
- mapFolding/algorithms/matrixMeandersNumPy.py +117 -70
- mapFolding/algorithms/matrixMeandersPandas.py +113 -130
- mapFolding/algorithms/oeisIDbyFormula.py +25 -14
- mapFolding/algorithms/symmetricFolds.py +36 -0
- mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +26 -12
- mapFolding/basecamp.py +152 -323
- mapFolding/dataBaskets.py +136 -34
- mapFolding/filesystemToolkit.py +4 -32
- mapFolding/oeis.py +5 -12
- mapFolding/reference/A000682facts.py +785 -1264
- mapFolding/reference/A005316facts.py +958 -923
- mapFolding/reference/A086345Wu.py +25 -0
- mapFolding/reference/matrixMeandersAnalysis/signatures.py +2033 -0
- mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +9 -44
- mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py +51 -0
- mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +39 -136
- mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +44 -45
- mapFolding/someAssemblyRequired/RecipeJob.py +78 -18
- mapFolding/someAssemblyRequired/__init__.py +3 -8
- mapFolding/someAssemblyRequired/_toolkitContainers.py +32 -3
- mapFolding/someAssemblyRequired/infoBooth.py +40 -23
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +75 -154
- mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +56 -88
- mapFolding/someAssemblyRequired/makingModules_count.py +91 -85
- mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +7 -65
- mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/makeMapFoldingModules.py +25 -31
- mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +14 -13
- mapFolding/someAssemblyRequired/toolkitMakeModules.py +10 -10
- mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
- mapFolding/someAssemblyRequired/transformationTools.py +17 -19
- mapFolding/syntheticModules/A007822/algorithm.py +46 -50
- mapFolding/syntheticModules/A007822/asynchronous.py +93 -34
- mapFolding/syntheticModules/A007822/initializeState.py +15 -21
- mapFolding/syntheticModules/A007822/theorem2.py +21 -21
- mapFolding/syntheticModules/A007822/theorem2Numba.py +42 -23
- mapFolding/syntheticModules/A007822/theorem2Trimmed.py +21 -21
- mapFolding/syntheticModules/countParallelNumba.py +3 -7
- mapFolding/syntheticModules/daoOfMapFoldingNumba.py +3 -6
- mapFolding/syntheticModules/meanders/bigInt.py +15 -25
- mapFolding/syntheticModules/theorem2.py +6 -0
- mapFolding/syntheticModules/theorem2Numba.py +26 -2
- mapFolding/syntheticModules/theorem2Trimmed.py +6 -0
- mapFolding/tests/test_computations.py +1 -1
- mapFolding/zCuzDocStoopid/makeDocstrings.py +2 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/METADATA +4 -1
- mapfolding-0.16.4.dist-info/RECORD +106 -0
- mapFolding/_dataPacking.py +0 -68
- mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -122
- mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -79
- mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -65
- mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -84
- mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -90
- mapFolding/syntheticModules/A007822/algorithmNumba.py +0 -94
- mapFolding/syntheticModules/A007822/asynchronousAnnex.py +0 -66
- mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +0 -85
- mapFolding/syntheticModules/A007822/asynchronousNumba.py +0 -52
- mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +0 -53
- mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +0 -47
- mapFolding/syntheticModules/dataPacking.py +0 -28
- mapFolding/syntheticModules/dataPackingA007822.py +0 -92
- mapfolding-0.16.1.dist-info/RECORD +0 -114
- /mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/__init__.py +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/WHEEL +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/top_level.txt +0 -0
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
from mapFolding.dataBaskets import
|
|
1
|
+
from mapFolding.dataBaskets import SymmetricFoldsState
|
|
2
|
+
from mapFolding.syntheticModules.A007822.initializeState import transitionOnGroupsOfFolds
|
|
3
|
+
import numpy
|
|
2
4
|
|
|
3
|
-
def count(state:
|
|
5
|
+
def count(state: SymmetricFoldsState) -> SymmetricFoldsState:
|
|
4
6
|
while state.leaf1ndex > 4:
|
|
5
7
|
if state.leafBelow[0] == 1:
|
|
6
8
|
if state.leaf1ndex > state.leavesTotal:
|
|
7
|
-
state.indexLeaf =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
state.
|
|
12
|
-
state.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
state.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
while leafConnectee < indexInMiddle:
|
|
20
|
-
if state.leafComparison[(state.indexMiniGap + leafConnectee) % (state.leavesTotal + 1)] != state.leafComparison[(state.indexMiniGap + state.leavesTotal - 1 - leafConnectee) % (state.leavesTotal + 1)]:
|
|
21
|
-
ImaSymmetricFold = False
|
|
22
|
-
break
|
|
23
|
-
leafConnectee += 1
|
|
24
|
-
state.groupsOfFolds += ImaSymmetricFold
|
|
25
|
-
state.indexMiniGap += 1
|
|
9
|
+
state.indexLeaf = 1
|
|
10
|
+
state.leafComparison[0] = 1
|
|
11
|
+
state.leafConnectee = 1
|
|
12
|
+
while state.leafConnectee < state.leavesTotal + 1:
|
|
13
|
+
state.indexMiniGap = state.leafBelow[state.indexLeaf]
|
|
14
|
+
state.leafComparison[state.leafConnectee] = (state.indexMiniGap - state.indexLeaf + state.leavesTotal) % state.leavesTotal
|
|
15
|
+
state.indexLeaf = state.indexMiniGap
|
|
16
|
+
state.leafConnectee += 1
|
|
17
|
+
state.arrayGroupOfFolds = numpy.take(state.leafComparison, state.indicesArrayGroupOfFolds)
|
|
18
|
+
compared = state.arrayGroupOfFolds[..., 0:state.leavesTotal // 2] == state.arrayGroupOfFolds[..., state.leavesTotal // 2:None]
|
|
19
|
+
for indexRow in range(len(compared)):
|
|
20
|
+
state.groupsOfFolds += compared[indexRow].all()
|
|
26
21
|
else:
|
|
27
22
|
state.dimensionsUnconstrained = state.dimensionsTotal
|
|
28
23
|
state.gap1ndexCeiling = state.gapRangeStart[state.leaf1ndex - 1]
|
|
@@ -60,4 +55,9 @@ def count(state: MapFoldingState) -> MapFoldingState:
|
|
|
60
55
|
else:
|
|
61
56
|
state.groupsOfFolds *= 2
|
|
62
57
|
state.groupsOfFolds = (state.groupsOfFolds + 1) // 2
|
|
58
|
+
return state
|
|
59
|
+
|
|
60
|
+
def doTheNeedful(state: SymmetricFoldsState) -> SymmetricFoldsState:
|
|
61
|
+
state = transitionOnGroupsOfFolds(state)
|
|
62
|
+
state = count(state)
|
|
63
63
|
return state
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
from concurrent.futures import Future as ConcurrentFuture, ProcessPoolExecutor
|
|
2
2
|
from copy import deepcopy
|
|
3
|
-
from mapFolding.dataBaskets import
|
|
4
|
-
Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal,
|
|
5
|
-
ParallelMapFoldingState)
|
|
3
|
+
from mapFolding.dataBaskets import Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal, ParallelMapFoldingState
|
|
6
4
|
from multiprocessing import set_start_method as multiprocessing_set_start_method
|
|
7
5
|
from numba import jit
|
|
8
|
-
|
|
9
6
|
if __name__ == '__main__':
|
|
10
7
|
multiprocessing_set_start_method('spawn')
|
|
11
8
|
|
|
@@ -75,14 +72,13 @@ def unRepackParallelMapFoldingState(state: ParallelMapFoldingState) -> ParallelM
|
|
|
75
72
|
gapsWhere: Array1DLeavesTotal = state.gapsWhere
|
|
76
73
|
leafAbove: Array1DLeavesTotal = state.leafAbove
|
|
77
74
|
leafBelow: Array1DLeavesTotal = state.leafBelow
|
|
78
|
-
leafComparison: Array1DLeavesTotal = state.leafComparison
|
|
79
75
|
connectionGraph: Array3DLeavesTotal = state.connectionGraph
|
|
80
76
|
dimensionsTotal: DatatypeLeavesTotal = state.dimensionsTotal
|
|
81
77
|
leavesTotal: DatatypeLeavesTotal = state.leavesTotal
|
|
82
78
|
taskDivisions: DatatypeLeavesTotal = state.taskDivisions
|
|
83
79
|
taskIndex: DatatypeLeavesTotal = state.taskIndex
|
|
84
80
|
groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal, taskDivisions, taskIndex = count(groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal, taskDivisions, taskIndex)
|
|
85
|
-
state = ParallelMapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow,
|
|
81
|
+
state = ParallelMapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow, taskDivisions=taskDivisions, taskIndex=taskIndex)
|
|
86
82
|
return state
|
|
87
83
|
|
|
88
84
|
def doTheNeedful(state: ParallelMapFoldingState, concurrencyLimit: int) -> tuple[int, list[ParallelMapFoldingState]]:
|
|
@@ -99,4 +95,4 @@ def doTheNeedful(state: ParallelMapFoldingState, concurrencyLimit: int) -> tuple
|
|
|
99
95
|
listStatesParallel[indexSherpa] = dictionaryConcurrency[indexSherpa].result()
|
|
100
96
|
groupsOfFoldsTotal += listStatesParallel[indexSherpa].groupsOfFolds
|
|
101
97
|
foldsTotal: int = groupsOfFoldsTotal * stateParallel.leavesTotal
|
|
102
|
-
return (foldsTotal, listStatesParallel)
|
|
98
|
+
return (foldsTotal, listStatesParallel)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
from mapFolding.dataBaskets import
|
|
2
|
-
Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal,
|
|
3
|
-
MapFoldingState)
|
|
1
|
+
from mapFolding.dataBaskets import Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal, MapFoldingState
|
|
4
2
|
from numba import jit
|
|
5
3
|
|
|
6
4
|
@jit(cache=True, error_model='numpy', fastmath=True, forceinline=True)
|
|
@@ -68,10 +66,9 @@ def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
|
|
|
68
66
|
gapsWhere: Array1DLeavesTotal = state.gapsWhere
|
|
69
67
|
leafAbove: Array1DLeavesTotal = state.leafAbove
|
|
70
68
|
leafBelow: Array1DLeavesTotal = state.leafBelow
|
|
71
|
-
leafComparison: Array1DLeavesTotal = state.leafComparison
|
|
72
69
|
connectionGraph: Array3DLeavesTotal = state.connectionGraph
|
|
73
70
|
dimensionsTotal: DatatypeLeavesTotal = state.dimensionsTotal
|
|
74
71
|
leavesTotal: DatatypeLeavesTotal = state.leavesTotal
|
|
75
72
|
groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal = count(groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)
|
|
76
|
-
state = MapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow
|
|
77
|
-
return state
|
|
73
|
+
state = MapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow)
|
|
74
|
+
return state
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
from mapFolding.algorithms.matrixMeandersBeDry import areIntegersWide,
|
|
1
|
+
from mapFolding.algorithms.matrixMeandersBeDry import (areIntegersWide,
|
|
2
|
+
walkDyckPath)
|
|
2
3
|
from mapFolding.dataBaskets import MatrixMeandersNumPyState
|
|
3
4
|
|
|
4
|
-
def outfitDictionaryBitGroups(state: MatrixMeandersNumPyState) -> dict[tuple[int, int], int]:
|
|
5
|
-
"""Outfit `dictionaryBitGroups` so it may manage the computations for one iteration of the transfer matrix.
|
|
6
|
-
|
|
7
|
-
Parameters
|
|
8
|
-
----------
|
|
9
|
-
state : MatrixMeandersState
|
|
10
|
-
The current state of the computation, including `dictionaryMeanders`.
|
|
11
|
-
|
|
12
|
-
Returns
|
|
13
|
-
-------
|
|
14
|
-
dictionaryBitGroups : dict[tuple[int, int], int]
|
|
15
|
-
A dictionary of `(bitsAlpha, bitsZulu)` to `crossings`.
|
|
16
|
-
"""
|
|
17
|
-
state.bitWidth = max(state.dictionaryMeanders.keys()).bit_length()
|
|
18
|
-
return {(arcCode & state.locatorBits, arcCode >> 1 & state.locatorBits): crossings for arcCode, crossings in state.dictionaryMeanders.items()}
|
|
19
5
|
|
|
20
6
|
def countBigInt(state: MatrixMeandersNumPyState) -> MatrixMeandersNumPyState:
|
|
21
7
|
"""Count meanders with matrix transfer algorithm using Python `int` (*int*eger) contained in a Python `dict` (*dict*ionary).
|
|
@@ -30,24 +16,28 @@ def countBigInt(state: MatrixMeandersNumPyState) -> MatrixMeandersNumPyState:
|
|
|
30
16
|
The matrix transfer algorithm is sophisticated, but this implementation is straightforward: compute each index one at a time,
|
|
31
17
|
compute each `arcCode` one at a time, and compute each type of analysis one at a time.
|
|
32
18
|
"""
|
|
33
|
-
|
|
34
|
-
while state.
|
|
35
|
-
state.
|
|
36
|
-
|
|
19
|
+
dictionaryArcCodeToCrossings: dict[int, int] = {}
|
|
20
|
+
while state.boundary > 0 and areIntegersWide(state):
|
|
21
|
+
state.boundary -= 1
|
|
22
|
+
state.bitWidth = max(state.dictionaryMeanders.keys()).bit_length()
|
|
23
|
+
dictionaryArcCodeToCrossings = state.dictionaryMeanders.copy()
|
|
37
24
|
state.dictionaryMeanders = {}
|
|
38
|
-
for
|
|
25
|
+
for arcCode, crossings in dictionaryArcCodeToCrossings.items():
|
|
26
|
+
bitsAlpha: int = arcCode & state.locatorBits
|
|
27
|
+
bitsZulu: int = arcCode >> 1 & state.locatorBits
|
|
39
28
|
bitsAlphaHasArcs: bool = bitsAlpha > 1
|
|
40
29
|
bitsZuluHasArcs: bool = bitsZulu > 1
|
|
41
|
-
bitsAlphaIsEven =
|
|
30
|
+
bitsAlphaIsEven: int = bitsAlpha & 1 ^ 1
|
|
31
|
+
bitsZuluIsEven: int = bitsZulu & 1 ^ 1
|
|
42
32
|
arcCodeAnalysis = (bitsAlpha | bitsZulu << 1) << 2 | 3
|
|
43
33
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
44
34
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
45
35
|
if bitsAlphaHasArcs:
|
|
46
|
-
arcCodeAnalysis = bitsAlpha >> 2 | bitsZulu << 3 |
|
|
36
|
+
arcCodeAnalysis = bitsAlpha >> 2 | bitsZulu << 3 | bitsAlphaIsEven << 1
|
|
47
37
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
48
38
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
49
39
|
if bitsZuluHasArcs:
|
|
50
|
-
arcCodeAnalysis = bitsZulu >> 1 | bitsAlpha << 2 |
|
|
40
|
+
arcCodeAnalysis = bitsZulu >> 1 | bitsAlpha << 2 | bitsZuluIsEven
|
|
51
41
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
52
42
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
53
43
|
if bitsAlphaHasArcs and bitsZuluHasArcs and (bitsAlphaIsEven or bitsZuluIsEven):
|
|
@@ -58,5 +48,5 @@ def countBigInt(state: MatrixMeandersNumPyState) -> MatrixMeandersNumPyState:
|
|
|
58
48
|
arcCodeAnalysis: int = bitsZulu >> 2 << 1 | bitsAlpha >> 2
|
|
59
49
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
60
50
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
61
|
-
|
|
51
|
+
dictionaryArcCodeToCrossings = {}
|
|
62
52
|
return state
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from mapFolding.dataBaskets import MapFoldingState
|
|
2
|
+
from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
|
|
2
3
|
|
|
3
4
|
def count(state: MapFoldingState) -> MapFoldingState:
|
|
4
5
|
while state.leaf1ndex > 4:
|
|
@@ -47,4 +48,9 @@ def count(state: MapFoldingState) -> MapFoldingState:
|
|
|
47
48
|
state.leaf1ndex += 1
|
|
48
49
|
else:
|
|
49
50
|
state.groupsOfFolds *= 2
|
|
51
|
+
return state
|
|
52
|
+
|
|
53
|
+
def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
|
|
54
|
+
state = transitionOnGroupsOfFolds(state)
|
|
55
|
+
state = count(state)
|
|
50
56
|
return state
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from mapFolding.dataBaskets import
|
|
2
|
-
|
|
1
|
+
from mapFolding.dataBaskets import Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal, MapFoldingState
|
|
2
|
+
from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
|
|
3
3
|
from numba import jit
|
|
4
4
|
|
|
5
5
|
@jit(cache=True, error_model='numpy', fastmath=True, forceinline=True)
|
|
@@ -45,3 +45,27 @@ def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1nde
|
|
|
45
45
|
else:
|
|
46
46
|
groupsOfFolds *= 2
|
|
47
47
|
return (groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)
|
|
48
|
+
|
|
49
|
+
def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
|
|
50
|
+
state = transitionOnGroupsOfFolds(state)
|
|
51
|
+
mapShape: tuple[DatatypeLeavesTotal, ...] = state.mapShape
|
|
52
|
+
groupsOfFolds: DatatypeFoldsTotal = state.groupsOfFolds
|
|
53
|
+
gap1ndex: DatatypeElephino = state.gap1ndex
|
|
54
|
+
gap1ndexCeiling: DatatypeElephino = state.gap1ndexCeiling
|
|
55
|
+
indexDimension: DatatypeLeavesTotal = state.indexDimension
|
|
56
|
+
indexLeaf: DatatypeLeavesTotal = state.indexLeaf
|
|
57
|
+
indexMiniGap: DatatypeElephino = state.indexMiniGap
|
|
58
|
+
leaf1ndex: DatatypeLeavesTotal = state.leaf1ndex
|
|
59
|
+
leafConnectee: DatatypeLeavesTotal = state.leafConnectee
|
|
60
|
+
dimensionsUnconstrained: DatatypeLeavesTotal = state.dimensionsUnconstrained
|
|
61
|
+
countDimensionsGapped: Array1DLeavesTotal = state.countDimensionsGapped
|
|
62
|
+
gapRangeStart: Array1DElephino = state.gapRangeStart
|
|
63
|
+
gapsWhere: Array1DLeavesTotal = state.gapsWhere
|
|
64
|
+
leafAbove: Array1DLeavesTotal = state.leafAbove
|
|
65
|
+
leafBelow: Array1DLeavesTotal = state.leafBelow
|
|
66
|
+
connectionGraph: Array3DLeavesTotal = state.connectionGraph
|
|
67
|
+
dimensionsTotal: DatatypeLeavesTotal = state.dimensionsTotal
|
|
68
|
+
leavesTotal: DatatypeLeavesTotal = state.leavesTotal
|
|
69
|
+
groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal = count(groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)
|
|
70
|
+
state = MapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow)
|
|
71
|
+
return state
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from mapFolding.dataBaskets import MapFoldingState
|
|
2
|
+
from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
|
|
2
3
|
|
|
3
4
|
def count(state: MapFoldingState) -> MapFoldingState:
|
|
4
5
|
while state.leaf1ndex > 4:
|
|
@@ -41,4 +42,9 @@ def count(state: MapFoldingState) -> MapFoldingState:
|
|
|
41
42
|
state.leaf1ndex += 1
|
|
42
43
|
else:
|
|
43
44
|
state.groupsOfFolds *= 2
|
|
45
|
+
return state
|
|
46
|
+
|
|
47
|
+
def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
|
|
48
|
+
state = transitionOnGroupsOfFolds(state)
|
|
49
|
+
state = count(state)
|
|
44
50
|
return state
|
|
@@ -40,7 +40,7 @@ import pytest
|
|
|
40
40
|
if __name__ == '__main__':
|
|
41
41
|
multiprocessing.set_start_method('spawn')
|
|
42
42
|
|
|
43
|
-
@pytest.mark.parametrize('flow', ['algorithm', 'asynchronous',
|
|
43
|
+
@pytest.mark.parametrize('flow', ['algorithm', 'asynchronous', 'theorem2', 'theorem2Numba', 'theorem2Trimmed'])
|
|
44
44
|
def test_A007822(flow: str) -> None:
|
|
45
45
|
"""Test A007822 flow options.
|
|
46
46
|
|
|
@@ -21,6 +21,8 @@ def transformOEISidByFormula(pathFilenameSource: Path) -> None:
|
|
|
21
21
|
functionOf: str = 'Error during transformation' # The value of `functionOf` is in the docstring of function `oeisID` in `pathFilenameSource`.
|
|
22
22
|
|
|
23
23
|
for oeisID, FunctionDef in dictionaryFunctionDef.items():
|
|
24
|
+
if not oeisID.startswith('A') or not oeisID[1:7].isdigit():
|
|
25
|
+
continue
|
|
24
26
|
dictionary = dictionaryOEISMapFolding if oeisID in dictionaryOEISMapFolding else dictionaryOEIS
|
|
25
27
|
functionOf = raiseIfNone(ast.get_docstring(FunctionDef))
|
|
26
28
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.4
|
|
4
4
|
Summary: Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations, and analyze computational states.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -40,7 +40,10 @@ Requires-Dist: hunterMakesPy
|
|
|
40
40
|
Requires-Dist: isort
|
|
41
41
|
Requires-Dist: numpy
|
|
42
42
|
Requires-Dist: platformdirs
|
|
43
|
+
Requires-Dist: sympy
|
|
43
44
|
Provides-Extra: development
|
|
45
|
+
Requires-Dist: ipykernel; extra == "development"
|
|
46
|
+
Requires-Dist: ipywidgets; extra == "development"
|
|
44
47
|
Requires-Dist: memray; sys_platform == "linux" and extra == "development"
|
|
45
48
|
Requires-Dist: mypy; extra == "development"
|
|
46
49
|
Requires-Dist: pyupgrade; extra == "development"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
easyRun/A000682.py,sha256=nJJrmVycQUe1H7ms11QGz1ZyYUVdZsjEGtuJk97yxQ0,713
|
|
2
|
+
easyRun/A005316.py,sha256=WCIqsNSevjgUSnTe24d6zWKLZnJSoy14piSt6G26WuE,434
|
|
3
|
+
easyRun/NOTcountingFolds.py,sha256=3wlVLr_KVZwniu-F4KCsBUhsErpu9BZCBGuvlz6-668,807
|
|
4
|
+
easyRun/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
easyRun/countFolds.py,sha256=_7bdg31cN-Dtq4CATECRI1_dxhcrLwoTU9z8d9RWBjk,1181
|
|
6
|
+
easyRun/generateAllModules.py,sha256=xsXFs0BwQ_O5m5rqMjhgMOZ3lj9ssmc3Qdxazp7_uAI,622
|
|
7
|
+
easyRun/meanders.py,sha256=PeilOcWDZwTH60NHgkkMGeqIIAAfRMgL4f7qrVUN4gs,1824
|
|
8
|
+
mapFolding/__init__.py,sha256=ZVkNS11uN04EWDBazqkY4AeVZC9UOXV_W-1V9QZgnl0,1913
|
|
9
|
+
mapFolding/_theSSOT.py,sha256=QuyDsMCbqv3Au4RUgdYPcyR89JrT9WkzcauzybpgKzU,5384
|
|
10
|
+
mapFolding/_theTypes.py,sha256=0uf4x31ilFxIO6sbiSd39H5_7VWBKxColVmfy3oIafk,7376
|
|
11
|
+
mapFolding/basecamp.py,sha256=WXrtT5SeYdHovlTdTjkMh6ua_EU7yApBcMyPVMJfpvs,15088
|
|
12
|
+
mapFolding/beDRY.py,sha256=0vJwnsvz6_jR8gfuU38vW9KoMTnRqyaYaAwbJcKLhFI,12674
|
|
13
|
+
mapFolding/dataBaskets.py,sha256=2_auINZy4O3FreQIAK3DX0QafWoPO-WGop8QWOzKxIg,29058
|
|
14
|
+
mapFolding/filesystemToolkit.py,sha256=ic69Y043xrdoFjKqiB0YJ6Zp8oosBWwdXi_hmg79PVs,10134
|
|
15
|
+
mapFolding/oeis.py,sha256=2sqdFgYguB4sDpcYGYB_mJL57k9sHs7FUXF05pvIEak,17300
|
|
16
|
+
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
mapFolding/algorithms/A086345.py,sha256=te3Zy76eJLE3dSFsK7hXTHJapewM1u43GBUV78fL2z8,2492
|
|
18
|
+
mapFolding/algorithms/__init__.py,sha256=gARPqfySaeSWMfApQ5wSxzy7ZdgLdKYsLqsRSEYWwWI,28
|
|
19
|
+
mapFolding/algorithms/daoOfMapFolding.py,sha256=ncTIiBfTsM8SNVx9qefZ0bBcBtviWLSk4iPv3Z9nGiE,5442
|
|
20
|
+
mapFolding/algorithms/matrixMeanders.py,sha256=swU6xSo0QhhmA_FxmZhmqvGLJ0h_rS_75jO-SHETWLA,3489
|
|
21
|
+
mapFolding/algorithms/matrixMeandersBeDry.py,sha256=92qk8dSXn2YxtUYhzSFpJpKDRUx6vbfMaRCbJt9baw0,7539
|
|
22
|
+
mapFolding/algorithms/matrixMeandersNumPy.py,sha256=DsMUnB-tsttBm4ib385BaYS2Dnr-KCokKWfK7RjQ780,17147
|
|
23
|
+
mapFolding/algorithms/matrixMeandersPandas.py,sha256=9Pm49HdK0g2MJ15CuZoXOFbdn8JcE0GHzz2p9NB3xvA,13167
|
|
24
|
+
mapFolding/algorithms/oeisIDbyFormula.py,sha256=jinaLXJb3annODlyidtNZkKIKUuFKp_yzjEZMHSMhQ0,11782
|
|
25
|
+
mapFolding/algorithms/symmetricFolds.py,sha256=ji6GitOuVqd_g0X3_mcKuXB6RhjVS0EpOQanlAc5fPI,1457
|
|
26
|
+
mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py,sha256=eGf_gvHUuHAPFFQZd3NIaozY2sQUGse_njtZ8_AyZ-U,2438
|
|
27
|
+
mapFolding/reference/A000682facts.py,sha256=wRg5uy72M-o-cYEF3waCa7NjTUZ3XOoD9dmkTaUiH0o,23510
|
|
28
|
+
mapFolding/reference/A005316facts.py,sha256=Cg2Pqtv3Dnk8IZOqer8Wu3Ie2uwJV_M0Kmr6_QXjKuQ,11768
|
|
29
|
+
mapFolding/reference/A086345Wu.py,sha256=3FJlvcVkrQL2hz4IN2NdzmdMW0weWfYh9l1pnXBTQnc,1110
|
|
30
|
+
mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInWFw0,2206
|
|
31
|
+
mapFolding/reference/flattened.py,sha256=0eHgLFIeIeVUsI5zF5oSy5iWYrjOMzxr7KjDxiTe01k,16078
|
|
32
|
+
mapFolding/reference/hunterNumba.py,sha256=iLfyqwGdAh6c5GbapnKsWhAsNsR3O-fyGGHAdohluLw,7258
|
|
33
|
+
mapFolding/reference/irvineJavaPort.py,sha256=XnsL4g33LRrYwAhcrAVt-ujsP6QD6fbyCsGYzcm9g_k,3724
|
|
34
|
+
mapFolding/reference/jaxCount.py,sha256=t8ons45zyWNJQ-nmn1qbhNsTkTnRzf7ATauaYvIlkRI,14853
|
|
35
|
+
mapFolding/reference/lunnonNumpy.py,sha256=mMgrgbrBpe4nmo72ThEI-MGH0OwEHmfMPczSXHp2qKo,4357
|
|
36
|
+
mapFolding/reference/lunnonWhile.py,sha256=ZL8GAQtPs5nJZSgoDl5USrLSS_zs03y98y1Z9E4jOmQ,3799
|
|
37
|
+
mapFolding/reference/rotatedEntryPoint.py,sha256=3IJU7Hc2PDSE71wmSkDs4Z3t0Px9NBSzmCsVrgQuQyU,10274
|
|
38
|
+
mapFolding/reference/total_countPlus1vsPlusN.py,sha256=yJZAVLVdoXqHag2_N6_6CT-Q6HXBgRro-eny93-Rlpw,9307
|
|
39
|
+
mapFolding/reference/jobsCompleted/__init__.py,sha256=TU93ZGUW1xEkT6d9mQFn_rp5DvRy0ZslEB2Q6MF5ZDc,2596
|
|
40
|
+
mapFolding/reference/jobsCompleted/[2x19]/p2x19.py,sha256=_tvYtfzMWVo2VtUbIAieoscb4N8FFflgTdW4-ljBUuA,19626
|
|
41
|
+
mapFolding/reference/jobsCompleted/p2x19/p2x19.py,sha256=eZEw4Me4ocTt6VXoK2-Sbd5SowZtxRIbN9dZmc7OCVg,6395
|
|
42
|
+
mapFolding/reference/matrixMeandersAnalysis/__init__.py,sha256=FQbR63_z3_zd3HMrpUxx3_YIcn9znzA0RIggcMntSC8,35
|
|
43
|
+
mapFolding/reference/matrixMeandersAnalysis/prefixNotationNotes.py,sha256=R9MUdS0vLEyaVdCio2AAfxEpBz6FDp7cZotEE47nFdU,1001
|
|
44
|
+
mapFolding/reference/matrixMeandersAnalysis/signatures.py,sha256=6yHwW22032ysBgoG9LXxUyvWlKjQgxpB-f8lI213YZ0,20677
|
|
45
|
+
mapFolding/reference/meandersDumpingGround/A005316JavaPort.py,sha256=syMHicfioP-0GrOq7GnEpuAFSNvRwnbGim0mqV862sA,4885
|
|
46
|
+
mapFolding/reference/meandersDumpingGround/A005316imperative.py,sha256=UEbXPkORngVo0UrwS81SY2gwz1XWAaMZ0rgA7HMiVYk,3793
|
|
47
|
+
mapFolding/reference/meandersDumpingGround/A005316primitiveOptimized.py,sha256=iFig6Edv1E774xrlVUFLyscC40DqDhV-oh4hOnG2DLI,4116
|
|
48
|
+
mapFolding/reference/meandersDumpingGround/A005316redis.py,sha256=MPeiobrs3VsNZOOKYBg52oVp0OjVDzLEdsRKfrZ9LrU,4328
|
|
49
|
+
mapFolding/reference/meandersDumpingGround/A005316write2disk.py,sha256=NMVrdhe5KhnXQfaQ5Xr7Pwl5oXYEOM1DrMISDDOCVVw,5633
|
|
50
|
+
mapFolding/reference/meandersDumpingGround/matrixMeanders64retired.py,sha256=oRVgf6zkWRjk7dWR-Px41M_5spdvKy_Pich0qd7oxVA,9270
|
|
51
|
+
mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineV2.py,sha256=VpRiIGhnk-DbxwsHwCeCwXqcKLSNyHl-iRGLDH9ZGMY,7674
|
|
52
|
+
mapFolding/reference/meandersDumpingGround/matrixMeandersNumPyV1finalForm.py,sha256=G4358jHFr7hdOa709c8nYdR3eMMZjUqcxbS-L2aAOqw,24428
|
|
53
|
+
mapFolding/reference/meandersDumpingGround/matrixMeandersSlicePop.py,sha256=XyiesSQAH1dRplYx_CdR1FzcXvgmmxzj27V4aIqPp7o,5353
|
|
54
|
+
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=Dpu33Wu6OziJ8Sqx6TCHA10TBmNQT8yiCl2FtaM3jl0,13723
|
|
55
|
+
mapFolding/someAssemblyRequired/__init__.py,sha256=PIdLYHFSfYsQSP55PoQSusi1dsOGhiY986kgosGO3vI,5811
|
|
56
|
+
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=QC2cmCea18BZ_WpoWoErYCWhROvmd40_i_nBO7YFRaE,6378
|
|
57
|
+
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=rp1w-y5wXctcwSPkHG1JQSCY3ro5lc0AoAF_PkBJfQQ,14798
|
|
58
|
+
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=tY0-2K0BFkwLAAjSrFJLPoG8CevDHOFc3OH3TxXANzg,2806
|
|
59
|
+
mapFolding/someAssemblyRequired/infoBooth.py,sha256=lwz8Zp8FRlTrBFqBHnch6JC_AukQ3o9O4lbBJ-wQVrY,2417
|
|
60
|
+
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=C29oQyDFE0St85opv37hqvIncpZ5IzCHavprex4HNIU,14221
|
|
61
|
+
mapFolding/someAssemblyRequired/makeJobTheorem2codon.py,sha256=2wNA3iztFDN3jzxIneckgiR5UyRfApdjHbdXA4CRCWY,10118
|
|
62
|
+
mapFolding/someAssemblyRequired/makingModules_count.py,sha256=E1WwaM_w1xiBusX7ah61e2AdMiWIBqNM5v0r5pjsd_k,15053
|
|
63
|
+
mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py,sha256=1lo_30R7__bkrOlA7t-iwb1vnw6kCN5eZbCsiZg29cw,3119
|
|
64
|
+
mapFolding/someAssemblyRequired/toolkitMakeModules.py,sha256=wROp5yTJWts-_adcOwLKXr1e2P5vElKk4NCYkscXMZo,7915
|
|
65
|
+
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=Zi3JeJDio177T4P3om5XK_2wZzplZvkNy4PzY0NFiyM,14914
|
|
66
|
+
mapFolding/someAssemblyRequired/transformationTools.py,sha256=FzAraqdgxB7XOcxfKxeUI_zUNYiRKRn8eVAt6LcO4Ck,11553
|
|
67
|
+
mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py,sha256=HbnYk4th5p_jCJI-WzIED8a35JZSLVpecZyTaSIfKXM,1609
|
|
68
|
+
mapFolding/someAssemblyRequired/A007822/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
|
+
mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py,sha256=mT4IEFTF2lVT8GeNJ2e18eWleBjwJGbOFZow0CjXx4Q,1726
|
|
70
|
+
mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py,sha256=QMH0ihfkLHr_j3UY3-vTRU3_YbyowTV9c-rP-rr5Ml0,5528
|
|
71
|
+
mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py,sha256=o80ac_b8KjogJ0jw0lUl36Qlw0XSw1QLQfzEU8UtjDE,4157
|
|
72
|
+
mapFolding/someAssemblyRequired/mapFoldingModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
|
+
mapFolding/someAssemblyRequired/mapFoldingModules/makeMapFoldingModules.py,sha256=mZS1OQ4ttnStKO0PZkb6dKjPU-DsbFUrrc2eG7Bw61I,16341
|
|
74
|
+
mapFolding/someAssemblyRequired/meanders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
|
+
mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py,sha256=fvuZhOzL4LcUrDQq5gFtGF2U7xwlosTlbs_mLkeSr9E,3305
|
|
76
|
+
mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
77
|
+
mapFolding/syntheticModules/countParallelNumba.py,sha256=IarQHgZmxCt3I1WkRHRrqPwpeBSNzcV6ZEX2X0HrC8c,7777
|
|
78
|
+
mapFolding/syntheticModules/daoOfMapFoldingNumba.py,sha256=6V2DwXtmO6EeQXf6oxDp3myp-vbsVq6G0ZjnLRF9rCw,5940
|
|
79
|
+
mapFolding/syntheticModules/initializeState.py,sha256=OTiVi1Ywnlwk8tbwSIFjPJa_yBCINoapaCzGXDAJq_k,3121
|
|
80
|
+
mapFolding/syntheticModules/theorem2.py,sha256=sqo8AA7CqvejAEuNqo5KIx7shjCQsuh8l8ThJot5RPA,3262
|
|
81
|
+
mapFolding/syntheticModules/theorem2Numba.py,sha256=h4ToUvB5Ubesi3mGVrIHErxfEnzeqlvSI7otnJLAo4o,5650
|
|
82
|
+
mapFolding/syntheticModules/theorem2Trimmed.py,sha256=JjWz71sBHdlzw1bDhy0rtEVvf6RNR9LVYLUvCdPYJ3g,2930
|
|
83
|
+
mapFolding/syntheticModules/A007822/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
84
|
+
mapFolding/syntheticModules/A007822/algorithm.py,sha256=K8H9cyJRhSeQ6ZPYK8ygH7luYh6Z0dpoav-hcWzb5C4,7041
|
|
85
|
+
mapFolding/syntheticModules/A007822/asynchronous.py,sha256=mr4_Y6VT7AXrT1Yh6A5kn77c2N-mAjV1zh-8oRvOWd8,8653
|
|
86
|
+
mapFolding/syntheticModules/A007822/initializeState.py,sha256=qDl156iCf9qmlHw6O9oJG_9f706dixp21qX7jFW2Qos,4040
|
|
87
|
+
mapFolding/syntheticModules/A007822/theorem2.py,sha256=4N4AFuxpJdv9f-7RsH9-yEKYg_66nPbiTi6DFDBymSs,4197
|
|
88
|
+
mapFolding/syntheticModules/A007822/theorem2Numba.py,sha256=z9hSU8tPoScQVklipmA1DjAKj5cJduwA5f_ZpNtew54,7138
|
|
89
|
+
mapFolding/syntheticModules/A007822/theorem2Trimmed.py,sha256=8QU83qJO0Sxxh8xMOD2sdksOWdYR02qir_qpmzJKcMY,3865
|
|
90
|
+
mapFolding/syntheticModules/meanders/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
91
|
+
mapFolding/syntheticModules/meanders/bigInt.py,sha256=G6iZbPaEz2gHInMAZ0ZBUgoPbSjS7YYI2QjsxWg-PQE,2962
|
|
92
|
+
mapFolding/tests/__init__.py,sha256=QVCHSMFVvTxV3mAyYOLkMFAFyBJ514zdoVnDmpBJnTo,1336
|
|
93
|
+
mapFolding/tests/conftest.py,sha256=5vV_Vy5ZrV3uoP9bQ8B-Kqc0zMrL7KAhsPJwchMDb6w,15700
|
|
94
|
+
mapFolding/tests/test_computations.py,sha256=72b_6rxaJsaIuTVwAF2qkc2rIFJE-bM3hHcFhT756MQ,8600
|
|
95
|
+
mapFolding/tests/test_filesystem.py,sha256=0rYQ62f4e3HOoymXrxDWbqNEBJQ7DGN8RUOMI84tE2Q,3892
|
|
96
|
+
mapFolding/tests/test_oeis.py,sha256=M4Fb0e4_h9QTX9Oy6l5-M1UQfNqeonoGVOn0DJI9huE,4854
|
|
97
|
+
mapFolding/tests/test_other.py,sha256=ScBiJ78LnyAaW-RhxcouX6Xw10wgpSdqfvT4LO3WjnQ,4766
|
|
98
|
+
mapFolding/tests/test_tasks.py,sha256=_pr9JRWjjNKA7sww70XvkJJdGPruBVzubM63RmD_Du0,4013
|
|
99
|
+
mapFolding/zCuzDocStoopid/__init__.py,sha256=uKcGXsaYKH9kQUGHjaY0EtWtU6qybb9Fs09ZYKEFMNs,236
|
|
100
|
+
mapFolding/zCuzDocStoopid/makeDocstrings.py,sha256=cQl-B-RlAkFijATUTWfKCael46foH-ZsOp1EHoYxoGs,3212
|
|
101
|
+
mapfolding-0.16.4.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
102
|
+
mapfolding-0.16.4.dist-info/METADATA,sha256=78ArH8-l_3SsbbH2A4IDuT6P9l7tetRaEvfjHVVO7m0,7690
|
|
103
|
+
mapfolding-0.16.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
104
|
+
mapfolding-0.16.4.dist-info/entry_points.txt,sha256=-mH9DjW9tDRMPaeoSWKKywG35cR28m12H_jtmrB4eY8,98
|
|
105
|
+
mapfolding-0.16.4.dist-info/top_level.txt,sha256=jNj7ccwEy_9uqs0hsQCO_rPXgaGn8-IMqXePQN6nZTY,19
|
|
106
|
+
mapfolding-0.16.4.dist-info/RECORD,,
|
mapFolding/_dataPacking.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from mapFolding.dataBaskets import MapFoldingState
|
|
3
|
-
from typing import Any
|
|
4
|
-
import astToolkit
|
|
5
|
-
import dataclasses
|
|
6
|
-
import functools
|
|
7
|
-
import inspect
|
|
8
|
-
|
|
9
|
-
r"""Notes
|
|
10
|
-
Goal: create a decorator, `unRePackMapFoldingState`, that will unpack `MapFoldingState`, pass only the parameters in the decorated function, receive the
|
|
11
|
-
values returned by the function, and repack `MapFoldingState`.
|
|
12
|
-
|
|
13
|
-
You must use dynamic programming. If the datatype or the field name changes, for example, that should not affect the decorator.
|
|
14
|
-
|
|
15
|
-
To use in, for example, C:\apps\mapFolding\mapFolding\syntheticModules\A007822\theorem2Numba.py. Analogous to
|
|
16
|
-
`Z0Z_tools.waveformSpectrogramWaveform`, see
|
|
17
|
-
https://github.com/hunterhogan/Z0Z_tools/blob/2c393c2831382dfe6f3e742cf56db39e71126cbc/Z0Z_tools/ioAudio.py
|
|
18
|
-
|
|
19
|
-
For examples of manipulating `dataclasses`, see also:
|
|
20
|
-
C:\apps\mapFolding\mapFolding\someAssemblyRequired\_toolkitContainers.py and
|
|
21
|
-
C:\apps\mapFolding\mapFolding\someAssemblyRequired\transformationTools.py
|
|
22
|
-
|
|
23
|
-
- `TypeVar` may be useful.
|
|
24
|
-
|
|
25
|
-
- `dataclasses` has inspection tools.
|
|
26
|
-
|
|
27
|
-
- `return MapFoldingState(...` Check if the field is init=True
|
|
28
|
-
|
|
29
|
-
Prototype. Eventual home will probably be "beDry.py".
|
|
30
|
-
"""
|
|
31
|
-
|
|
32
|
-
def unRePackMapFoldingState[CallableTargetType: Callable[..., Any]](callableTarget: CallableTargetType) -> Callable[[MapFoldingState], MapFoldingState]:
|
|
33
|
-
signatureTargetFunction: inspect.Signature = inspect.signature(callableTarget)
|
|
34
|
-
parametersTargetFunction: list[str] = list(signatureTargetFunction.parameters.keys())
|
|
35
|
-
|
|
36
|
-
fieldsMapFoldingState: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(MapFoldingState)
|
|
37
|
-
|
|
38
|
-
fieldsInitializable: dict[str, dataclasses.Field[Any]] = {field.name: field for field in fieldsMapFoldingState if field.init}
|
|
39
|
-
|
|
40
|
-
@functools.wraps(callableTarget)
|
|
41
|
-
def decoratedFunction(mapFoldingStateInstance: MapFoldingState, **additionalKeywordArguments: Any) -> MapFoldingState:
|
|
42
|
-
dataclassAsDict: dict[str, Any] = dataclasses.asdict(mapFoldingStateInstance)
|
|
43
|
-
|
|
44
|
-
argumentsForTargetFunction: list[Any] = []
|
|
45
|
-
for parameterName in parametersTargetFunction:
|
|
46
|
-
if parameterName in dataclassAsDict:
|
|
47
|
-
argumentsForTargetFunction.append(dataclassAsDict[parameterName])
|
|
48
|
-
elif parameterName in additionalKeywordArguments:
|
|
49
|
-
argumentsForTargetFunction.append(additionalKeywordArguments[parameterName])
|
|
50
|
-
else:
|
|
51
|
-
errorMessage = f"Parameter '{parameterName}' not found in MapFoldingState or additional arguments"
|
|
52
|
-
raise ValueError(errorMessage)
|
|
53
|
-
|
|
54
|
-
returnedFromTargetFunction: Any = callableTarget(*argumentsForTargetFunction)
|
|
55
|
-
|
|
56
|
-
argumentsForMapFoldingStateConstructor: dict[str, Any] = {fieldName: dataclassAsDict[fieldName] for fieldName in fieldsInitializable}
|
|
57
|
-
|
|
58
|
-
if len(parametersTargetFunction) == 1:
|
|
59
|
-
singleParameterName: str = parametersTargetFunction[0]
|
|
60
|
-
if singleParameterName in fieldsInitializable:
|
|
61
|
-
argumentsForMapFoldingStateConstructor[singleParameterName] = returnedFromTargetFunction
|
|
62
|
-
elif isinstance(returnedFromTargetFunction, tuple) and len(returnedFromTargetFunction) == len(parametersTargetFunction):
|
|
63
|
-
updatedFieldsFromReturn: dict[str, Any] = {parameterName: returnedValue for parameterName, returnedValue in zip(parametersTargetFunction, returnedFromTargetFunction, strict=True) if parameterName in fieldsInitializable}
|
|
64
|
-
argumentsForMapFoldingStateConstructor.update(updatedFieldsFromReturn)
|
|
65
|
-
|
|
66
|
-
return MapFoldingState(**argumentsForMapFoldingStateConstructor)
|
|
67
|
-
|
|
68
|
-
return decoratedFunction
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterable
|
|
2
|
-
from hunterMakesPy import raiseIfNone
|
|
3
|
-
|
|
4
|
-
class BasicMeanderProblem:
|
|
5
|
-
|
|
6
|
-
def __init__(self, remainingBridges: int) -> None:
|
|
7
|
-
self.remainingBridges = remainingBridges
|
|
8
|
-
self.archStateLimit = 1 << (2 + (2 * (remainingBridges + 1)))
|
|
9
|
-
self.bridgesTotalIsOdd = (remainingBridges & 1) == 1
|
|
10
|
-
|
|
11
|
-
def initializeA005316(self) -> list[int]:
|
|
12
|
-
if self.bridgesTotalIsOdd:
|
|
13
|
-
bitPattern = (1 << 2) | 1
|
|
14
|
-
bitPattern <<= 2
|
|
15
|
-
return [bitPattern | 1 << 1]
|
|
16
|
-
else:
|
|
17
|
-
bitPattern = (1 << 2) | 1
|
|
18
|
-
return [bitPattern | bitPattern << 1]
|
|
19
|
-
|
|
20
|
-
def initializeA000682(self) -> list[int]:
|
|
21
|
-
initialStatesList: list[int] = []
|
|
22
|
-
bitPattern = 1 if self.bridgesTotalIsOdd else ((1 << 2) | 1)
|
|
23
|
-
|
|
24
|
-
packedState = bitPattern | bitPattern << 1
|
|
25
|
-
while packedState < self.archStateLimit:
|
|
26
|
-
initialStatesList.append(packedState)
|
|
27
|
-
bitPattern = ((bitPattern << 2) | 1) << 2 | 1
|
|
28
|
-
packedState = bitPattern | bitPattern << 1
|
|
29
|
-
|
|
30
|
-
return initialStatesList
|
|
31
|
-
|
|
32
|
-
def enumerate(self, packedState: int) -> list[int]: # noqa: C901
|
|
33
|
-
bitMask = 0x5555555555555555
|
|
34
|
-
bitWidth = 64
|
|
35
|
-
while bitMask < packedState:
|
|
36
|
-
bitMask |= bitMask << bitWidth
|
|
37
|
-
bitWidth += bitWidth
|
|
38
|
-
lower: int = packedState & bitMask
|
|
39
|
-
upper: int = (packedState - lower) >> 1
|
|
40
|
-
nextStatesList: list[int] = []
|
|
41
|
-
|
|
42
|
-
if lower != 1:
|
|
43
|
-
nextState: int = (lower >> 2 | (((upper << 2) ^ (1 if (lower & 1) == 0 else 0)) << 1))
|
|
44
|
-
if nextState < self.archStateLimit:
|
|
45
|
-
nextStatesList.append(nextState)
|
|
46
|
-
|
|
47
|
-
if upper != 1:
|
|
48
|
-
nextState = (((lower << 2) ^ (1 if (upper & 1) == 0 else 0)) | (upper >> 2) << 1)
|
|
49
|
-
if nextState < self.archStateLimit:
|
|
50
|
-
nextStatesList.append(nextState)
|
|
51
|
-
|
|
52
|
-
nextState = ((lower << 2) | 1 | ((upper << 2) | 1) << 1)
|
|
53
|
-
if nextState < self.archStateLimit:
|
|
54
|
-
nextStatesList.append(nextState)
|
|
55
|
-
|
|
56
|
-
if lower != 1 and upper != 1 and ((lower & 1) == 0 or (upper & 1) == 0):
|
|
57
|
-
if (lower & 1) == 0 and (upper & 1) == 1:
|
|
58
|
-
archBalance = 0
|
|
59
|
-
bitPosition = 1
|
|
60
|
-
while archBalance >= 0:
|
|
61
|
-
bitPosition <<= 2
|
|
62
|
-
archBalance += 1 if (lower & bitPosition) == 0 else -1
|
|
63
|
-
lower ^= bitPosition
|
|
64
|
-
if (upper & 1) == 0 and (lower & 1) == 1:
|
|
65
|
-
archBalance = 0
|
|
66
|
-
bitPosition = 1
|
|
67
|
-
while archBalance >= 0:
|
|
68
|
-
bitPosition <<= 2
|
|
69
|
-
archBalance += 1 if (upper & bitPosition) == 0 else -1
|
|
70
|
-
upper ^= bitPosition
|
|
71
|
-
nextState = (lower >> 2 | (upper >> 2) << 1)
|
|
72
|
-
if nextState < self.archStateLimit:
|
|
73
|
-
nextStatesList.append(nextState)
|
|
74
|
-
|
|
75
|
-
return nextStatesList
|
|
76
|
-
|
|
77
|
-
class SimpleProcessor:
|
|
78
|
-
|
|
79
|
-
def __init__(self) -> None:
|
|
80
|
-
self.createStateMachine: type | None = None
|
|
81
|
-
self.totalTransitions = 0
|
|
82
|
-
|
|
83
|
-
def setCreateStateMachine(self, stateMachineCreator: type) -> None:
|
|
84
|
-
self.createStateMachine = stateMachineCreator
|
|
85
|
-
|
|
86
|
-
def process(self, bridgesCount: int, initialStates: Iterable[int]) -> int:
|
|
87
|
-
stateCounts: list[tuple[int, int]] = [(state, 1) for state in initialStates]
|
|
88
|
-
|
|
89
|
-
self.createStateMachine = raiseIfNone(self.createStateMachine, "State machine creator must be set before processing.")
|
|
90
|
-
bridgesRemaining: int = bridgesCount
|
|
91
|
-
while bridgesRemaining > 0:
|
|
92
|
-
bridgesRemaining -= 1
|
|
93
|
-
stateCounts = self._accumulate(self.createStateMachine(bridgesRemaining), stateCounts)
|
|
94
|
-
|
|
95
|
-
return sum(count for state, count in stateCounts)
|
|
96
|
-
|
|
97
|
-
def _accumulate(self, layer: BasicMeanderProblem, previousCounts: list[tuple[int, int]]) -> list[tuple[int, int]]:
|
|
98
|
-
stateCountsDict: dict[int, int] = {}
|
|
99
|
-
transitions: int = 0
|
|
100
|
-
|
|
101
|
-
for state, count in previousCounts:
|
|
102
|
-
for nextState in layer.enumerate(state):
|
|
103
|
-
if nextState in stateCountsDict:
|
|
104
|
-
stateCountsDict[nextState] += count
|
|
105
|
-
else:
|
|
106
|
-
stateCountsDict[nextState] = count
|
|
107
|
-
transitions += 1
|
|
108
|
-
|
|
109
|
-
self.totalTransitions += transitions
|
|
110
|
-
return list(stateCountsDict.items())
|
|
111
|
-
|
|
112
|
-
def A005316(n: int) -> int:
|
|
113
|
-
processor = SimpleProcessor()
|
|
114
|
-
processor.setCreateStateMachine(BasicMeanderProblem)
|
|
115
|
-
meanderProblem = BasicMeanderProblem(n)
|
|
116
|
-
return processor.process(n, meanderProblem.initializeA005316())
|
|
117
|
-
|
|
118
|
-
def A000682(n: int) -> int:
|
|
119
|
-
processor = SimpleProcessor()
|
|
120
|
-
processor.setCreateStateMachine(BasicMeanderProblem)
|
|
121
|
-
meanderProblem = BasicMeanderProblem(n-1)
|
|
122
|
-
return processor.process(n-1, meanderProblem.initializeA000682())
|