mapFolding 0.15.4__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.
Files changed (109) hide show
  1. {mapfolding-0.15.4 → mapfolding-0.16.0}/PKG-INFO +9 -2
  2. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/__init__.py +7 -9
  3. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/_theSSOT.py +1 -0
  4. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/algorithms/daoOfMapFolding.py +1 -2
  5. mapfolding-0.16.0/mapFolding/algorithms/getBucketsTotal.py +137 -0
  6. mapfolding-0.16.0/mapFolding/algorithms/matrixMeanders.py +519 -0
  7. mapfolding-0.16.0/mapFolding/algorithms/oeisIDbyFormula.py +347 -0
  8. mapfolding-0.16.0/mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +84 -0
  9. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/basecamp.py +99 -14
  10. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/dataBaskets.py +74 -0
  11. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/oeis.py +3 -2
  12. mapfolding-0.16.0/mapFolding/reference/A000682facts.py +662 -0
  13. mapfolding-0.16.0/mapFolding/reference/A005316facts.py +62 -0
  14. mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/__init__.py +1 -0
  15. mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/evenEven.py +144 -0
  16. mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/oddEven.py +54 -0
  17. mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +55 -0
  18. mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/__init__.py +0 -0
  19. mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +185 -0
  20. mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +71 -0
  21. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/RecipeJob.py +2 -2
  22. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/__init__.py +9 -2
  23. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/_toolIfThis.py +4 -3
  24. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/_toolkitContainers.py +8 -8
  25. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/infoBooth.py +27 -30
  26. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +1 -1
  27. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +5 -2
  28. mapfolding-0.16.0/mapFolding/someAssemblyRequired/makingModules_count.py +301 -0
  29. mapfolding-0.16.0/mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +120 -0
  30. mapfolding-0.16.0/mapFolding/someAssemblyRequired/mapFolding/__init__.py +0 -0
  31. mapfolding-0.16.0/mapFolding/someAssemblyRequired/mapFolding/makeMapFoldingModules.py +220 -0
  32. mapfolding-0.16.0/mapFolding/someAssemblyRequired/toolkitMakeModules.py +152 -0
  33. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
  34. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/transformationTools.py +1 -0
  35. mapfolding-0.15.4/mapFolding/syntheticModules/algorithmA007822Numba.py → mapfolding-0.16.0/mapFolding/syntheticModules/A007822/algorithmNumba.py +2 -4
  36. mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronous.py +148 -0
  37. mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronousAnnex.py +68 -0
  38. mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +53 -0
  39. mapfolding-0.16.0/mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +47 -0
  40. mapfolding-0.16.0/mapFolding/syntheticModules/__init__.py +1 -0
  41. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/dataPackingA007822.py +1 -1
  42. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/test_computations.py +2 -2
  43. mapfolding-0.16.0/mapFolding/trim_memory.py +62 -0
  44. mapfolding-0.16.0/mapFolding/zCuzDocStoopid/__init__.py +1 -0
  45. mapfolding-0.16.0/mapFolding/zCuzDocStoopid/makeDocstrings.py +63 -0
  46. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding.egg-info/PKG-INFO +9 -2
  47. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding.egg-info/SOURCES.txt +31 -9
  48. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding.egg-info/requires.txt +8 -0
  49. {mapfolding-0.15.4 → mapfolding-0.16.0}/pyproject.toml +9 -1
  50. mapfolding-0.15.4/mapFolding/algorithms/matrixMeanders.py +0 -348
  51. mapfolding-0.15.4/mapFolding/algorithms/oeisIDbyFormula.py +0 -113
  52. mapfolding-0.15.4/mapFolding/someAssemblyRequired/A007822rawMaterials.py +0 -46
  53. mapfolding-0.15.4/mapFolding/someAssemblyRequired/makeAllModules.py +0 -764
  54. {mapfolding-0.15.4 → mapfolding-0.16.0}/LICENSE +0 -0
  55. {mapfolding-0.15.4 → mapfolding-0.16.0}/README.md +0 -0
  56. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/_theTypes.py +0 -0
  57. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/algorithms/__init__.py +0 -0
  58. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/beDRY.py +0 -0
  59. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/filesystemToolkit.py +0 -0
  60. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/py.typed +0 -0
  61. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/__init__.py +0 -0
  62. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/flattened.py +0 -0
  63. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/hunterNumba.py +0 -0
  64. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/irvineJavaPort.py +0 -0
  65. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/jaxCount.py +0 -0
  66. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +0 -0
  67. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/jobsCompleted/__init__.py +0 -0
  68. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/jobsCompleted/p2x19/p2x19.py +0 -0
  69. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/lunnonNumpy.py +0 -0
  70. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/lunnonWhile.py +0 -0
  71. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316JavaPort.py +0 -0
  72. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316imperative.py +0 -0
  73. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -0
  74. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -0
  75. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316primitiveOptimized.py +0 -0
  76. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316redis.py +0 -0
  77. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/A005316write2disk.py +0 -0
  78. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/matrixMeanders64retired.py +0 -0
  79. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -0
  80. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -0
  81. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineV2.py +0 -0
  82. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -0
  83. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/meandersDumpingGround/matrixMeandersSlicePop.py +0 -0
  84. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/rotatedEntryPoint.py +0 -0
  85. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
  86. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
  87. {mapfolding-0.15.4/mapFolding/syntheticModules → mapfolding-0.16.0/mapFolding/syntheticModules/A007822}/__init__.py +0 -0
  88. /mapfolding-0.15.4/mapFolding/syntheticModules/algorithmA007822.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/algorithm.py +0 -0
  89. /mapfolding-0.15.4/mapFolding/syntheticModules/initializeStateA007822.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/initializeState.py +0 -0
  90. /mapfolding-0.15.4/mapFolding/syntheticModules/theorem2A007822.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/theorem2.py +0 -0
  91. /mapfolding-0.15.4/mapFolding/syntheticModules/theorem2A007822Numba.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/theorem2Numba.py +0 -0
  92. /mapfolding-0.15.4/mapFolding/syntheticModules/theorem2A007822Trimmed.py → /mapfolding-0.16.0/mapFolding/syntheticModules/A007822/theorem2Trimmed.py +0 -0
  93. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/countParallelNumba.py +0 -0
  94. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/daoOfMapFoldingNumba.py +0 -0
  95. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/dataPacking.py +0 -0
  96. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/initializeState.py +0 -0
  97. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/theorem2.py +0 -0
  98. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/theorem2Numba.py +0 -0
  99. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/syntheticModules/theorem2Trimmed.py +0 -0
  100. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/__init__.py +0 -0
  101. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/conftest.py +0 -0
  102. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/test_filesystem.py +0 -0
  103. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/test_oeis.py +0 -0
  104. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/test_other.py +0 -0
  105. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding/tests/test_tasks.py +0 -0
  106. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding.egg-info/dependency_links.txt +0 -0
  107. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding.egg-info/entry_points.txt +0 -0
  108. {mapfolding-0.15.4 → mapfolding-0.16.0}/mapFolding.egg-info/top_level.txt +0 -0
  109. {mapfolding-0.15.4 → 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.15.4
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"
@@ -57,8 +57,7 @@ from mapFolding._theTypes import (
57
57
  NumPyElephino as NumPyElephino,
58
58
  NumPyFoldsTotal as NumPyFoldsTotal,
59
59
  NumPyIntegerType as NumPyIntegerType,
60
- NumPyLeavesTotal as NumPyLeavesTotal,
61
- )
60
+ NumPyLeavesTotal as NumPyLeavesTotal)
62
61
 
