mapFolding 0.16.1__tar.gz → 0.16.4__tar.gz
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-0.16.1/mapFolding.egg-info → mapfolding-0.16.4}/PKG-INFO +4 -1
- {mapfolding-0.16.1 → mapfolding-0.16.4}/easyRun/A000682.py +1 -1
- {mapfolding-0.16.1 → mapfolding-0.16.4}/easyRun/A005316.py +2 -3
- {mapfolding-0.16.1 → mapfolding-0.16.4}/easyRun/NOTcountingFolds.py +6 -5
- {mapfolding-0.16.1 → mapfolding-0.16.4}/easyRun/countFolds.py +1 -1
- mapfolding-0.16.4/easyRun/generateAllModules.py +14 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/easyRun/meanders.py +16 -18
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/__init__.py +1 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/_theSSOT.py +3 -2
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/_theTypes.py +3 -0
- mapfolding-0.16.4/mapFolding/algorithms/A086345.py +75 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/matrixMeanders.py +15 -28
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/matrixMeandersBeDry.py +34 -116
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/matrixMeandersNumPy.py +117 -70
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/matrixMeandersPandas.py +113 -130
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/oeisIDbyFormula.py +25 -14
- mapfolding-0.16.4/mapFolding/algorithms/symmetricFolds.py +36 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +26 -12
- mapfolding-0.16.4/mapFolding/basecamp.py +298 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/dataBaskets.py +136 -34
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/filesystemToolkit.py +4 -32
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/oeis.py +5 -12
- mapfolding-0.16.4/mapFolding/reference/A000682facts.py +797 -0
- mapfolding-0.16.4/mapFolding/reference/A005316facts.py +1020 -0
- mapfolding-0.16.4/mapFolding/reference/A086345Wu.py +25 -0
- mapfolding-0.16.4/mapFolding/reference/matrixMeandersAnalysis/signatures.py +2033 -0
- mapfolding-0.16.4/mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +19 -0
- mapfolding-0.16.4/mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py +51 -0
- mapfolding-0.16.4/mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +100 -0
- mapfolding-0.16.4/mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +73 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/RecipeJob.py +78 -18
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/__init__.py +3 -8
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/_toolkitContainers.py +32 -3
- mapfolding-0.16.4/mapFolding/someAssemblyRequired/infoBooth.py +66 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +75 -154
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +56 -88
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/makingModules_count.py +91 -85
- mapfolding-0.16.4/mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +59 -0
- {mapfolding-0.16.1/mapFolding/someAssemblyRequired/mapFolding → mapfolding-0.16.4/mapFolding/someAssemblyRequired/mapFoldingModules}/makeMapFoldingModules.py +25 -31
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +14 -13
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/toolkitMakeModules.py +10 -10
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/transformationTools.py +17 -19
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/A007822/algorithm.py +46 -50
- mapfolding-0.16.4/mapFolding/syntheticModules/A007822/asynchronous.py +207 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/A007822/initializeState.py +15 -21
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousTheorem2.py → mapfolding-0.16.4/mapFolding/syntheticModules/A007822/theorem2.py +21 -5
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/algorithmNumba.py → mapfolding-0.16.4/mapFolding/syntheticModules/A007822/theorem2Numba.py +33 -40
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousTrimmed.py → mapfolding-0.16.4/mapFolding/syntheticModules/A007822/theorem2Trimmed.py +21 -5
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/countParallelNumba.py +3 -7
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/daoOfMapFoldingNumba.py +3 -6
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/meanders/bigInt.py +15 -25
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/theorem2.py +6 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/theorem2Numba.py +26 -2
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/theorem2Trimmed.py +6 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/test_computations.py +1 -1
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/zCuzDocStoopid/makeDocstrings.py +2 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4/mapFolding.egg-info}/PKG-INFO +4 -1
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding.egg-info/SOURCES.txt +8 -16
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding.egg-info/requires.txt +3 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/pyproject.toml +6 -2
- mapfolding-0.16.1/mapFolding/_dataPacking.py +0 -68
- mapfolding-0.16.1/mapFolding/basecamp.py +0 -469
- mapfolding-0.16.1/mapFolding/reference/A000682facts.py +0 -1276
- mapfolding-0.16.1/mapFolding/reference/A005316facts.py +0 -985
- mapfolding-0.16.1/mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -122
- mapfolding-0.16.1/mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -79
- mapfolding-0.16.1/mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -65
- mapfolding-0.16.1/mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -84
- mapfolding-0.16.1/mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -90
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +0 -54
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +0 -197
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +0 -74
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/infoBooth.py +0 -49
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +0 -117
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronous.py +0 -148
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousAnnex.py +0 -66
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +0 -85
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousNumba.py +0 -52
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/theorem2.py +0 -69
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/theorem2Numba.py +0 -68
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/theorem2Trimmed.py +0 -63
- mapfolding-0.16.1/mapFolding/syntheticModules/dataPacking.py +0 -28
- mapfolding-0.16.1/mapFolding/syntheticModules/dataPackingA007822.py +0 -92
- {mapfolding-0.16.1 → mapfolding-0.16.4}/LICENSE +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/README.md +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/easyRun/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/algorithms/daoOfMapFolding.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/beDRY.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/py.typed +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/flattened.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/hunterNumba.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/irvineJavaPort.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/jaxCount.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/jobsCompleted/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/jobsCompleted/p2x19/p2x19.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/lunnonNumpy.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/lunnonWhile.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/matrixMeandersAnalysis/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/matrixMeandersAnalysis/prefixNotationNotes.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/A005316JavaPort.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/A005316imperative.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/A005316primitiveOptimized.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/A005316redis.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/A005316write2disk.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/matrixMeanders64retired.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineV2.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/matrixMeandersNumPyV1finalForm.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/meandersDumpingGround/matrixMeandersSlicePop.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/rotatedEntryPoint.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/A007822/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/_toolIfThis.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
- {mapfolding-0.16.1/mapFolding/someAssemblyRequired/mapFolding → mapfolding-0.16.4/mapFolding/someAssemblyRequired/mapFoldingModules}/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/someAssemblyRequired/meanders/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/A007822/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/initializeState.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/syntheticModules/meanders/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/conftest.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/test_filesystem.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/test_oeis.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/test_other.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/tests/test_tasks.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding/zCuzDocStoopid/__init__.py +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding.egg-info/dependency_links.txt +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding.egg-info/entry_points.txt +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/mapFolding.egg-info/top_level.txt +0 -0
- {mapfolding-0.16.1 → mapfolding-0.16.4}/setup.cfg +0 -0
|
@@ -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"
|
|
@@ -21,5 +21,5 @@ if __name__ == "__main__":
|
|
|
21
21
|
|
|
22
22
|
r"""
|
|
23
23
|
deactivate && C:\apps\mapFolding\.vtail\Scripts\activate.bat && title good && cls
|
|
24
|
-
title running && py
|
|
24
|
+
title running && start "running" /B /HIGH /wait py -X faulthandler=0 -X tracemalloc=0 -X frozen_modules=on easyRun\A000682.py && title I'm done || title Error
|
|
25
25
|
"""
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# ruff: noqa
|
|
2
2
|
# pyright: basic
|
|
3
|
-
from mapFolding.basecamp import
|
|
3
|
+
from mapFolding.basecamp import NOTcountingFolds
|
|
4
4
|
import warnings
|
|
5
5
|
|
|
6
6
|
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
7
7
|
|
|
8
8
|
n=25
|
|
9
|
-
print(A005316
|
|
9
|
+
print(NOTcountingFolds('A005316', n))
|
|
10
10
|
|
|
11
11
|
from mapFolding import dictionaryOEIS
|
|
12
12
|
|
|
@@ -16,6 +16,5 @@ if n < dictionaryOEIS['A005316']['valueUnknown']:
|
|
|
16
16
|
|
|
17
17
|
r"""
|
|
18
18
|
deactivate && C:\apps\mapFolding\.vtail\Scripts\activate.bat && title good && cls
|
|
19
|
-
title running && py Z0Z_A005316.py && title I'm done || title Error
|
|
20
19
|
|
|
21
20
|
"""
|
|
@@ -15,20 +15,21 @@ if __name__ == '__main__':
|
|
|
15
15
|
"\033[0m\n"
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
CPUlimit: bool | float | int | None =
|
|
18
|
+
CPUlimit: bool | float | int | None = 3
|
|
19
19
|
# oeisID: str | None = None
|
|
20
20
|
oeis_n: int | None = None
|
|
21
21
|
flow: str | None = None
|
|
22
22
|
|
|
23
|
+
oeisID = 'A001010'
|
|
23
24
|
oeisID = 'A007822'
|
|
24
25
|
|
|
25
|
-
flow = 'asynchronousTrimmed'
|
|
26
|
-
flow = 'asynchronous'
|
|
27
|
-
flow = 'asynchronousNumba'
|
|
28
26
|
flow = 'algorithm'
|
|
27
|
+
flow = 'asynchronous'
|
|
29
28
|
flow = 'theorem2Numba'
|
|
29
|
+
flow = 'theorem2Trimmed'
|
|
30
30
|
|
|
31
|
-
for n in range(
|
|
31
|
+
# for n in range(7,10):
|
|
32
|
+
for n in range(3,8):
|
|
32
33
|
|
|
33
34
|
timeStart = time.perf_counter()
|
|
34
35
|
countTotal = NOTcountingFolds(oeisID, n, flow, CPUlimit)
|
|
@@ -25,7 +25,7 @@ if __name__ == '__main__':
|
|
|
25
25
|
# mapShape: tuple[int, ...] | None = None
|
|
26
26
|
flow: str | None = 'theorem2Numba'
|
|
27
27
|
|
|
28
|
-
oeisID: str = '
|
|
28
|
+
oeisID: str = 'A001416'
|
|
29
29
|
for n in range(3,8):
|
|
30
30
|
|
|
31
31
|
mapShape: tuple[int, ...] = dictionaryOEISMapFolding[oeisID]['getMapShape'](n)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Generate all modules that require some assembly."""
|
|
2
|
+
from mapFolding.someAssemblyRequired.A007822.makeA007822AsynchronousModules import makeA007822AsynchronousModules
|
|
3
|
+
from mapFolding.someAssemblyRequired.A007822.makeA007822Modules import makeA007822Modules
|
|
4
|
+
from mapFolding.someAssemblyRequired.mapFoldingModules.makeMapFoldingModules import makeMapFoldingModules
|
|
5
|
+
from mapFolding.someAssemblyRequired.meanders.makeMeandersModules import makeMeandersModules
|
|
6
|
+
|
|
7
|
+
# TODO from mapFolding.zCuzDocStoopid import makeDocstrings
|
|
8
|
+
|
|
9
|
+
makeMapFoldingModules()
|
|
10
|
+
|
|
11
|
+
makeA007822Modules()
|
|
12
|
+
makeA007822AsynchronousModules()
|
|
13
|
+
|
|
14
|
+
makeMeandersModules()
|
|
@@ -24,8 +24,8 @@ if __name__ == '__main__':
|
|
|
24
24
|
if sys.version_info >= (3, 14):
|
|
25
25
|
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
26
26
|
|
|
27
|
-
flow = 'matrixPandas'
|
|
28
27
|
flow = 'matrixMeanders'
|
|
28
|
+
flow = 'matrixPandas'
|
|
29
29
|
flow = 'matrixNumPy'
|
|
30
30
|
|
|
31
31
|
for oeisID in [
|
|
@@ -35,27 +35,25 @@ if __name__ == '__main__':
|
|
|
35
35
|
sys.stdout.write(f"\n{oeisID}\n")
|
|
36
36
|
|
|
37
37
|
"""TODO Identifiers. improve
|
|
38
|
-
|
|
38
|
+
"generate up to four targets."
|
|
39
|
+
1. Adding a new loop.
|
|
40
|
+
2. Dragging up a loop end.
|
|
41
|
+
3. Dragging down a loop end.
|
|
42
|
+
4. Connect ends across the line.
|
|
39
43
|
|
|
40
|
-
ReidemeisterMove?
|
|
41
44
|
flipTheExtra_0b1AsUfunc: what is extra?
|
|
42
|
-
|
|
43
|
-
"strand" is an interesting word.
|
|
44
45
|
"""
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
# for n in range(28,33):
|
|
55
|
-
# for n in range(2, 28):
|
|
56
|
-
# for n in range(2, 10):
|
|
57
|
-
for n in range(1, 6):
|
|
47
|
+
nList: list[int] = []
|
|
48
|
+
nList.extend(range(2, 10))
|
|
49
|
+
# nList.extend(range(2, 28))
|
|
50
|
+
nList.extend(range(28,33))
|
|
51
|
+
# nList.extend(range(33,38))
|
|
52
|
+
# nList.extend(range(38,43))
|
|
53
|
+
# nList.extend(range(43,45))
|
|
54
|
+
# nList.extend(range(47,57))
|
|
58
55
|
|
|
56
|
+
for n in nList:
|
|
59
57
|
gc.collect()
|
|
60
58
|
timeStart = time.perf_counter()
|
|
61
59
|
countTotal = NOTcountingFolds(oeisID, n, flow)
|
|
@@ -66,6 +64,6 @@ if __name__ == '__main__':
|
|
|
66
64
|
|
|
67
65
|
r"""
|
|
68
66
|
deactivate && C:\apps\mapFolding\.vtail\Scripts\activate.bat && title good && cls
|
|
69
|
-
title running && py
|
|
67
|
+
title running && start "meanders" /B /HIGH /wait py -X faulthandler=0 -X tracemalloc=0 -X frozen_modules=on easyRun\meanders.py && title I'm done || title Error
|
|
70
68
|
|
|
71
69
|
"""
|
|
@@ -4,6 +4,7 @@ from mapFolding._theTypes import (
|
|
|
4
4
|
Array1DElephino as Array1DElephino,
|
|
5
5
|
Array1DFoldsTotal as Array1DFoldsTotal,
|
|
6
6
|
Array1DLeavesTotal as Array1DLeavesTotal,
|
|
7
|
+
Array2DLeavesTotal as Array2DLeavesTotal,
|
|
7
8
|
Array3DLeavesTotal as Array3DLeavesTotal,
|
|
8
9
|
axisOfLength as axisOfLength,
|
|
9
10
|
DatatypeElephino as DatatypeElephino,
|
|
@@ -43,7 +43,7 @@ class mapFoldingPackageSettings(PackageSettings):
|
|
|
43
43
|
concurrencyPackage: str = 'multiprocessing'
|
|
44
44
|
"""Package identifier for concurrent execution operations."""
|
|
45
45
|
# ruff: noqa: S311
|
|
46
|
-
# TODO I made a `TypedDict` before I knew how to make dataclasses and classes. Think about other data structures.
|
|
46
|
+
# TODO I made this a `TypedDict` before I knew how to make dataclasses and classes. Think about other data structures.
|
|
47
47
|
OEISidMapFoldingManuallySet: dict[str, MetadataOEISidMapFoldingManuallySet] = {
|
|
48
48
|
'A000136': {
|
|
49
49
|
'getMapShape': lambda n: (1, n),
|
|
@@ -89,7 +89,6 @@ identifierPackageFALLBACK = "mapFolding"
|
|
|
89
89
|
packageSettings = mapFoldingPackageSettings(identifierPackageFALLBACK=identifierPackageFALLBACK, OEISidMapFoldingManuallySet=OEISidMapFoldingManuallySet)
|
|
90
90
|
"""Global package settings."""
|
|
91
91
|
|
|
92
|
-
"""Local directory path for storing cached OEIS sequence data and metadata."""
|
|
93
92
|
OEISidManuallySet: dict[str, MetadataOEISidManuallySet] = {
|
|
94
93
|
'A000560': {'valuesTestValidation': [random.randint(3, 12)]},
|
|
95
94
|
'A000682': {'valuesTestValidation': [random.randint(3, 12), 32]},
|
|
@@ -101,6 +100,7 @@ OEISidManuallySet: dict[str, MetadataOEISidManuallySet] = {
|
|
|
101
100
|
'A060206': {'valuesTestValidation': [random.randint(3, 9)]},
|
|
102
101
|
'A077460': {'valuesTestValidation': [3, 4, random.randint(5, 8)]},
|
|
103
102
|
'A078591': {'valuesTestValidation': [random.randint(3, 10)]},
|
|
103
|
+
'A086345': {'valuesTestValidation': [random.randint(3, 10), random.randint(11, 20), random.randint(21, 30), random.randint(31, 40)]},
|
|
104
104
|
'A178961': {'valuesTestValidation': [random.randint(3, 11)]},
|
|
105
105
|
'A223094': {'valuesTestValidation': [random.randint(3, 11)]},
|
|
106
106
|
'A259702': {'valuesTestValidation': [random.randint(3, 13)]},
|
|
@@ -117,3 +117,4 @@ packageSettings = mapFoldingPackageSettings(
|
|
|
117
117
|
|
|
118
118
|
# TODO integrate into packageSettings
|
|
119
119
|
pathCache: Path = packageSettings.pathPackage / ".cache"
|
|
120
|
+
"""Local directory path for storing cached OEIS sequence data and metadata."""
|
|
@@ -44,6 +44,9 @@ different data structure."""
|
|
|
44
44
|
Array3DLeavesTotal: TypeAlias = ndarray[tuple[int, int, int], dtype[NumPyLeavesTotal]] # noqa: UP040 The TypeAlias may be used to construct ("cast") a value to the type. And the identifier may be changed to a different type.
|
|
45
45
|
"""A `numpy.ndarray` with three axes and elements of type `NumPyLeavesTotal`."""
|
|
46
46
|
|
|
47
|
+
Array2DLeavesTotal: TypeAlias = ndarray[tuple[int, int], dtype[NumPyLeavesTotal]] # noqa: UP040 The TypeAlias may be used to construct ("cast") a value to the type. And the identifier may be changed to a different type.
|
|
48
|
+
"""A `numpy.ndarray` with two axes and elements of type `NumPyLeavesTotal`."""
|
|
49
|
+
|
|
47
50
|
Array1DLeavesTotal: TypeAlias = ndarray[tuple[int], dtype[NumPyLeavesTotal]] # noqa: UP040 The TypeAlias may be used to construct ("cast") a value to the type. And the identifier may be changed to a different type.
|
|
48
51
|
"""A `numpy.ndarray` with one axis and elements of type `NumPyLeavesTotal`."""
|
|
49
52
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Directly based on code Chai Wah Wu, https://oeis.org/wiki/User:Chai_Wah_Wu, posted on OEIS."""
|
|
2
|
+
from fractions import Fraction
|
|
3
|
+
from functools import cache
|
|
4
|
+
from itertools import combinations
|
|
5
|
+
from math import factorial, gcd
|
|
6
|
+
from sympy import divisors
|
|
7
|
+
from sympy.functions.combinatorial.numbers import mobius
|
|
8
|
+
from sympy.utilities.iterables import partitions
|
|
9
|
+
|
|
10
|
+
@cache
|
|
11
|
+
def _GoCountryDancing(romeo: int, copiesRomeo: int, sierra: int, copiesSierra: int) -> int:
|
|
12
|
+
return copiesRomeo * copiesSierra * gcd(romeo, sierra)
|
|
13
|
+
|
|
14
|
+
@cache
|
|
15
|
+
def _goRight(integer: int, copies: int) -> int:
|
|
16
|
+
return ((integer - 1) >> 1) * copies + (integer * copies * (copies - 1) >> 1)
|
|
17
|
+
|
|
18
|
+
@cache
|
|
19
|
+
def _deFactorial(integer: int, copies: int) -> int:
|
|
20
|
+
return integer ** copies * factorial(copies)
|
|
21
|
+
|
|
22
|
+
@cache
|
|
23
|
+
def _blender(n: int) -> int:
|
|
24
|
+
sumReBletionary: int = 0
|
|
25
|
+
for partitionary in partitions(n):
|
|
26
|
+
numbinations: int = 0
|
|
27
|
+
nummaNumma: int = 0
|
|
28
|
+
denominator: int = 1
|
|
29
|
+
for (romeo, copiesRomeo), (sierra, copiesSierra) in combinations(partitionary.items(), 2):
|
|
30
|
+
numbinations += _GoCountryDancing(romeo, copiesRomeo, sierra, copiesSierra)
|
|
31
|
+
for integer, copies in partitionary.items():
|
|
32
|
+
nummaNumma += _goRight(integer, copies)
|
|
33
|
+
denominator *= _deFactorial(integer, copies)
|
|
34
|
+
numerator: int = 3 ** (numbinations + nummaNumma)
|
|
35
|
+
sumReBletionary += Fraction(numerator, denominator)
|
|
36
|
+
return sumReBletionary
|
|
37
|
+
|
|
38
|
+
@cache
|
|
39
|
+
def _recurser(n: int) -> int:
|
|
40
|
+
sumReBlender: int = 0
|
|
41
|
+
for k in range(1, n):
|
|
42
|
+
sumReBlender += _recurser(k) * _blender(n - k)
|
|
43
|
+
return n * _blender(n) - sumReBlender
|
|
44
|
+
|
|
45
|
+
def A086345(n: int) -> int:
|
|
46
|
+
"""Compute 'Number of connected oriented graphs (i.e., connected directed graphs with no bidirected edges) on n nodes'.
|
|
47
|
+
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
n : int
|
|
51
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
-------
|
|
55
|
+
a(n) : int
|
|
56
|
+
Number of connected oriented graphs (i.e., connected directed graphs with no bidirected edges) on n nodes.
|
|
57
|
+
|
|
58
|
+
Notes
|
|
59
|
+
-----
|
|
60
|
+
- The largest performance gains are from caching the recursion and `sympy.utilities.iterables.partitions` functions.
|
|
61
|
+
- Interestingly, there is a small but noticeable penalty for choosing comprehension instead of `for`.
|
|
62
|
+
|
|
63
|
+
Would You Like to Know More?
|
|
64
|
+
----------------------------
|
|
65
|
+
OEIS : webpage
|
|
66
|
+
https://oeis.org/A086345
|
|
67
|
+
"""
|
|
68
|
+
if n == 0:
|
|
69
|
+
aOFn: int = 1
|
|
70
|
+
else:
|
|
71
|
+
aOFn: int = 0
|
|
72
|
+
for aDivisor in divisors(n, generator=True):
|
|
73
|
+
aOFn += mobius(aDivisor) * _recurser(n//aDivisor)
|
|
74
|
+
aOFn //= n
|
|
75
|
+
return aOFn
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
from mapFolding.algorithms.matrixMeandersBeDry import walkDyckPath
|
|
2
2
|
from mapFolding.dataBaskets import MatrixMeandersState
|
|
3
3
|
|
|
4
|
-
def outfitDictionaryBitGroups(state: MatrixMeandersState) -> 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
|
|
19
|
-
for arcCode, crossings in state.dictionaryMeanders.items()}
|
|
20
|
-
|
|
21
4
|
def count(state: MatrixMeandersState) -> MatrixMeandersState:
|
|
22
5
|
"""Count meanders with matrix transfer algorithm using Python `int` (*int*eger) contained in a Python `dict` (*dict*ionary).
|
|
23
6
|
|
|
@@ -31,18 +14,22 @@ def count(state: MatrixMeandersState) -> MatrixMeandersState:
|
|
|
31
14
|
The matrix transfer algorithm is sophisticated, but this implementation is straightforward: compute each index one at a time,
|
|
32
15
|
compute each `arcCode` one at a time, and compute each type of analysis one at a time.
|
|
33
16
|
"""
|
|
34
|
-
|
|
17
|
+
dictionaryArcCodeToCrossings: dict[int, int] = {}
|
|
35
18
|
|
|
36
|
-
while state.
|
|
37
|
-
state.
|
|
19
|
+
while state.boundary > 0:
|
|
20
|
+
state.boundary -= 1
|
|
21
|
+
state.bitWidth = max(state.dictionaryMeanders.keys()).bit_length()
|
|
38
22
|
|
|
39
|
-
|
|
23
|
+
dictionaryArcCodeToCrossings = state.dictionaryMeanders.copy()
|
|
40
24
|
state.dictionaryMeanders = {}
|
|
41
25
|
|
|
42
|
-
for
|
|
26
|
+
for arcCode, crossings in dictionaryArcCodeToCrossings.items():
|
|
27
|
+
bitsAlpha: int = arcCode & state.locatorBits
|
|
28
|
+
bitsZulu: int = (arcCode >> 1) & state.locatorBits
|
|
43
29
|
bitsAlphaHasArcs: bool = bitsAlpha > 1
|
|
44
30
|
bitsZuluHasArcs: bool = bitsZulu > 1
|
|
45
|
-
bitsAlphaIsEven =
|
|
31
|
+
bitsAlphaIsEven: int = bitsAlpha & 1 ^ 1
|
|
32
|
+
bitsZuluIsEven: int = bitsZulu & 1 ^ 1
|
|
46
33
|
|
|
47
34
|
arcCodeAnalysis = ((bitsAlpha | (bitsZulu << 1)) << 2) | 3
|
|
48
35
|
# simple
|
|
@@ -50,27 +37,27 @@ def count(state: MatrixMeandersState) -> MatrixMeandersState:
|
|
|
50
37
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
51
38
|
|
|
52
39
|
if bitsAlphaHasArcs:
|
|
53
|
-
arcCodeAnalysis = (bitsAlpha >> 2) | (bitsZulu << 3) | (
|
|
40
|
+
arcCodeAnalysis = (bitsAlpha >> 2) | (bitsZulu << 3) | (bitsAlphaIsEven << 1)
|
|
54
41
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
55
42
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
56
43
|
|
|
57
44
|
if bitsZuluHasArcs:
|
|
58
|
-
arcCodeAnalysis = (bitsZulu >> 1) | (bitsAlpha << 2) |
|
|
45
|
+
arcCodeAnalysis = (bitsZulu >> 1) | (bitsAlpha << 2) | bitsZuluIsEven
|
|
59
46
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
60
47
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
61
48
|
|
|
62
49
|
if bitsAlphaHasArcs and bitsZuluHasArcs and (bitsAlphaIsEven or bitsZuluIsEven):
|
|
63
50
|
# aligned
|
|
64
51
|
if bitsAlphaIsEven and not bitsZuluIsEven:
|
|
65
|
-
bitsAlpha ^= walkDyckPath(bitsAlpha)
|
|
52
|
+
bitsAlpha ^= walkDyckPath(bitsAlpha)
|
|
66
53
|
elif bitsZuluIsEven and not bitsAlphaIsEven:
|
|
67
|
-
bitsZulu ^= walkDyckPath(bitsZulu)
|
|
54
|
+
bitsZulu ^= walkDyckPath(bitsZulu)
|
|
68
55
|
|
|
69
56
|
arcCodeAnalysis: int = ((bitsZulu >> 2) << 1) | (bitsAlpha >> 2)
|
|
70
57
|
if arcCodeAnalysis < state.MAXIMUMarcCode:
|
|
71
58
|
state.dictionaryMeanders[arcCodeAnalysis] = state.dictionaryMeanders.get(arcCodeAnalysis, 0) + crossings
|
|
72
59
|
|
|
73
|
-
|
|
60
|
+
dictionaryArcCodeToCrossings = {}
|
|
74
61
|
|
|
75
62
|
return state
|
|
76
63
|
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
from functools import cache
|
|
3
3
|
from hunterMakesPy import raiseIfNone
|
|
4
4
|
from mapFolding.dataBaskets import MatrixMeandersNumPyState
|
|
5
|
-
from mapFolding.reference.A000682facts import
|
|
6
|
-
from mapFolding.reference.A005316facts import
|
|
7
|
-
A005316_n_k_buckets, bucketsIf_k_EVEN_by_nLess_k, bucketsIf_k_ODD_by_nLess_k)
|
|
8
|
-
from math import exp, log
|
|
9
|
-
from typing import Any, NamedTuple
|
|
10
|
-
import math
|
|
5
|
+
from mapFolding.reference.A000682facts import A000682_n_boundary_buckets
|
|
6
|
+
from mapFolding.reference.A005316facts import A005316_n_boundary_buckets
|
|
11
7
|
import numpy
|
|
12
8
|
import pandas
|
|
13
9
|
|
|
@@ -22,14 +18,7 @@ import pandas
|
|
|
22
18
|
- Convert duplicate code to procedures.
|
|
23
19
|
"""
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
"""keys for dictionaries."""
|
|
27
|
-
|
|
28
|
-
oeisID: str
|
|
29
|
-
kIsOdd: bool
|
|
30
|
-
nLess_kIsOdd: bool
|
|
31
|
-
|
|
32
|
-
def areIntegersWide(state: MatrixMeandersNumPyState, *, dataframe: pandas.DataFrame | None = None, array: numpy.ndarray[tuple[int, ...], numpy.dtype[numpy.integer[Any]]] | None = None, fixedSizeMAXIMUMarcCode: bool = False) -> bool:
|
|
21
|
+
def areIntegersWide(state: MatrixMeandersNumPyState, *, dataframe: pandas.DataFrame | None = None, fixedSizeMAXIMUMarcCode: bool = False) -> bool:
|
|
33
22
|
"""Check if the largest values are wider than the maximum limits.
|
|
34
23
|
|
|
35
24
|
Parameters
|
|
@@ -58,19 +47,16 @@ def areIntegersWide(state: MatrixMeandersNumPyState, *, dataframe: pandas.DataFr
|
|
|
58
47
|
|
|
59
48
|
If you start with small values in `dictionaryMeanders`, however, then the flow goes to the function with fixed size
|
|
60
49
|
integers and usually stays there until `crossings` is huge, which is near the end of the computation. If you cast
|
|
61
|
-
`MAXIMUMarcCode` into a 64-bit unsigned integer, however, then around `state.
|
|
50
|
+
`MAXIMUMarcCode` into a 64-bit unsigned integer, however, then around `state.boundary == 28`, the bit width of
|
|
62
51
|
`MAXIMUMarcCode` might exceed the limit. That will cause the flow to go to the function that does not have fixed size
|
|
63
52
|
integers for a few iterations before returning to the function with fixed size integers.
|
|
64
53
|
"""
|
|
65
54
|
if dataframe is not None:
|
|
66
55
|
arcCodeWidest = int(dataframe['analyzed'].max()).bit_length()
|
|
67
56
|
crossingsWidest = int(dataframe['crossings'].max()).bit_length()
|
|
68
|
-
elif array is not None:
|
|
69
|
-
arcCodeWidest = int(array[state.slicerArcCode].max()).bit_length()
|
|
70
|
-
crossingsWidest = int(array[state.slicerCrossings].max()).bit_length()
|
|
71
57
|
elif not state.dictionaryMeanders:
|
|
72
|
-
arcCodeWidest = int(state.
|
|
73
|
-
crossingsWidest = int(state.
|
|
58
|
+
arcCodeWidest = int(state.arrayArcCodes.max()).bit_length()
|
|
59
|
+
crossingsWidest = int(state.arrayCrossings.max()).bit_length()
|
|
74
60
|
else:
|
|
75
61
|
arcCodeWidest: int = max(state.dictionaryMeanders.keys()).bit_length()
|
|
76
62
|
crossingsWidest: int = max(state.dictionaryMeanders.values()).bit_length()
|
|
@@ -106,8 +92,14 @@ arrayFlipped : numpy.ndarray[tuple[int], numpy.dtype[numpy.unsignedinteger[Any]]
|
|
|
106
92
|
An array with the same shape as `arrayTarget` but with one bit flipped in each element.
|
|
107
93
|
"""
|
|
108
94
|
|
|
109
|
-
def getBucketsTotal(state: MatrixMeandersNumPyState, safetyMultiplicand: float = 1.2) -> int:
|
|
110
|
-
"""Estimate the total number of non-unique arcCode that will be computed from the existing arcCode.
|
|
95
|
+
def getBucketsTotal(state: MatrixMeandersNumPyState, safetyMultiplicand: float = 1.2) -> int: # noqa: ARG001
|
|
96
|
+
"""Under renovation: Estimate the total number of non-unique arcCode that will be computed from the existing arcCode.
|
|
97
|
+
|
|
98
|
+
Warning
|
|
99
|
+
-------
|
|
100
|
+
Because `matrixMeandersPandas` does not store anything in `state.arrayArcCodes`, if `matrixMeandersPandas` requests
|
|
101
|
+
bucketsTotal for a value not in the dictionary, the returned value will be 0. But `matrixMeandersPandas` should have a safety
|
|
102
|
+
check that will allocate more space.
|
|
111
103
|
|
|
112
104
|
Notes
|
|
113
105
|
-----
|
|
@@ -117,7 +109,7 @@ def getBucketsTotal(state: MatrixMeandersNumPyState, safetyMultiplicand: float =
|
|
|
117
109
|
- The starting quantity of `arcCode`.
|
|
118
110
|
- The value(s) of the starting `arcCode`.
|
|
119
111
|
- n
|
|
120
|
-
-
|
|
112
|
+
- boundary
|
|
121
113
|
- Whether this bucketsTotal is increasing, as compared to all of the prior bucketsTotal.
|
|
122
114
|
- If increasing, is it exponential or logarithmic?
|
|
123
115
|
- The maximum value.
|
|
@@ -126,104 +118,29 @@ def getBucketsTotal(state: MatrixMeandersNumPyState, safetyMultiplicand: float =
|
|
|
126
118
|
|
|
127
119
|
Figure out an intelligent flow for so many factors.
|
|
128
120
|
"""
|
|
129
|
-
theDictionary: dict[str, dict[int, dict[int, int]]] = {'A005316':
|
|
130
|
-
bucketsTotal: int = theDictionary.get(state.oeisID, {}).get(state.n, {}).get(state.
|
|
131
|
-
if bucketsTotal
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
dictionaryExponentialCoefficients: dict[ImaKey, float] = {
|
|
135
|
-
(ImaKey(oeisID='', kIsOdd=False, nLess_kIsOdd=True)): 0.834,
|
|
136
|
-
(ImaKey(oeisID='', kIsOdd=False, nLess_kIsOdd=False)): 1.5803,
|
|
137
|
-
(ImaKey(oeisID='', kIsOdd=True, nLess_kIsOdd=True)): 1.556,
|
|
138
|
-
(ImaKey(oeisID='', kIsOdd=True, nLess_kIsOdd=False)): 1.8047,
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
logarithmicOffsets: dict[ImaKey, float] ={
|
|
142
|
-
(ImaKey('A000682', kIsOdd=False, nLess_kIsOdd=False)): 0.0,
|
|
143
|
-
|
|
144
|
-
(ImaKey('A000682', kIsOdd=False, nLess_kIsOdd=True)): -0.07302547148212568,
|
|
145
|
-
(ImaKey('A000682', kIsOdd=True, nLess_kIsOdd=False)): -0.00595307513938792,
|
|
146
|
-
(ImaKey('A000682', kIsOdd=True, nLess_kIsOdd=True)): -0.012201222865243722,
|
|
147
|
-
(ImaKey('A005316', kIsOdd=False, nLess_kIsOdd=False)): -0.6392728422078733,
|
|
148
|
-
(ImaKey('A005316', kIsOdd=False, nLess_kIsOdd=True)): -0.6904925299923548,
|
|
149
|
-
(ImaKey('A005316', kIsOdd=True, nLess_kIsOdd=False)): 0.0,
|
|
150
|
-
(ImaKey('A005316', kIsOdd=True, nLess_kIsOdd=True)): 0.0,
|
|
151
|
-
}
|
|
121
|
+
theDictionary: dict[str, dict[int, dict[int, int]]] = {'A005316': A005316_n_boundary_buckets, 'A000682': A000682_n_boundary_buckets}
|
|
122
|
+
bucketsTotal: int = theDictionary.get(state.oeisID, {}).get(state.n, {}).get(state.boundary, 0)
|
|
123
|
+
if bucketsTotal <= 0:
|
|
124
|
+
bucketsTotal = int(3.55 * len(state.arrayArcCodes))
|
|
152
125
|
|
|
153
|
-
|
|
154
|
-
'intercept': -166.1750299793178,
|
|
155
|
-
'log(n)': 1259.0051001675547,
|
|
156
|
-
'log(k)': -396.4306071056408,
|
|
157
|
-
'log(nLess_k)': -854.3309503739766,
|
|
158
|
-
'k/n': 716.530410654819,
|
|
159
|
-
'(k/n)^2': -2527.035113444166,
|
|
160
|
-
'normalized k': -882.7054406339189,
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
bucketsTotalMaximumBy_kOfMatrix: dict[int, int] = {1:3, 2:12, 3:40, 4:125, 5:392, 6:1254, 7:4087, 8:13623, 9:46181, 10:159137, 11:555469, 12:1961369, 13:6991893, 14:25134208}
|
|
164
|
-
|
|
165
|
-
xCommon = 1.57
|
|
166
|
-
|
|
167
|
-
nLess_k: int = state.n - state.kOfMatrix
|
|
168
|
-
kIsOdd: bool = bool(state.kOfMatrix & 1)
|
|
169
|
-
nLess_kIsOdd: bool = bool(nLess_k & 1)
|
|
170
|
-
kIsEven: bool = not kIsOdd
|
|
171
|
-
|
|
172
|
-
bucketsTotalAtMaximum: bool = state.kOfMatrix <= ((state.n - 1 - (state.kOfMatrix % 2)) // 3)
|
|
173
|
-
bucketsTotalGrowsExponentially: bool = state.kOfMatrix > nLess_k
|
|
174
|
-
bucketsTotalGrowsLogarithmically: bool = state.kOfMatrix > ((state.n - (state.n % 3)) // 3)
|
|
175
|
-
|
|
176
|
-
if bucketsTotalAtMaximum:
|
|
177
|
-
if state.kOfMatrix in bucketsTotalMaximumBy_kOfMatrix:
|
|
178
|
-
bucketsTotal = bucketsTotalMaximumBy_kOfMatrix[state.kOfMatrix]
|
|
179
|
-
else:
|
|
180
|
-
c = 0.95037
|
|
181
|
-
r = 3.3591258254
|
|
182
|
-
if kIsOdd:
|
|
183
|
-
c = 0.92444
|
|
184
|
-
r = 3.35776
|
|
185
|
-
bucketsTotal = int(c * r**state.kOfMatrix * safetyMultiplicand)
|
|
186
|
-
|
|
187
|
-
elif state.kOfMatrix <= max(bucketsTotalMaximumBy_kOfMatrix.keys()):
|
|
188
|
-
# If `kOfMatrix` is low, use maximum bucketsTotal. 1. Can't underestimate. 2. Skip computation that can underestimate.
|
|
189
|
-
# 3. The potential difference in memory use is relatively small.
|
|
190
|
-
bucketsTotal = bucketsTotalMaximumBy_kOfMatrix[state.kOfMatrix]
|
|
126
|
+
return bucketsTotal
|
|
191
127
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
# If I already know bucketsTotal.
|
|
195
|
-
bucketsTotal = bucketsIf_k_ODD_by_nLess_k[nLess_k]
|
|
196
|
-
elif (state.oeisID == 'A005316') and kIsEven and (nLess_k in bucketsIf_k_EVEN_by_nLess_k):
|
|
197
|
-
# If I already know bucketsTotal.
|
|
198
|
-
bucketsTotal = bucketsIf_k_EVEN_by_nLess_k[nLess_k]
|
|
199
|
-
else: # I estimate bucketsTotal during exponential growth.
|
|
200
|
-
xInstant: int = math.ceil(nLess_k / 2)
|
|
201
|
-
A000682adjustStartingArcCode: float = 0.25
|
|
202
|
-
startingConditionsCoefficient: float = dictionaryExponentialCoefficients[ImaKey('', kIsOdd, nLess_kIsOdd)]
|
|
203
|
-
if kIsOdd and nLess_kIsOdd:
|
|
204
|
-
A000682adjustStartingArcCode = 0.0
|
|
205
|
-
if state.oeisID == 'A000682': # NOTE Net effect is between `*= n` and `*= n * 2.2` if n=46.
|
|
206
|
-
startingConditionsCoefficient *= state.n * (((state.n // 2) + 2) ** A000682adjustStartingArcCode)
|
|
207
|
-
bucketsTotal = int(startingConditionsCoefficient * math.exp(xCommon * xInstant))
|
|
128
|
+
def getSignaturesTotal(state: MatrixMeandersNumPyState) -> int:
|
|
129
|
+
"""Get the total number of signatures for the current `n` and `boundary`.
|
|
208
130
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
+ logarithmicParameters['log(k)'] * log(state.kOfMatrix)
|
|
214
|
-
+ logarithmicParameters['log(nLess_k)'] * log(nLess_k)
|
|
215
|
-
+ logarithmicParameters['k/n'] * (state.kOfMatrix / state.n)
|
|
216
|
-
+ logarithmicParameters['(k/n)^2'] * (state.kOfMatrix / state.n)**2
|
|
217
|
-
+ logarithmicParameters['normalized k'] * nLess_k / state.n
|
|
218
|
-
+ logarithmicOffsets[ImaKey(state.oeisID, kIsOdd, nLess_kIsOdd)]
|
|
219
|
-
)
|
|
131
|
+
Parameters
|
|
132
|
+
----------
|
|
133
|
+
state : MatrixMeandersState
|
|
134
|
+
The current state of the computation.
|
|
220
135
|
|
|
221
|
-
|
|
136
|
+
Returns
|
|
137
|
+
-------
|
|
138
|
+
signaturesTotal : int
|
|
139
|
+
The total number of signatures for the current `n` and `boundary`.
|
|
222
140
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return bucketsTotal
|
|
141
|
+
"""
|
|
142
|
+
from mapFolding.reference.matrixMeandersAnalysis.signatures import signatures # noqa: PLC0415
|
|
143
|
+
return signatures[state.oeisID].get(state.n, {}).get(state.boundary, int(3.55 * len(state.arrayArcCodes)))
|
|
227
144
|
|
|
228
145
|
@cache
|
|
229
146
|
def walkDyckPath(intWithExtra_0b1: int) -> int:
|
|
@@ -262,3 +179,4 @@ def walkDyckPath(intWithExtra_0b1: int) -> int:
|
|
|
262
179
|
if findTheExtra_0b1 < 0:
|
|
263
180
|
break
|
|
264
181
|
return flipExtra_0b1_Here
|
|
182
|
+
|