mapFolding 0.15.3__tar.gz → 0.16.0__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.15.3 → mapfolding-0.16.0}/PKG-INFO +9 -2
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/__init__.py +22 -20
- mapfolding-0.16.0/mapFolding/_theSSOT.py +123 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/_theTypes.py +66 -4
- mapfolding-0.16.0/mapFolding/algorithms/__init__.py +1 -0
- {mapfolding-0.15.3/mapFolding → mapfolding-0.16.0/mapFolding/algorithms}/daoOfMapFolding.py +1 -2
- mapfolding-0.16.0/mapFolding/algorithms/getBucketsTotal.py +137 -0
- mapfolding-0.16.0/mapFolding/algorithms/matrixMeanders.py +519 -0
- mapfolding-0.16.0/mapFolding/algorithms/oeisIDbyFormula.py +347 -0
- mapfolding-0.16.0/mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +84 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/basecamp.py +151 -14
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/dataBaskets.py +74 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/oeis.py +43 -56
- mapfolding-0.16.0/mapFolding/reference/A000682facts.py +662 -0
- mapfolding-0.16.0/mapFolding/reference/A005316facts.py +62 -0
- mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/__init__.py +1 -0
- mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/evenEven.py +144 -0
- mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/oddEven.py +54 -0
- mapfolding-0.15.3/mapFolding/_oeisFormulas/matrixMeanders64.py → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround/matrixMeanders64retired.py +37 -29
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +55 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/__init__.py +0 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +185 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +71 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/RecipeJob.py +2 -2
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/__init__.py +9 -2
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/_toolIfThis.py +4 -3
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/_toolkitContainers.py +8 -8
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/infoBooth.py +27 -30
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +1 -1
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +5 -2
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/makingModules_count.py +301 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +120 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/mapFolding/__init__.py +0 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/mapFolding/makeMapFoldingModules.py +220 -0
- mapfolding-0.16.0/mapFolding/someAssemblyRequired/toolkitMakeModules.py +152 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/transformationTools.py +1 -0
- mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronous.py +148 -0
- mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronousAnnex.py +68 -0
- mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +53 -0
- mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +47 -0
- mapfolding-0.16.0/mapFolding/syntheticModules/__init__.py +1 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/dataPackingA007822.py +1 -1
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/conftest.py +28 -9
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/test_computations.py +32 -10
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/test_oeis.py +2 -20
- mapfolding-0.16.0/mapFolding/trim_memory.py +62 -0
- mapfolding-0.16.0/mapFolding/zCuzDocStoopid/__init__.py +1 -0
- mapfolding-0.16.0/mapFolding/zCuzDocStoopid/makeDocstrings.py +63 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding.egg-info/PKG-INFO +9 -2
- mapfolding-0.16.0/mapFolding.egg-info/SOURCES.txt +103 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding.egg-info/entry_points.txt +0 -1
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding.egg-info/requires.txt +8 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/pyproject.toml +11 -3
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A000136.py +0 -4
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A000560.py +0 -4
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A000682.py +0 -85
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A001010.py +0 -19
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A001011.py +0 -5
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A005315.py +0 -4
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A005316.py +0 -10
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A223094.py +0 -7
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A259702.py +0 -4
- mapfolding-0.15.3/mapFolding/_oeisFormulas/A301620.py +0 -6
- mapfolding-0.15.3/mapFolding/_oeisFormulas/Z0Z_aOFn.py +0 -34
- mapfolding-0.15.3/mapFolding/_oeisFormulas/Z0Z_notes.py +0 -16
- mapfolding-0.15.3/mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py +0 -74
- mapfolding-0.15.3/mapFolding/_oeisFormulas/Z0Z_symmetry.py +0 -131
- mapfolding-0.15.3/mapFolding/_oeisFormulas/__init__.py +0 -1
- mapfolding-0.15.3/mapFolding/_oeisFormulas/matrixMeanders.py +0 -134
- mapfolding-0.15.3/mapFolding/_oeisFormulas/matrixMeandersAnnex.py +0 -84
- mapfolding-0.15.3/mapFolding/_theSSOT.py +0 -129
- mapfolding-0.15.3/mapFolding/someAssemblyRequired/A007822rawMaterials.py +0 -46
- mapfolding-0.15.3/mapFolding/someAssemblyRequired/makeAllModules.py +0 -764
- mapfolding-0.15.3/mapFolding.egg-info/SOURCES.txt +0 -95
- {mapfolding-0.15.3 → mapfolding-0.16.0}/LICENSE +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/README.md +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/beDRY.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/filesystemToolkit.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/py.typed +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/__init__.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/flattened.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/hunterNumba.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/irvineJavaPort.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/jaxCount.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/jobsCompleted/__init__.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/jobsCompleted/p2x19/p2x19.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/lunnonNumpy.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/lunnonWhile.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316JavaPort.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316imperative.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316intOptimized.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316optimized128bit.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316primitiveOptimized.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316redis.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/A005316write2disk.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/matrixMeandersBaseline.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/matrixMeandersBaselineAnnex.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/matrixMeandersBaselineV2.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/matrixMeandersSimpleQueue.py +0 -0
- {mapfolding-0.15.3/mapFolding/reference → mapfolding-0.16.0/mapFolding/reference/meandersDumpingGround}/matrixMeandersSlicePop.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/rotatedEntryPoint.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
- {mapfolding-0.15.3/mapFolding/syntheticModules → mapfolding-0.16.0/mapFolding/syntheticModules/A007822}/__init__.py +0 -0
- /mapfolding-0.15.3/mapFolding/syntheticModules/algorithmA007822.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/algorithm.py +0 -0
- /mapfolding-0.15.3/mapFolding/syntheticModules/algorithmA007822Numba.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/algorithmNumba.py +0 -0
- /mapfolding-0.15.3/mapFolding/syntheticModules/initializeStateA007822.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/initializeState.py +0 -0
- /mapfolding-0.15.3/mapFolding/syntheticModules/theorem2A007822.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/theorem2.py +0 -0
- /mapfolding-0.15.3/mapFolding/syntheticModules/theorem2A007822Numba.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/theorem2Numba.py +0 -0
- /mapfolding-0.15.3/mapFolding/syntheticModules/theorem2A007822Trimmed.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/theorem2Trimmed.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/countParallelNumba.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/daoOfMapFoldingNumba.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/dataPacking.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/initializeState.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/theorem2.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/theorem2Numba.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/syntheticModules/theorem2Trimmed.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/__init__.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/test_filesystem.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/test_other.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding/tests/test_tasks.py +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding.egg-info/dependency_links.txt +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/mapFolding.egg-info/top_level.txt +0 -0
- {mapfolding-0.15.3 → mapfolding-0.16.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations and code optimization.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -8,7 +8,7 @@ Project-URL: Donate, https://www.patreon.com/integrated
|
|
|
8
8
|
Project-URL: Homepage, https://github.com/hunterhogan/mapFolding
|
|
9
9
|
Project-URL: Issues, https://github.com/hunterhogan/mapFolding/issues
|
|
10
10
|
Project-URL: Repository, https://github.com/hunterhogan/mapFolding.git
|
|
11
|
-
Keywords: A000136,A000560,A000682,A001010,A001011,A001415,A001416,A001417,A001418,A005315,A005316,A007822,A195646,A223094,A259702,A301620,AST manipulation,GPU acceleration,JIT compilation,Numba optimization,OEIS,Python optimization,abstract syntax tree,algorithmic combinatorics,algorithmic optimization,arch configurations,automated code generation,bit-packed arrays,bitwise state machines,cache-efficient algorithms,closed meandric numbers,code generation,code optimization,code synthesis,code transformation,codon optimization,combinatorial computing,combinatorial enumeration,combinatorial geometry,combinatorial mathematics,combinatorial problem solver,combinatorics,computational combinatorics,computational geometry,crossing patterns,curve crossings,dataclass transformation,discrete mathematics,dynamic compilation,enumerative combinatorics,folding pattern enumeration,folding problems,high-performance computing,integer sequences,just-in-time compilation,kernel optimization,labeled stamp folding,low-level computation,map folding,mapFolding,mathematical algorithms,mathematical modeling,mathematical optimization,mathematical patterns,mathematical software,mathematical tool,mathematical visualization,meander enumeration,meanders,meandric systems,memory-efficient enumeration,metaprogramming,numerical algorithms,numerical computation,open meandric systems,paper folding mathematics,parallel computing,pattern recognition,performance optimization,permutation patterns,permutations,post-setup optimization,pyproject,scientific computing,semi-meanders,sequence analysis,sequence calculator,sequence enumeration,sequence explorer,sequence generation,source code analysis,stamp folding,symbolic computation,symmetric foldings,topological combinatorics,topological patterns,typed Python
|
|
11
|
+
Keywords: A000136,A000560,A000682,A001010,A001011,A001415,A001416,A001417,A001418,A005315,A005316,A007822,A178961,A195646,A223094,A259702,A301620,AST manipulation,GPU acceleration,JIT compilation,Numba optimization,OEIS,Python optimization,abstract syntax tree,algorithmic combinatorics,algorithmic optimization,arch configurations,automated code generation,bit-packed arrays,bitwise state machines,cache-efficient algorithms,closed meandric numbers,code generation,code optimization,code synthesis,code transformation,codon optimization,combinatorial computing,combinatorial enumeration,combinatorial geometry,combinatorial mathematics,combinatorial problem solver,combinatorics,computational combinatorics,computational geometry,crossing patterns,curve crossings,dataclass transformation,discrete mathematics,dynamic compilation,enumerative combinatorics,folding pattern enumeration,folding problems,high-performance computing,integer sequences,just-in-time compilation,kernel optimization,labeled stamp folding,low-level computation,map folding,mapFolding,mathematical algorithms,mathematical modeling,mathematical optimization,mathematical patterns,mathematical software,mathematical tool,mathematical visualization,meander enumeration,meanders,meandric systems,memory-efficient enumeration,metaprogramming,numerical algorithms,numerical computation,open meandric systems,paper folding mathematics,parallel computing,pattern recognition,performance optimization,permutation patterns,permutations,post-setup optimization,pyproject,scientific computing,semi-meanders,sequence analysis,sequence calculator,sequence enumeration,sequence explorer,sequence generation,source code analysis,stamp folding,symbolic computation,symmetric foldings,topological combinatorics,topological patterns,typed Python
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Environment :: Console
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
@@ -35,6 +35,7 @@ Requires-Python: >=3.12
|
|
|
35
35
|
Description-Content-Type: text/markdown
|
|
36
36
|
License-File: LICENSE
|
|
37
37
|
Requires-Dist: astToolkit
|
|
38
|
+
Requires-Dist: autoflake
|
|
38
39
|
Requires-Dist: hunterMakesPy
|
|
39
40
|
Requires-Dist: numpy
|
|
40
41
|
Requires-Dist: platformdirs
|
|
@@ -47,8 +48,14 @@ Requires-Dist: setuptools-scm; extra == "development"
|
|
|
47
48
|
Provides-Extra: numba
|
|
48
49
|
Requires-Dist: numba; extra == "numba"
|
|
49
50
|
Requires-Dist: numba_progress; extra == "numba"
|
|
51
|
+
Provides-Extra: pandas
|
|
52
|
+
Requires-Dist: pandas; extra == "pandas"
|
|
53
|
+
Requires-Dist: pyarrow; extra == "pandas"
|
|
54
|
+
Requires-Dist: pyarrow-stubs; extra == "pandas"
|
|
50
55
|
Provides-Extra: testing
|
|
51
56
|
Requires-Dist: numba; extra == "testing"
|
|
57
|
+
Requires-Dist: pandas; extra == "testing"
|
|
58
|
+
Requires-Dist: pyarrow; extra == "testing"
|
|
52
59
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
53
60
|
Requires-Dist: pytest-env; extra == "testing"
|
|
54
61
|
Requires-Dist: pytest-xdist; extra == "testing"
|
|
@@ -15,17 +15,17 @@ The computational framework integrates type safety, persistent result storage,
|
|
|
15
15
|
and mathematical validation through OEIS sequence integration.
|
|
16
16
|
|
|
17
17
|
Core Transformation Tools:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
countFolds: Primary interface for computing folding pattern counts
|
|
19
|
+
MapFoldingState: Computational state management for recursive analysis
|
|
20
|
+
Connection graph generation: Mathematical foundation for folding relationships
|
|
21
|
+
Task division utilities: Experimental parallel computation options
|
|
22
|
+
OEIS integration: Mathematical validation and sequence discovery
|
|
23
23
|
|
|
24
24
|
Primary Use Cases:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
Mathematical research into folding pattern properties and relationships
|
|
26
|
+
Educational exploration of combinatorial mathematics concepts
|
|
27
|
+
Computational validation of theoretical results
|
|
28
|
+
Extension of known mathematical sequences through new discoveries
|
|
29
29
|
|
|
30
30
|
The package handles the full spectrum of map folding analysis, from simple
|
|
31
31
|
educational examples to research-grade computations requiring multi-day processing
|
|
@@ -50,11 +50,14 @@ from mapFolding._theTypes import (
|
|
|
50
50
|
DatatypeElephino as DatatypeElephino,
|
|
51
51
|
DatatypeFoldsTotal as DatatypeFoldsTotal,
|
|
52
52
|
DatatypeLeavesTotal as DatatypeLeavesTotal,
|
|
53
|
+
MetadataOEISidMapFolding as MetadataOEISidMapFolding,
|
|
54
|
+
MetadataOEISidMapFoldingManuallySet as MetadataOEISidMapFoldingManuallySet,
|
|
55
|
+
MetadataOEISidMeanders as MetadataOEISidMeanders,
|
|
56
|
+
MetadataOEISidMeandersManuallySet as MetadataOEISidMeandersManuallySet,
|
|
53
57
|
NumPyElephino as NumPyElephino,
|
|
54
58
|
NumPyFoldsTotal as NumPyFoldsTotal,
|
|
55
59
|
NumPyIntegerType as NumPyIntegerType,
|
|
56
|
-
NumPyLeavesTotal as NumPyLeavesTotal
|
|
57
|
-
)
|
|
60
|
+
NumPyLeavesTotal as NumPyLeavesTotal)
|
|
58
61
|
|
|
59
62
|
from mapFolding._theSSOT import packageSettings as packageSettings
|
|
60
63
|
|
|
@@ -64,26 +67,25 @@ from mapFolding.beDRY import (
|
|
|
64
67
|
getTaskDivisions as getTaskDivisions,
|
|
65
68
|
makeDataContainer as makeDataContainer,
|
|
66
69
|
setProcessorLimit as setProcessorLimit,
|
|
67
|
-
validateListDimensions as validateListDimensions
|
|
68
|
-
)
|
|
70
|
+
validateListDimensions as validateListDimensions)
|
|
69
71
|
|
|
70
|
-
from mapFolding.dataBaskets import
|
|
72
|
+
from mapFolding.dataBaskets import (
|
|
73
|
+
MapFoldingState as MapFoldingState,
|
|
74
|
+
MatrixMeandersState as MatrixMeandersState)
|
|
71
75
|
|
|
72
76
|
from mapFolding.filesystemToolkit import (
|
|
73
77
|
getFilenameFoldsTotal as getFilenameFoldsTotal,
|
|
74
78
|
getPathFilenameFoldsTotal as getPathFilenameFoldsTotal,
|
|
75
79
|
getPathRootJobDEFAULT as getPathRootJobDEFAULT,
|
|
76
80
|
saveFoldsTotal as saveFoldsTotal,
|
|
77
|
-
saveFoldsTotalFAILearly as saveFoldsTotalFAILearly
|
|
78
|
-
)
|
|
81
|
+
saveFoldsTotalFAILearly as saveFoldsTotalFAILearly)
|
|
79
82
|
|
|
80
83
|
from mapFolding.basecamp import countFolds as countFolds
|
|
81
84
|
|
|
82
85
|
from mapFolding.oeis import (
|
|
83
|
-
|
|
86
|
+
dictionaryOEISMapFolding as dictionaryOEISMapFolding,
|
|
87
|
+
dictionaryOEISMeanders as dictionaryOEISMeanders,
|
|
84
88
|
getFoldsTotalKnown as getFoldsTotalKnown,
|
|
85
89
|
getOEISids as getOEISids,
|
|
86
90
|
OEIS_for_n as OEIS_for_n,
|
|
87
|
-
oeisIDfor_n as oeisIDfor_n
|
|
88
|
-
dictionaryOEIS as dictionaryOEIS,
|
|
89
|
-
)
|
|
91
|
+
oeisIDfor_n as oeisIDfor_n)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Access and configure package settings and metadata."""
|
|
2
|
+
|
|
3
|
+
from hunterMakesPy import PackageSettings
|
|
4
|
+
from mapFolding._theTypes import MetadataOEISidMapFoldingManuallySet, MetadataOEISidMeandersManuallySet
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import dataclasses
|
|
7
|
+
import random
|
|
8
|
+
|
|
9
|
+
@dataclasses.dataclass
|
|
10
|
+
class mapFoldingPackageSettings(PackageSettings):
|
|
11
|
+
"""Widely used settings that are especially useful for map folding algorithms.
|
|
12
|
+
|
|
13
|
+
Attributes
|
|
14
|
+
----------
|
|
15
|
+
identifierPackageFALLBACK : str = ''
|
|
16
|
+
Fallback package identifier used only during initialization when automatic discovery fails.
|
|
17
|
+
pathPackage : Path = Path()
|
|
18
|
+
Absolute path to the installed package directory. Automatically resolved from `identifierPackage` if not provided.
|
|
19
|
+
identifierPackage : str = ''
|
|
20
|
+
Canonical name of the package. Automatically extracted from `pyproject.toml`.
|
|
21
|
+
fileExtension : str = '.py'
|
|
22
|
+
Default file extension.
|
|
23
|
+
|
|
24
|
+
cacheDays : int = 30
|
|
25
|
+
Number of days to retain cached OEIS data before refreshing from the online source.
|
|
26
|
+
concurrencyPackage : str = 'multiprocessing'
|
|
27
|
+
Package identifier for concurrent execution operations.
|
|
28
|
+
OEISidMapFoldingManuallySet : dict[str, MetadataOEISidMapFoldingManuallySet]
|
|
29
|
+
Settings that are best selected by a human instead of algorithmically.
|
|
30
|
+
OEISidMeandersManuallySet : dict[str, MetadataOEISidMeandersManuallySet]
|
|
31
|
+
Settings that are best selected by a human instead of algorithmically for meander sequences.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
OEISidMapFoldingManuallySet: dict[str, MetadataOEISidMapFoldingManuallySet] = dataclasses.field(default_factory=dict[str, MetadataOEISidMapFoldingManuallySet])
|
|
35
|
+
"""Settings that are best selected by a human instead of algorithmically."""
|
|
36
|
+
|
|
37
|
+
OEISidMeandersManuallySet: dict[str, MetadataOEISidMeandersManuallySet] = dataclasses.field(default_factory=dict[str, MetadataOEISidMeandersManuallySet])
|
|
38
|
+
"""Settings that are best selected by a human instead of algorithmically for meander sequences."""
|
|
39
|
+
|
|
40
|
+
cacheDays: int = 30
|
|
41
|
+
"""Number of days to retain cached OEIS data before refreshing from the online source."""
|
|
42
|
+
|
|
43
|
+
concurrencyPackage: str = 'multiprocessing'
|
|
44
|
+
"""Package identifier for concurrent execution operations."""
|
|
45
|
+
|
|
46
|
+
# TODO I made a `TypedDict` before I knew how to make dataclasses and classes. Think about other data structures.
|
|
47
|
+
OEISidMapFoldingManuallySet: dict[str, MetadataOEISidMapFoldingManuallySet] = {
|
|
48
|
+
'A000136': {
|
|
49
|
+
'getMapShape': lambda n: (1, n),
|
|
50
|
+
'valuesBenchmark': [14],
|
|
51
|
+
'valuesTestParallelization': [*range(3, 7)],
|
|
52
|
+
'valuesTestValidation': [random.randint(2, 9)], # noqa: S311
|
|
53
|
+
},
|
|
54
|
+
'A001415': {
|
|
55
|
+
'getMapShape': lambda n: (2, n),
|
|
56
|
+
'valuesBenchmark': [14],
|
|
57
|
+
'valuesTestParallelization': [*range(3, 7)],
|
|
58
|
+
'valuesTestValidation': [random.randint(2, 9)], # noqa: S311
|
|
59
|
+
},
|
|
60
|
+
'A001416': {
|
|
61
|
+
'getMapShape': lambda n: (3, n),
|
|
62
|
+
'valuesBenchmark': [9],
|
|
63
|
+
'valuesTestParallelization': [*range(3, 5)],
|
|
64
|
+
'valuesTestValidation': [random.randint(2, 6)], # noqa: S311
|
|
65
|
+
},
|
|
66
|
+
'A001417': {
|
|
67
|
+
'getMapShape': lambda n: tuple(2 for _dimension in range(n)),
|
|
68
|
+
'valuesBenchmark': [6],
|
|
69
|
+
'valuesTestParallelization': [*range(2, 4)],
|
|
70
|
+
'valuesTestValidation': [random.randint(2, 4)], # noqa: S311
|
|
71
|
+
},
|
|
72
|
+
'A195646': {
|
|
73
|
+
'getMapShape': lambda n: tuple(3 for _dimension in range(n)),
|
|
74
|
+
'valuesBenchmark': [3],
|
|
75
|
+
'valuesTestParallelization': [*range(2, 3)],
|
|
76
|
+
'valuesTestValidation': [2],
|
|
77
|
+
},
|
|
78
|
+
'A001418': {
|
|
79
|
+
'getMapShape': lambda n: (n, n),
|
|
80
|
+
'valuesBenchmark': [5],
|
|
81
|
+
'valuesTestParallelization': [*range(2, 4)],
|
|
82
|
+
'valuesTestValidation': [random.randint(2, 4)], # noqa: S311
|
|
83
|
+
},
|
|
84
|
+
'A007822': {
|
|
85
|
+
'getMapShape': lambda n: (1, 2 * n),
|
|
86
|
+
'valuesBenchmark': [7],
|
|
87
|
+
'valuesTestParallelization': [*range(2, 4)],
|
|
88
|
+
'valuesTestValidation': [random.randint(2, 8)], # noqa: S311
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
identifierPackageFALLBACK = "mapFolding"
|
|
93
|
+
"""Manually entered package name used as fallback when dynamic resolution fails."""
|
|
94
|
+
|
|
95
|
+
packageSettings = mapFoldingPackageSettings(identifierPackageFALLBACK=identifierPackageFALLBACK, OEISidMapFoldingManuallySet=OEISidMapFoldingManuallySet)
|
|
96
|
+
"""Global package settings."""
|
|
97
|
+
|
|
98
|
+
# TODO integrate into packageSettings
|
|
99
|
+
pathCache: Path = packageSettings.pathPackage / ".cache"
|
|
100
|
+
"""Local directory path for storing cached OEIS sequence data and metadata."""
|
|
101
|
+
OEISidMeandersManuallySet: dict[str, MetadataOEISidMeandersManuallySet] = {
|
|
102
|
+
'A000560': {'valuesTestValidation': [*range(3, 12)]},
|
|
103
|
+
'A000682': {'valuesTestValidation': [*range(3, 12)]},
|
|
104
|
+
'A001010': {'valuesTestValidation': [*range(3, 11)]},
|
|
105
|
+
'A001011': {'valuesTestValidation': [*range(3, 7)]},
|
|
106
|
+
'A005315': {'valuesTestValidation': [*range(3, 9)]},
|
|
107
|
+
'A005316': {'valuesTestValidation': [*range(3, 13)]},
|
|
108
|
+
'A060206': {'valuesTestValidation': [*range(3, 9)]},
|
|
109
|
+
'A077460': {'valuesTestValidation': [*range(3, 8)]},
|
|
110
|
+
'A078591': {'valuesTestValidation': [*range(3, 10)]},
|
|
111
|
+
'A178961': {'valuesTestValidation': [*range(3, 11)]},
|
|
112
|
+
'A223094': {'valuesTestValidation': [*range(3, 11)]},
|
|
113
|
+
'A259702': {'valuesTestValidation': [*range(3, 13)]},
|
|
114
|
+
'A301620': {'valuesTestValidation': [*range(3, 11)]},
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
# Recreate packageSettings with meanders settings included
|
|
118
|
+
packageSettings = mapFoldingPackageSettings(
|
|
119
|
+
identifierPackageFALLBACK=identifierPackageFALLBACK,
|
|
120
|
+
OEISidMapFoldingManuallySet=OEISidMapFoldingManuallySet,
|
|
121
|
+
OEISidMeandersManuallySet=OEISidMeandersManuallySet,
|
|
122
|
+
)
|
|
123
|
+
"""Global package settings."""
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Types for defensive coding and for computation optimization."""
|
|
2
2
|
|
|
3
|
+
from collections.abc import Callable
|
|
3
4
|
from numpy import dtype, int_ as numpy_int, integer, ndarray, uint64 as numpy_uint64
|
|
4
|
-
from typing import Any, TypeAlias, TypeVar
|
|
5
|
+
from typing import Any, TypeAlias, TypedDict, TypeVar
|
|
5
6
|
|
|
6
7
|
NumPyIntegerType = TypeVar('NumPyIntegerType', bound=integer[Any], covariant=True)
|
|
7
8
|
"""Any NumPy integer type, which is usually between 8-bit signed and 64-bit unsigned."""
|
|
@@ -19,9 +20,9 @@ Note well
|
|
|
19
20
|
---------
|
|
20
21
|
Colossal values are found with the cross humpy inequality:
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
⎡ el ⎤ ⎡ ⎤
|
|
24
|
+
⎢ eph ⎥ X ⎢ rhi ⎥ <= elephino
|
|
25
|
+
⎣ ant ⎦ ⎣ no ⎦
|
|
25
26
|
|
|
26
27
|
"""
|
|
27
28
|
|
|
@@ -50,3 +51,64 @@ Array1DElephino: TypeAlias = ndarray[tuple[int], dtype[NumPyElephino]] # noqa:
|
|
|
50
51
|
|
|
51
52
|
Array1DFoldsTotal: TypeAlias = ndarray[tuple[int], dtype[NumPyFoldsTotal]] # 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.
|
|
52
53
|
"""A `numpy.ndarray` with one axis and elements of type `NumPyFoldsTotal`."""
|
|
54
|
+
|
|
55
|
+
class MetadataOEISidMapFoldingManuallySet(TypedDict):
|
|
56
|
+
"""Settings that are best selected by a human instead of algorithmically."""
|
|
57
|
+
|
|
58
|
+
getMapShape: Callable[[int], tuple[int, ...]]
|
|
59
|
+
"""Function to convert the OEIS sequence index, 'n', to its `mapShape` tuple."""
|
|
60
|
+
valuesBenchmark: list[int]
|
|
61
|
+
"""List of index values, 'n', to use when benchmarking the algorithm performance."""
|
|
62
|
+
valuesTestParallelization: list[int]
|
|
63
|
+
"""List of index values, 'n', to use when testing parallelization performance."""
|
|
64
|
+
valuesTestValidation: list[int]
|
|
65
|
+
"""List of index values, 'n', to use when testing validation performance."""
|
|
66
|
+
|
|
67
|
+
class MetadataOEISidMapFolding(TypedDict):
|
|
68
|
+
"""Settings for an implemented OEIS sequence."""
|
|
69
|
+
|
|
70
|
+
description: str
|
|
71
|
+
"""The OEIS.org description of the integer sequence."""
|
|
72
|
+
getMapShape: Callable[[int], tuple[int, ...]]
|
|
73
|
+
"""Function to convert the OEIS sequence index, 'n', to its `mapShape` tuple."""
|
|
74
|
+
offset: int
|
|
75
|
+
"""The starting index, 'n', of the sequence, typically 0 or 1."""
|
|
76
|
+
valuesBenchmark: list[int]
|
|
77
|
+
"""List of index values, 'n', to use when benchmarking the algorithm performance."""
|
|
78
|
+
valuesKnown: dict[int, int]
|
|
79
|
+
"""Dictionary of sequence indices, 'n', to their known values, `foldsTotal`."""
|
|
80
|
+
valuesTestParallelization: list[int]
|
|
81
|
+
"""List of index values, 'n', to use when testing parallelization performance."""
|
|
82
|
+
valuesTestValidation: list[int]
|
|
83
|
+
"""List of index values, 'n', to use when testing validation performance."""
|
|
84
|
+
valueUnknown: int
|
|
85
|
+
"""The smallest value of 'n' for for which `foldsTotal` is unknown."""
|
|
86
|
+
|
|
87
|
+
# ruff: noqa: ERA001
|
|
88
|
+
class MetadataOEISidMeandersManuallySet(TypedDict):
|
|
89
|
+
"""Settings that are best selected by a human instead of algorithmically."""
|
|
90
|
+
|
|
91
|
+
# valuesBenchmark: list[int]
|
|
92
|
+
"""List of index values, 'n', to use when benchmarking the algorithm performance."""
|
|
93
|
+
# valuesTestParallelization: list[int]
|
|
94
|
+
"""List of index values, 'n', to use when testing parallelization performance."""
|
|
95
|
+
valuesTestValidation: list[int]
|
|
96
|
+
"""List of index values, 'n', to use when testing validation performance."""
|
|
97
|
+
|
|
98
|
+
class MetadataOEISidMeanders(TypedDict):
|
|
99
|
+
"""Settings for an implemented OEIS sequence."""
|
|
100
|
+
|
|
101
|
+
description: str
|
|
102
|
+
"""The OEIS.org description of the integer sequence."""
|
|
103
|
+
offset: int
|
|
104
|
+
"""The starting index, 'n', of the sequence, typically 0 or 1."""
|
|
105
|
+
# valuesBenchmark: list[int]
|
|
106
|
+
"""List of index values, 'n', to use when benchmarking the algorithm performance."""
|
|
107
|
+
valuesKnown: dict[int, int]
|
|
108
|
+
"""Dictionary of sequence indices, 'n', to their known values, `foldsTotal`."""
|
|
109
|
+
# valuesTestParallelization: list[int]
|
|
110
|
+
"""List of index values, 'n', to use when testing parallelization performance."""
|
|
111
|
+
valuesTestValidation: list[int]
|
|
112
|
+
"""List of index values, 'n', to use when testing validation performance."""
|
|
113
|
+
valueUnknown: int
|
|
114
|
+
"""The smallest value of 'n' for for which `foldsTotal` is unknown."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Hand-made algorithms."""
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# ruff: noqa: D100 D103
|
|
2
1
|
from mapFolding.dataBaskets import MapFoldingState
|
|
3
2
|
|
|
4
3
|
def activeLeafGreaterThan0(state: MapFoldingState) -> bool:
|
|
@@ -140,4 +139,4 @@ def count(state: MapFoldingState) -> MapFoldingState:
|
|
|
140
139
|
|
|
141
140
|
def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
|
|
142
141
|
state = count(state)
|
|
143
|
-
return state
|
|
142
|
+
return state
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""Buckets."""
|
|
2
|
+
from mapFolding import MatrixMeandersState
|
|
3
|
+
from mapFolding.reference.A005316facts import bucketsIf_k_EVEN_by_nLess_k, bucketsIf_k_ODD_by_nLess_k
|
|
4
|
+
from math import exp, log
|
|
5
|
+
from typing import NamedTuple
|
|
6
|
+
import math
|
|
7
|
+
|
|
8
|
+
class ImaKey(NamedTuple):
|
|
9
|
+
"""keys for dictionaries."""
|
|
10
|
+
|
|
11
|
+
oeisID: str
|
|
12
|
+
kIsOdd: bool
|
|
13
|
+
nLess_kIsOdd: bool
|
|
14
|
+
|
|
15
|
+
def getBucketsTotal(state: MatrixMeandersState, safetyMultiplicand: float = 1.2) -> int:
|
|
16
|
+
"""Estimate the total number of non-unique curveLocations that will be computed from the existing curveLocations.
|
|
17
|
+
|
|
18
|
+
Notes
|
|
19
|
+
-----
|
|
20
|
+
Subexponential bucketsTotal unified estimator parameters (derived in reference notebook).
|
|
21
|
+
|
|
22
|
+
The model is: log(buckets) = intercept + bN*log(n) + bK*log(k) + bD*log(n-k) + g_r*(k/n) + g_r2*(k/n)^2 + g_s*((n-k)/n) + offset(subseries)
|
|
23
|
+
Subseries key: f"{oeisID}_kOdd={int(kIsOdd)}_dOdd={int(nLess_kIsOdd)}" with a reference subseries offset of zero.
|
|
24
|
+
These coefficients intentionally remain in-source (SSOT) to avoid runtime JSON parsing overhead and to support reproducibility.
|
|
25
|
+
"""
|
|
26
|
+
dictionaryExponentialCoefficients: dict[ImaKey, float] = {
|
|
27
|
+
(ImaKey(oeisID='', kIsOdd=False, nLess_kIsOdd=True)): 0.834,
|
|
28
|
+
(ImaKey(oeisID='', kIsOdd=False, nLess_kIsOdd=False)): 1.5803,
|
|
29
|
+
(ImaKey(oeisID='', kIsOdd=True, nLess_kIsOdd=True)): 1.556,
|
|
30
|
+
(ImaKey(oeisID='', kIsOdd=True, nLess_kIsOdd=False)): 1.8047,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
logarithmicOffsets: dict[ImaKey, float] ={
|
|
34
|
+
(ImaKey('A000682', kIsOdd=False, nLess_kIsOdd=False)): 0.0,
|
|
35
|
+
(ImaKey('A000682', kIsOdd=False, nLess_kIsOdd=True)): -0.07302547148212568,
|
|
36
|
+
(ImaKey('A000682', kIsOdd=True, nLess_kIsOdd=False)): -0.00595307513938792,
|
|
37
|
+
(ImaKey('A000682', kIsOdd=True, nLess_kIsOdd=True)): -0.012201222865243722,
|
|
38
|
+
(ImaKey('A005316', kIsOdd=False, nLess_kIsOdd=False)): -0.6392728422078733,
|
|
39
|
+
(ImaKey('A005316', kIsOdd=False, nLess_kIsOdd=True)): -0.6904925299923548,
|
|
40
|
+
(ImaKey('A005316', kIsOdd=True, nLess_kIsOdd=False)): 0.0,
|
|
41
|
+
(ImaKey('A005316', kIsOdd=True, nLess_kIsOdd=True)): 0.0,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
logarithmicParameters: dict[str, float] = {
|
|
45
|
+
'intercept': -166.1750299793178,
|
|
46
|
+
'log(n)': 1259.0051001675547,
|
|
47
|
+
'log(k)': -396.4306071056408,
|
|
48
|
+
'log(nLess_k)': -854.3309503739766,
|
|
49
|
+
'k/n': 716.530410654819,
|
|
50
|
+
'(k/n)^2': -2527.035113444166,
|
|
51
|
+
'normalized k': -882.7054406339189,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
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}
|
|
55
|
+
|
|
56
|
+
xCommon = 1.57
|
|
57
|
+
|
|
58
|
+
nLess_k: int = state.n - state.kOfMatrix
|
|
59
|
+
kIsOdd: bool = bool(state.kOfMatrix & 1)
|
|
60
|
+
nLess_kIsOdd: bool = bool(nLess_k & 1)
|
|
61
|
+
kIsEven: bool = not kIsOdd
|
|
62
|
+
bucketsTotal: int = -8
|
|
63
|
+
|
|
64
|
+
"""NOTE temporary notes
|
|
65
|
+
I have a fault in my thinking. bucketsTotal increases as k decreases until ~0.4k, then bucketsTotal decreases rapidly to 1. I
|
|
66
|
+
have ignored the decreasing side. In the formulas for estimation, I didn't differentiate between increasing and decreasing.
|
|
67
|
+
So, I probably need to refine the formulas. I guess I need to add checks to the if/else monster, too.
|
|
68
|
+
|
|
69
|
+
While buckets is increasing:
|
|
70
|
+
3 types of estimates:
|
|
71
|
+
1. Exponential growth.
|
|
72
|
+
2. Logarithmic growth.
|
|
73
|
+
3. Hard ceiling.
|
|
74
|
+
While buckets is decreasing:
|
|
75
|
+
1. Hard ceiling, same as increasing side.
|
|
76
|
+
2. ???
|
|
77
|
+
3. buckets = 1.
|
|
78
|
+
|
|
79
|
+
The formula for exponential growth _never_ underestimates. I haven't measured by how much it overestimates.
|
|
80
|
+
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
bucketsTotalAtMaximum: bool = state.kOfMatrix <= ((state.n - 1 - (state.kOfMatrix % 2)) // 3)
|
|
84
|
+
bucketsTotalGrowsExponentially: bool = state.kOfMatrix > nLess_k
|
|
85
|
+
bucketsTotalGrowsLogarithmically: bool = state.kOfMatrix > ((state.n - (state.n % 3)) // 3)
|
|
86
|
+
|
|
87
|
+
if bucketsTotalAtMaximum:
|
|
88
|
+
if state.kOfMatrix in bucketsTotalMaximumBy_kOfMatrix:
|
|
89
|
+
bucketsTotal = bucketsTotalMaximumBy_kOfMatrix[state.kOfMatrix]
|
|
90
|
+
else:
|
|
91
|
+
c = 0.95037
|
|
92
|
+
r = 3.3591258254
|
|
93
|
+
if kIsOdd:
|
|
94
|
+
c = 0.92444
|
|
95
|
+
r = 3.35776
|
|
96
|
+
bucketsTotal = int(c * r**state.kOfMatrix * safetyMultiplicand)
|
|
97
|
+
|
|
98
|
+
elif bucketsTotalGrowsExponentially:
|
|
99
|
+
if (state.oeisID == 'A005316') and kIsOdd and (nLess_k in bucketsIf_k_ODD_by_nLess_k):
|
|
100
|
+
# If I already know bucketsTotal.
|
|
101
|
+
bucketsTotal = bucketsIf_k_ODD_by_nLess_k[nLess_k]
|
|
102
|
+
elif (state.oeisID == 'A005316') and kIsEven and (nLess_k in bucketsIf_k_EVEN_by_nLess_k):
|
|
103
|
+
# If I already know bucketsTotal.
|
|
104
|
+
bucketsTotal = bucketsIf_k_EVEN_by_nLess_k[nLess_k]
|
|
105
|
+
else: # I estimate bucketsTotal during exponential growth.
|
|
106
|
+
xInstant: int = math.ceil(nLess_k / 2)
|
|
107
|
+
A000682adjustStartingCurveLocations: float = 0.25
|
|
108
|
+
startingConditionsCoefficient: float = dictionaryExponentialCoefficients[ImaKey('', kIsOdd, nLess_kIsOdd)]
|
|
109
|
+
if kIsOdd and nLess_kIsOdd:
|
|
110
|
+
A000682adjustStartingCurveLocations = 0.0
|
|
111
|
+
if state.oeisID == 'A000682': # NOTE Net effect is between `*= n` and `*= n * 2.2` if n=46.
|
|
112
|
+
startingConditionsCoefficient *= state.n * (((state.n // 2) + 2) ** A000682adjustStartingCurveLocations)
|
|
113
|
+
bucketsTotal = int(startingConditionsCoefficient * math.exp(xCommon * xInstant))
|
|
114
|
+
|
|
115
|
+
elif state.kOfMatrix <= max(bucketsTotalMaximumBy_kOfMatrix.keys()):
|
|
116
|
+
# If `kOfMatrix` is low, use maximum bucketsTotal. 1. Can't underestimate. 2. Skip computation that can underestimate.
|
|
117
|
+
# 3. The potential difference in memory use is relatively small.
|
|
118
|
+
bucketsTotal = bucketsTotalMaximumBy_kOfMatrix[state.kOfMatrix]
|
|
119
|
+
|
|
120
|
+
elif bucketsTotalGrowsLogarithmically:
|
|
121
|
+
xPower: float = (0
|
|
122
|
+
+ logarithmicParameters['intercept']
|
|
123
|
+
+ logarithmicParameters['log(n)'] * log(state.n)
|
|
124
|
+
+ logarithmicParameters['log(k)'] * log(state.kOfMatrix)
|
|
125
|
+
+ logarithmicParameters['log(nLess_k)'] * log(nLess_k)
|
|
126
|
+
+ logarithmicParameters['k/n'] * (state.kOfMatrix / state.n)
|
|
127
|
+
+ logarithmicParameters['(k/n)^2'] * (state.kOfMatrix / state.n)**2
|
|
128
|
+
+ logarithmicParameters['normalized k'] * nLess_k / state.n
|
|
129
|
+
+ logarithmicOffsets[ImaKey(state.oeisID, kIsOdd, nLess_kIsOdd)]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
bucketsTotal = int(exp(xPower * safetyMultiplicand))
|
|
133
|
+
|
|
134
|
+
else:
|
|
135
|
+
message = "I shouldn't be here."
|
|
136
|
+
raise SystemError(message)
|
|
137
|
+
return bucketsTotal
|