mapFolding 0.16.2__py3-none-any.whl → 0.17.0__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 +2 -2
- easyRun/NOTcountingFolds.py +16 -8
- easyRun/countFolds.py +9 -2
- easyRun/generateAllModules.py +14 -0
- easyRun/meanders.py +4 -4
- mapFolding/__init__.py +1 -0
- mapFolding/_theSSOT.py +3 -2
- mapFolding/_theTypes.py +3 -0
- mapFolding/algorithms/A000136constraintPropagation.py +95 -0
- mapFolding/algorithms/A000136elimination.py +163 -0
- mapFolding/algorithms/A000136eliminationParallel.py +77 -0
- mapFolding/algorithms/A086345.py +75 -0
- mapFolding/algorithms/matrixMeanders.py +59 -18
- mapFolding/algorithms/matrixMeandersNumPyndas.py +841 -0
- mapFolding/algorithms/oeisIDbyFormula.py +2 -2
- mapFolding/algorithms/symmetricFolds.py +35 -0
- mapFolding/basecamp.py +100 -153
- mapFolding/dataBaskets.py +142 -65
- mapFolding/filesystemToolkit.py +4 -32
- mapFolding/oeis.py +5 -12
- mapFolding/reference/A086345Wu.py +25 -0
- mapFolding/reference/irvineJavaPort.py +3 -3
- mapFolding/reference/matrixMeandersAnalysis/signatures.py +3 -0
- mapFolding/reference/meandersDumpingGround/matrixMeandersNumPyV1finalForm.py +1 -1
- mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +10 -45
- mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py +51 -0
- mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +39 -196
- mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +57 -43
- mapFolding/someAssemblyRequired/RecipeJob.py +84 -34
- mapFolding/someAssemblyRequired/__init__.py +4 -8
- mapFolding/someAssemblyRequired/_toolkitContainers.py +38 -7
- mapFolding/someAssemblyRequired/infoBooth.py +41 -23
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +140 -164
- mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +63 -96
- mapFolding/someAssemblyRequired/makingModules_count.py +26 -30
- mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +10 -72
- mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/makeMapFoldingModules.py +30 -35
- mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +13 -11
- mapFolding/someAssemblyRequired/toolkitMakeModules.py +5 -31
- mapFolding/someAssemblyRequired/toolkitNumba.py +3 -2
- mapFolding/someAssemblyRequired/transformationTools.py +12 -15
- mapFolding/syntheticModules/A007822/algorithm.py +45 -50
- mapFolding/syntheticModules/A007822/asynchronous.py +92 -36
- mapFolding/syntheticModules/A007822/initializeState.py +19 -23
- mapFolding/syntheticModules/A007822/theorem2.py +20 -24
- mapFolding/syntheticModules/A007822/theorem2Numba.py +23 -25
- mapFolding/syntheticModules/A007822/theorem2Trimmed.py +19 -23
- mapFolding/syntheticModules/countParallelNumba.py +1 -2
- mapFolding/syntheticModules/daoOfMapFoldingNumba.py +5 -4
- mapFolding/syntheticModules/initializeState.py +1 -1
- mapFolding/syntheticModules/meanders/bigInt.py +59 -22
- mapFolding/syntheticModules/theorem2.py +1 -1
- mapFolding/syntheticModules/theorem2Numba.py +30 -9
- mapFolding/syntheticModules/theorem2Trimmed.py +2 -2
- mapFolding/tests/test_computations.py +29 -3
- {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/METADATA +11 -8
- mapfolding-0.17.0.dist-info/RECORD +107 -0
- mapFolding/_dataPacking.py +0 -68
- mapFolding/algorithms/matrixMeandersBeDry.py +0 -182
- mapFolding/algorithms/matrixMeandersNumPy.py +0 -333
- mapFolding/algorithms/matrixMeandersPandas.py +0 -334
- 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 -70
- mapFolding/syntheticModules/A007822/asynchronousNumba.py +0 -79
- mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +0 -65
- mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +0 -56
- mapFolding/syntheticModules/dataPacking.py +0 -26
- mapFolding/syntheticModules/dataPackingA007822.py +0 -92
- mapfolding-0.16.2.dist-info/RECORD +0 -115
- /mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/__init__.py +0 -0
- {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/WHEEL +0 -0
- {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.16.2.dist-info → mapfolding-0.17.0.dist-info}/top_level.txt +0 -0
|
@@ -41,7 +41,7 @@ def A000560(n: int) -> int:
|
|
|
41
41
|
"""
|
|
42
42
|
Compute A000560(n) as a function of A000682.
|
|
43
43
|
|
|
44
|
-
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A000560 is: "Number of ways of folding a strip of n labeled stamps."
|
|
44
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A000560 is: "Number of symmetric ways of folding a strip of n labeled stamps."
|
|
45
45
|
|
|
46
46
|
The domain of A000560 starts at 2, therefore for values of `n` < 2, a(n) is undefined. The smallest value of n for which a(n)
|
|
47
47
|
has not yet been computed is 45.
|
|
@@ -54,7 +54,7 @@ def A000560(n: int) -> int:
|
|
|
54
54
|
Returns
|
|
55
55
|
-------
|
|
56
56
|
a(n) : int
|
|
57
|
-
Number of ways of folding a strip of n labeled stamps.
|
|
57
|
+
Number of symmetric ways of folding a strip of n labeled stamps.
|
|
58
58
|
|
|
59
59
|
Would You Like to Know More?
|
|
60
60
|
----------------------------
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Count the number of symmetric folds in the group of folds defined by `leafBelow`.
|
|
2
|
+
|
|
3
|
+
Notes
|
|
4
|
+
-----
|
|
5
|
+
- About constructing `leafComparison`:
|
|
6
|
+
- The first iteration of the loop is hardcoded to save processing time.
|
|
7
|
+
- I _feel_ there must be a more efficient way to do this.
|
|
8
|
+
- Some implementation details are based on Numba compatibility. Incompatible:
|
|
9
|
+
- `numpy.take(..., out=...)`
|
|
10
|
+
- `numpy.all(..., axis=...)`
|
|
11
|
+
"""
|
|
12
|
+
from mapFolding.dataBaskets import SymmetricFoldsState
|
|
13
|
+
|
|
14
|
+
def filterAsymmetricFolds(state: SymmetricFoldsState) -> SymmetricFoldsState:
|
|
15
|
+
state.indexLeaf = 1
|
|
16
|
+
state.leafComparison[0] = 1
|
|
17
|
+
state.leafConnectee = 1
|
|
18
|
+
|
|
19
|
+
while state.leafConnectee < state.leavesTotal + 1:
|
|
20
|
+
state.indexMiniGap = state.leafBelow[state.indexLeaf]
|
|
21
|
+
state.leafComparison[state.leafConnectee] = (state.indexMiniGap - state.indexLeaf + state.leavesTotal) % state.leavesTotal
|
|
22
|
+
state.indexLeaf = state.indexMiniGap
|
|
23
|
+
|
|
24
|
+
state.leafConnectee += 1
|
|
25
|
+
|
|
26
|
+
for listTuples in state.indices:
|
|
27
|
+
state.leafConnectee = 1
|
|
28
|
+
for indexLeft, indexRight in listTuples:
|
|
29
|
+
if state.leafComparison[indexLeft] != state.leafComparison[indexRight]:
|
|
30
|
+
state.leafConnectee = 0
|
|
31
|
+
break
|
|
32
|
+
state.symmetricFolds += state.leafConnectee
|
|
33
|
+
|
|
34
|
+
return state
|
|
35
|
+
|
mapFolding/basecamp.py
CHANGED
|
@@ -4,37 +4,39 @@ from collections.abc import Sequence
|
|
|
4
4
|
from mapFolding import (
|
|
5
5
|
getPathFilenameFoldsTotal, packageSettings, saveFoldsTotal, saveFoldsTotalFAILearly, validateListDimensions)
|
|
6
6
|
from os import PathLike
|
|
7
|
-
from pathlib import PurePath
|
|
7
|
+
from pathlib import Path, PurePath
|
|
8
8
|
from typing import Literal
|
|
9
9
|
|
|
10
10
|
# ruff: noqa: PLC0415
|
|
11
11
|
"""TODO new flow paradigm, incomplete
|
|
12
12
|
|
|
13
|
-
I don't want to FORCE people to use the meaningless OEIS ids without providing the definition of the ID at the same time.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
- I don't want to FORCE people to use the meaningless OEIS ids without providing the definition of the ID at the same time.
|
|
14
|
+
- On the other hand, I don't have any evidence that anyone is using this package except me.
|
|
15
|
+
- algorithms directory: manually coded algorithms or formulas.
|
|
16
|
+
- 'basecamp' should be able to call any algorithm version.
|
|
17
|
+
- Quickly call the algorithm or the algorithm's dispatcher, i.e., `doTheNeedful`.
|
|
18
|
+
- `countFolds` will be a stable interface for multidimensional map folding, including synthetic modules.
|
|
19
|
+
- `NOTcountingFolds` is sufficient for now. I'll make an analogue to `countFolds` for some algorithms if it would be useful.
|
|
20
|
+
|
|
21
|
+
- state vs ? environment?
|
|
22
|
+
In multidimensional map folding, computationDivisions is part of the state because it is used in the algorithm during a module
|
|
23
|
+
operation. In contrast, CPUlimit is not used in the algorithm, so I feel like it is not part of the state. Storing the state
|
|
24
|
+
in a databasket (i.e., a dataclass) makes things much easier.
|
|
25
|
+
|
|
26
|
+
Environment settings that I sometimes need:
|
|
27
|
+
Concurrency
|
|
28
|
+
CPUlimit.
|
|
29
|
+
Package for concurrency operations.
|
|
30
|
+
Settings for that package, if it were a GPU, for example.
|
|
31
|
+
Memorialization
|
|
32
|
+
Path
|
|
33
|
+
Filename standardization
|
|
34
|
+
Record only a(n), the entire state, or something else?
|
|
35
|
+
Status updates, such as tqdm.
|
|
36
|
+
|
|
37
|
+
- Flow in basecamp
|
|
38
|
+
- Interpret parameters
|
|
39
|
+
- DEFENSIVE PROGRAMMING; FAIL EARLY
|
|
38
40
|
- Implement "common foundational logic".
|
|
39
41
|
- IDK what the correct technical term is, but I'm sure other people have researched excellent ways to do this.
|
|
40
42
|
- Example: in `countFolds`, every possible flow path needs `mapShape`. Therefore, `mapShape` is foundational logic that
|
|
@@ -42,37 +44,17 @@ General flow structure
|
|
|
42
44
|
- Example: in `countFolds`, some flow paths have more than one "task division" (i.e., the computation is divided into
|
|
43
45
|
multiple tasks), while other flow paths only have one task division. One reasonable perspective is that computing task
|
|
44
46
|
divisions is NOT "common foundational logic". My perspective for this example: to compute whether or not there are
|
|
45
|
-
task divisions
|
|
46
|
-
|
|
47
|
-
- Incomplete
|
|
48
|
-
- Initialize memorialization instructions, if asked
|
|
49
|
-
- MORE DEFENSIVE PROGRAMMING
|
|
50
|
-
- FAIL EARLIER THAN EARLY
|
|
51
|
-
- Incomplete
|
|
52
|
-
- DEFENSIVE PROGRAMMING ON BEHALF of downstream modules and functions
|
|
53
|
-
- FAIL SO EARLY IT IS BEFORE THE USER INSTALLS THE APP
|
|
54
|
-
- Incomplete
|
|
55
|
-
- REPEAT MANY OR ALL OF THE DEFENSIVE PROGRAMMING YOU HAVE ALREADY DONE
|
|
56
|
-
|
|
57
|
-
- Incomplete
|
|
47
|
+
task divisions is identical for all flow paths. Therefore, it is "common foundational logic".
|
|
48
|
+
- Initialize memorialization instructions, if asked.
|
|
58
49
|
- Pass control to the correct `doTheNeedful`
|
|
59
|
-
- I don't know how to "elegantly" pass control without putting `doTheNeedful`
|
|
50
|
+
- I don't know how to "elegantly" pass control without putting `doTheNeedful` on `count______` in the stack, therefore,
|
|
60
51
|
control will come back here.
|
|
61
|
-
- DO NOT, for the love of puppies and cookies, DO NOT use defensive programming here. Defensive
|
|
62
|
-
four-week-long computation is a tacit admission of incompetent programming.
|
|
63
|
-
- Follow memorialization instructions: which means pass control to a function will tenaciously follow the instructions.
|
|
64
|
-
- return "a(n)" (as OEIS calls it), such as foldsTotal
|
|
65
|
-
|
|
52
|
+
- DO NOT, for the love of puppies and cookies, DO NOT use defensive programming when control returns here. Defensive
|
|
53
|
+
programming AFTER a four-week-long computation is a tacit admission of incompetent programming.
|
|
54
|
+
- Follow memorialization instructions: which means pass control to a function that will tenaciously follow the instructions.
|
|
55
|
+
- return "a(n)" (as OEIS calls it), such as foldsTotal.
|
|
66
56
|
"""
|
|
67
57
|
|
|
68
|
-
# Parameters
|
|
69
|
-
# What you want to compute
|
|
70
|
-
# Memorialization
|
|
71
|
-
# Concurrency
|
|
72
|
-
# How you want to compute it
|
|
73
|
-
# Interpretation of parameters
|
|
74
|
-
# Input data
|
|
75
|
-
|
|
76
58
|
def countFolds(listDimensions: Sequence[int] | None = None
|
|
77
59
|
, pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None
|
|
78
60
|
, computationDivisions: int | str | None = None
|
|
@@ -82,7 +64,7 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
82
64
|
, flow: str | None = None
|
|
83
65
|
) -> int:
|
|
84
66
|
"""
|
|
85
|
-
Count the
|
|
67
|
+
Count the number of distinct ways to fold a map.
|
|
86
68
|
|
|
87
69
|
Mathematicians also describe this as folding a strip of stamps, and they usually call the total "number of distinct ways to
|
|
88
70
|
fold" a map the map's "foldings."
|
|
@@ -129,7 +111,8 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
129
111
|
|
|
130
112
|
Returns
|
|
131
113
|
-------
|
|
132
|
-
foldsTotal:
|
|
114
|
+
foldsTotal : int
|
|
115
|
+
Number of distinct ways to fold a map of the given dimensions.
|
|
133
116
|
|
|
134
117
|
Note well
|
|
135
118
|
---------
|
|
@@ -145,7 +128,7 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
145
128
|
computation time. If logicalCores >= `leavesTotal`, it will probably be faster. If logicalCores <= 2 * `leavesTotal`, it
|
|
146
129
|
will almost certainly be slower for all map dimensions.
|
|
147
130
|
"""
|
|
148
|
-
|
|
131
|
+
# ------- mapShape ---------------------------------------------------------------------
|
|
149
132
|
|
|
150
133
|
if mapShape:
|
|
151
134
|
pass
|
|
@@ -159,7 +142,7 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
159
142
|
)
|
|
160
143
|
raise ValueError(message)
|
|
161
144
|
|
|
162
|
-
|
|
145
|
+
# ------- task division instructions -----------------------------------------------------
|
|
163
146
|
|
|
164
147
|
if computationDivisions:
|
|
165
148
|
from mapFolding.beDRY import getLeavesTotal, getTaskDivisions, setProcessorLimit
|
|
@@ -171,59 +154,42 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
171
154
|
concurrencyLimit = 1
|
|
172
155
|
taskDivisions = 0
|
|
173
156
|
|
|
174
|
-
|
|
157
|
+
# ------- memorialization instructions ---------------------------------------------
|
|
175
158
|
|
|
176
159
|
if pathLikeWriteFoldsTotal is not None:
|
|
177
|
-
pathFilenameFoldsTotal = getPathFilenameFoldsTotal(mapShape, pathLikeWriteFoldsTotal)
|
|
160
|
+
pathFilenameFoldsTotal: Path | None = getPathFilenameFoldsTotal(mapShape, pathLikeWriteFoldsTotal)
|
|
178
161
|
saveFoldsTotalFAILearly(pathFilenameFoldsTotal)
|
|
179
162
|
else:
|
|
180
163
|
pathFilenameFoldsTotal = None
|
|
181
164
|
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
# ------- Algorithm version -----------------------------------------------------
|
|
184
166
|
if taskDivisions > 1:
|
|
185
167
|
from mapFolding.dataBaskets import ParallelMapFoldingState
|
|
186
|
-
mapFoldingParallelState: ParallelMapFoldingState = ParallelMapFoldingState(mapShape, taskDivisions=taskDivisions)
|
|
187
|
-
|
|
188
168
|
from mapFolding.syntheticModules.countParallelNumba import doTheNeedful
|
|
189
169
|
|
|
170
|
+
mapFoldingParallelState: ParallelMapFoldingState = ParallelMapFoldingState(mapShape, taskDivisions=taskDivisions)
|
|
171
|
+
|
|
190
172
|
# `listStatesParallel` exists so you can research the parallel computation.
|
|
191
|
-
foldsTotal,
|
|
173
|
+
foldsTotal, _listStatesParallel = doTheNeedful(mapFoldingParallelState, concurrencyLimit)
|
|
192
174
|
|
|
175
|
+
# ruff: noqa: E701
|
|
193
176
|
else:
|
|
194
|
-
|
|
195
|
-
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
196
|
-
|
|
197
|
-
if flow == 'daoOfMapFolding':
|
|
177
|
+
if all(dimension < 3 for dimension in mapShape):
|
|
198
178
|
from mapFolding.algorithms.daoOfMapFolding import doTheNeedful
|
|
199
|
-
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
200
|
-
|
|
201
|
-
elif flow == 'numba':
|
|
202
|
-
from mapFolding.syntheticModules.daoOfMapFoldingNumba import doTheNeedful
|
|
203
|
-
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
204
|
-
|
|
205
|
-
elif flow == 'theorem2' and any(dimension > 2 for dimension in mapShape):
|
|
206
|
-
from mapFolding.syntheticModules.theorem2 import doTheNeedful
|
|
207
|
-
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
208
|
-
|
|
209
|
-
elif (flow == 'theorem2Numba' or taskDivisions == 0) and any(dimension > 2 for dimension in mapShape):
|
|
210
|
-
from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds
|
|
211
|
-
mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
|
|
212
|
-
|
|
213
|
-
from mapFolding.syntheticModules.dataPacking import sequential
|
|
214
|
-
mapFoldingState = sequential(mapFoldingState)
|
|
215
|
-
|
|
216
|
-
elif flow == 'theorem2Trimmed' and any(dimension > 2 for dimension in mapShape):
|
|
217
|
-
from mapFolding.syntheticModules.theorem2Trimmed import doTheNeedful
|
|
218
|
-
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
219
|
-
|
|
220
179
|
else:
|
|
221
|
-
|
|
222
|
-
|
|
180
|
+
match flow:
|
|
181
|
+
case 'numba': from mapFolding.syntheticModules.daoOfMapFoldingNumba import doTheNeedful
|
|
182
|
+
case 'theorem2': from mapFolding.syntheticModules.theorem2 import doTheNeedful
|
|
183
|
+
case 'theorem2Numba': from mapFolding.syntheticModules.theorem2Numba import doTheNeedful
|
|
184
|
+
case 'theorem2Trimmed': from mapFolding.syntheticModules.theorem2Trimmed import doTheNeedful
|
|
185
|
+
case 'daoOfMapFolding' | _: from mapFolding.algorithms.daoOfMapFolding import doTheNeedful
|
|
223
186
|
|
|
187
|
+
from mapFolding.dataBaskets import MapFoldingState
|
|
188
|
+
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
189
|
+
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
224
190
|
foldsTotal = mapFoldingState.foldsTotal
|
|
225
191
|
|
|
226
|
-
|
|
192
|
+
# ------- Follow memorialization instructions ---------------------------------------------
|
|
227
193
|
|
|
228
194
|
if pathFilenameFoldsTotal is not None:
|
|
229
195
|
saveFoldsTotal(pathFilenameFoldsTotal, foldsTotal)
|
|
@@ -231,7 +197,7 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
231
197
|
return foldsTotal
|
|
232
198
|
|
|
233
199
|
def NOTcountingFolds(oeisID: str, oeis_n: int, flow: str | None = None
|
|
234
|
-
|
|
200
|
+
# TODO , pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None
|
|
235
201
|
, CPUlimit: bool | float | int | None = None # noqa: FBT001
|
|
236
202
|
) -> int:
|
|
237
203
|
"""Do stuff."""
|
|
@@ -239,46 +205,48 @@ def NOTcountingFolds(oeisID: str, oeis_n: int, flow: str | None = None
|
|
|
239
205
|
matched_oeisID: bool = True
|
|
240
206
|
|
|
241
207
|
match oeisID:
|
|
242
|
-
case '
|
|
243
|
-
|
|
244
|
-
case '
|
|
245
|
-
|
|
246
|
-
case '
|
|
247
|
-
|
|
248
|
-
case '
|
|
249
|
-
|
|
250
|
-
case '
|
|
251
|
-
|
|
252
|
-
case '
|
|
253
|
-
|
|
254
|
-
case
|
|
255
|
-
from mapFolding.algorithms.oeisIDbyFormula import A077460 as doTheNeedful
|
|
256
|
-
case 'A078591':
|
|
257
|
-
from mapFolding.algorithms.oeisIDbyFormula import A078591 as doTheNeedful
|
|
258
|
-
case 'A178961':
|
|
259
|
-
from mapFolding.algorithms.oeisIDbyFormula import A178961 as doTheNeedful
|
|
260
|
-
case 'A223094':
|
|
261
|
-
from mapFolding.algorithms.oeisIDbyFormula import A223094 as doTheNeedful
|
|
262
|
-
case 'A259702':
|
|
263
|
-
from mapFolding.algorithms.oeisIDbyFormula import A259702 as doTheNeedful
|
|
264
|
-
case 'A301620':
|
|
265
|
-
from mapFolding.algorithms.oeisIDbyFormula import A301620 as doTheNeedful
|
|
266
|
-
case _:
|
|
267
|
-
matched_oeisID = False
|
|
208
|
+
case 'A000560': from mapFolding.algorithms.oeisIDbyFormula import A000560 as doTheNeedful
|
|
209
|
+
case 'A001010': from mapFolding.algorithms.oeisIDbyFormula import A001010 as doTheNeedful
|
|
210
|
+
case 'A001011': from mapFolding.algorithms.oeisIDbyFormula import A001011 as doTheNeedful
|
|
211
|
+
case 'A005315': from mapFolding.algorithms.oeisIDbyFormula import A005315 as doTheNeedful
|
|
212
|
+
case 'A060206': from mapFolding.algorithms.oeisIDbyFormula import A060206 as doTheNeedful
|
|
213
|
+
case 'A077460': from mapFolding.algorithms.oeisIDbyFormula import A077460 as doTheNeedful
|
|
214
|
+
case 'A078591': from mapFolding.algorithms.oeisIDbyFormula import A078591 as doTheNeedful
|
|
215
|
+
case 'A086345': from mapFolding.algorithms.A086345 import A086345 as doTheNeedful
|
|
216
|
+
case 'A178961': from mapFolding.algorithms.oeisIDbyFormula import A178961 as doTheNeedful
|
|
217
|
+
case 'A223094': from mapFolding.algorithms.oeisIDbyFormula import A223094 as doTheNeedful
|
|
218
|
+
case 'A259702': from mapFolding.algorithms.oeisIDbyFormula import A259702 as doTheNeedful
|
|
219
|
+
case 'A301620': from mapFolding.algorithms.oeisIDbyFormula import A301620 as doTheNeedful
|
|
220
|
+
case _: matched_oeisID = False
|
|
268
221
|
if matched_oeisID:
|
|
269
222
|
countTotal = doTheNeedful(oeis_n) # pyright: ignore[reportPossiblyUnboundVariable]
|
|
270
223
|
else:
|
|
271
224
|
matched_oeisID = True
|
|
272
225
|
match oeisID:
|
|
226
|
+
case 'A000136':
|
|
227
|
+
from mapFolding import setProcessorLimit
|
|
228
|
+
concurrencyLimit: int = setProcessorLimit(CPUlimit)
|
|
229
|
+
match flow:
|
|
230
|
+
case 'elimination':
|
|
231
|
+
from mapFolding.algorithms.A000136elimination import doTheNeedful
|
|
232
|
+
countTotal = doTheNeedful(oeis_n)
|
|
233
|
+
case 'eliminationParallel':
|
|
234
|
+
from mapFolding.algorithms.A000136eliminationParallel import doTheNeedful
|
|
235
|
+
countTotal = doTheNeedful(oeis_n, concurrencyLimit)
|
|
236
|
+
case 'constraintPropagation':
|
|
237
|
+
from mapFolding.algorithms.A000136constraintPropagation import doTheNeedful
|
|
238
|
+
countTotal = doTheNeedful(oeis_n, concurrencyLimit)
|
|
239
|
+
case _:
|
|
240
|
+
from mapFolding.algorithms.oeisIDbyFormula import A000136 as doTheNeedful
|
|
241
|
+
countTotal = doTheNeedful(oeis_n)
|
|
273
242
|
case 'A000682' | 'A005316':
|
|
274
243
|
match flow:
|
|
275
244
|
case 'matrixNumPy':
|
|
276
|
-
from mapFolding.algorithms.
|
|
277
|
-
from mapFolding.dataBaskets import MatrixMeandersNumPyState as State
|
|
245
|
+
from mapFolding.algorithms.matrixMeandersNumPyndas import doTheNeedful, MatrixMeandersNumPyState as State
|
|
278
246
|
case 'matrixPandas':
|
|
279
|
-
from mapFolding.algorithms.
|
|
280
|
-
|
|
281
|
-
case _:
|
|
247
|
+
from mapFolding.algorithms.matrixMeandersNumPyndas import (
|
|
248
|
+
doTheNeedfulPandas as doTheNeedful, MatrixMeandersNumPyState as State)
|
|
249
|
+
case 'matrixMeanders' | _:
|
|
282
250
|
from mapFolding.algorithms.matrixMeanders import doTheNeedful
|
|
283
251
|
from mapFolding.dataBaskets import MatrixMeandersState as State
|
|
284
252
|
|
|
@@ -319,49 +287,28 @@ def NOTcountingFolds(oeisID: str, oeis_n: int, flow: str | None = None
|
|
|
319
287
|
from mapFolding import setProcessorLimit
|
|
320
288
|
concurrencyLimit: int = setProcessorLimit(CPUlimit)
|
|
321
289
|
|
|
322
|
-
from mapFolding.dataBaskets import
|
|
323
|
-
|
|
290
|
+
from mapFolding.dataBaskets import SymmetricFoldsState
|
|
291
|
+
symmetricState: SymmetricFoldsState = SymmetricFoldsState(mapShape)
|
|
324
292
|
|
|
325
293
|
match flow:
|
|
326
294
|
case 'asynchronous':
|
|
327
295
|
from mapFolding.syntheticModules.A007822.asynchronous import doTheNeedful
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
case 'asynchronousNumba':
|
|
331
|
-
from mapFolding.syntheticModules.A007822.asynchronousNumba import doTheNeedful
|
|
332
|
-
mapFoldingState = doTheNeedful(mapFoldingState, concurrencyLimit)
|
|
333
|
-
|
|
334
|
-
case 'asynchronousTheorem2':
|
|
335
|
-
from mapFolding.syntheticModules.A007822.asynchronousTheorem2 import doTheNeedful
|
|
336
|
-
mapFoldingState = doTheNeedful(mapFoldingState, concurrencyLimit)
|
|
337
|
-
|
|
338
|
-
case 'asynchronousTrimmed':
|
|
339
|
-
from mapFolding.syntheticModules.A007822.asynchronousTrimmed import doTheNeedful
|
|
340
|
-
mapFoldingState = doTheNeedful(mapFoldingState, concurrencyLimit)
|
|
341
|
-
|
|
342
|
-
case 'numba':
|
|
343
|
-
from mapFolding.syntheticModules.A007822.algorithmNumba import doTheNeedful
|
|
344
|
-
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
345
|
-
|
|
296
|
+
symmetricState = doTheNeedful(symmetricState, concurrencyLimit)
|
|
346
297
|
case 'theorem2':
|
|
347
298
|
from mapFolding.syntheticModules.A007822.theorem2 import doTheNeedful
|
|
348
|
-
|
|
349
|
-
|
|
299
|
+
symmetricState = doTheNeedful(symmetricState)
|
|
350
300
|
case 'theorem2Numba':
|
|
351
301
|
from mapFolding.syntheticModules.A007822.theorem2Numba import doTheNeedful
|
|
352
|
-
|
|
353
|
-
|
|
302
|
+
symmetricState = doTheNeedful(symmetricState)
|
|
354
303
|
case 'theorem2Trimmed':
|
|
355
304
|
from mapFolding.syntheticModules.A007822.theorem2Trimmed import doTheNeedful
|
|
356
|
-
|
|
357
|
-
|
|
305
|
+
symmetricState = doTheNeedful(symmetricState)
|
|
358
306
|
case _:
|
|
359
307
|
from mapFolding.syntheticModules.A007822.algorithm import doTheNeedful
|
|
360
|
-
|
|
308
|
+
symmetricState = doTheNeedful(symmetricState)
|
|
361
309
|
|
|
362
|
-
countTotal =
|
|
310
|
+
countTotal = symmetricState.symmetricFolds
|
|
363
311
|
case _:
|
|
364
312
|
matched_oeisID = False
|
|
365
313
|
|
|
366
314
|
return countTotal
|
|
367
|
-
|