63
62
  from mapFolding._theSSOT import packageSettings as packageSettings
64
63
 
@@ -68,18 +67,18 @@ from mapFolding.beDRY import (
68
67
  getTaskDivisions as getTaskDivisions,
69
68
  makeDataContainer as makeDataContainer,
70
69
  setProcessorLimit as setProcessorLimit,
71
- validateListDimensions as validateListDimensions,
72
- )
70
+ validateListDimensions as validateListDimensions)
73
71
 
74
- from mapFolding.dataBaskets import MapFoldingState as MapFoldingState
72
+ from mapFolding.dataBaskets import (
73
+ MapFoldingState as MapFoldingState,
74
+ MatrixMeandersState as MatrixMeandersState)
75
75
 
76
76
  from mapFolding.filesystemToolkit import (
77
77
  getFilenameFoldsTotal as getFilenameFoldsTotal,
78
78
  getPathFilenameFoldsTotal as getPathFilenameFoldsTotal,
79
79
  getPathRootJobDEFAULT as getPathRootJobDEFAULT,
80
80
  saveFoldsTotal as saveFoldsTotal,
81
- saveFoldsTotalFAILearly as saveFoldsTotalFAILearly,
82
- )
81
+ saveFoldsTotalFAILearly as saveFoldsTotalFAILearly)
83
82
 
84
83
  from mapFolding.basecamp import countFolds as countFolds
85
84
 
@@ -89,5 +88,4 @@ from mapFolding.oeis import (
89
88
  getFoldsTotalKnown as getFoldsTotalKnown,
90
89
  getOEISids as getOEISids,
91
90
  OEIS_for_n as OEIS_for_n,
92
- oeisIDfor_n as oeisIDfor_n,
93
- )
91
+ oeisIDfor_n as oeisIDfor_n)
@@ -108,6 +108,7 @@ OEISidMeandersManuallySet: dict[str, MetadataOEISidMeandersManuallySet] = {
108
108
  'A060206': {'valuesTestValidation': [*range(3, 9)]},
109
109
  'A077460': {'valuesTestValidation': [*range(3, 8)]},
110
110
  'A078591': {'valuesTestValidation': [*range(3, 10)]},
111
+ 'A178961': {'valuesTestValidation': [*range(3, 11)]},
111
112
  'A223094': {'valuesTestValidation': [*range(3, 11)]},
112
113
  'A259702': {'valuesTestValidation': [*range(3, 13)]},
113
114
  'A301620': {'valuesTestValidation': [*range(3, 11)]},
@@ -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 # noqa: RET504
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