mapFolding 0.14.1__tar.gz → 0.15.1__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 (95) hide show
  1. {mapfolding-0.14.1 → mapfolding-0.15.1}/PKG-INFO +2 -2
  2. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/__init__.py +2 -1
  3. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A000682.py +2 -2
  4. mapfolding-0.15.1/mapFolding/_oeisFormulas/A001010.py +18 -0
  5. mapfolding-0.15.1/mapFolding/_oeisFormulas/Z0Z_aOFn.py +21 -0
  6. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py +7 -0
  7. mapfolding-0.15.1/mapFolding/_oeisFormulas/matrixMeanders.py +126 -0
  8. mapfolding-0.15.1/mapFolding/_oeisFormulas/matrixMeandersAnnex.py +84 -0
  9. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_theSSOT.py +9 -3
  10. mapfolding-0.15.1/mapFolding/_theTypes.py +52 -0
  11. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/basecamp.py +90 -10
  12. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/beDRY.py +5 -21
  13. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/daoOfMapFolding.py +2 -1
  14. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/dataBaskets.py +8 -3
  15. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/oeis.py +10 -16
  16. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316optimized128bit.py +19 -19
  17. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316primitiveOptimized.py +25 -25
  18. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316redis.py +19 -19
  19. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316write2disk.py +19 -19
  20. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/jaxCount.py +1 -1
  21. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/matrixMeandersBaseline.py +20 -20
  22. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/matrixMeandersBaselineAnnex.py +4 -4
  23. mapfolding-0.15.1/mapFolding/reference/matrixMeandersSimpleQueue.py +90 -0
  24. mapfolding-0.15.1/mapFolding/reference/matrixMeandersSlicePop.py +104 -0
  25. mapfolding-0.15.1/mapFolding/someAssemblyRequired/A007822rawMaterials.py +46 -0
  26. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/_toolkitContainers.py +1 -1
  27. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/makeAllModules.py +192 -199
  28. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +3 -3
  29. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +3 -3
  30. mapfolding-0.15.1/mapFolding/syntheticModules/algorithmA007822.py +166 -0
  31. mapfolding-0.15.1/mapFolding/syntheticModules/algorithmA007822Numba.py +95 -0
  32. mapfolding-0.14.1/mapFolding/syntheticModules/countParallel.py → mapfolding-0.15.1/mapFolding/syntheticModules/countParallelNumba.py +5 -4
  33. mapfolding-0.14.1/mapFolding/syntheticModules/daoOfMapFolding.py → mapfolding-0.15.1/mapFolding/syntheticModules/daoOfMapFoldingNumba.py +5 -4
  34. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/syntheticModules/dataPacking.py +4 -3
  35. mapfolding-0.14.1/mapFolding/syntheticModules/initializeCount.py → mapfolding-0.15.1/mapFolding/syntheticModules/initializeState.py +1 -1
  36. mapfolding-0.15.1/mapFolding/syntheticModules/initializeStateA007822.py +69 -0
  37. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/syntheticModules/theorem2.py +2 -1
  38. mapfolding-0.15.1/mapFolding/syntheticModules/theorem2A007822.py +70 -0
  39. mapfolding-0.15.1/mapFolding/syntheticModules/theorem2A007822Numba.py +67 -0
  40. mapfolding-0.15.1/mapFolding/syntheticModules/theorem2A007822Trimmed.py +64 -0
  41. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/syntheticModules/theorem2Numba.py +6 -4
  42. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/syntheticModules/theorem2Trimmed.py +2 -1
  43. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/test_computations.py +29 -4
  44. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding.egg-info/PKG-INFO +2 -2
  45. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding.egg-info/SOURCES.txt +13 -3
  46. {mapfolding-0.14.1 → mapfolding-0.15.1}/pyproject.toml +3 -1
  47. mapfolding-0.14.1/mapFolding/_oeisFormulas/Z0Z_aOFn.py +0 -18
  48. mapfolding-0.14.1/mapFolding/_oeisFormulas/matrixMeanders.py +0 -79
  49. mapfolding-0.14.1/mapFolding/_oeisFormulas/matrixMeandersAnnex.py +0 -84
  50. mapfolding-0.14.1/mapFolding/_theTypes.py +0 -148
  51. {mapfolding-0.14.1 → mapfolding-0.15.1}/LICENSE +0 -0
  52. {mapfolding-0.14.1 → mapfolding-0.15.1}/README.md +0 -0
  53. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A000136.py +0 -0
  54. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A000560.py +0 -0
  55. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A005315.py +0 -0
  56. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A005316.py +0 -0
  57. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A223094.py +0 -0
  58. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A259702.py +0 -0
  59. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/A301620.py +0 -0
  60. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/_oeisFormulas/__init__.py +0 -0
  61. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/filesystemToolkit.py +0 -0
  62. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/py.typed +0 -0
  63. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316JavaPort.py +0 -0
  64. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316imperative.py +0 -0
  65. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/A005316intOptimized.py +0 -0
  66. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/__init__.py +0 -0
  67. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/flattened.py +0 -0
  68. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/hunterNumba.py +0 -0
  69. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/irvineJavaPort.py +0 -0
  70. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +0 -0
  71. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/jobsCompleted/__init__.py +0 -0
  72. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/jobsCompleted/p2x19/p2x19.py +0 -0
  73. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/lunnonNumpy.py +0 -0
  74. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/lunnonWhile.py +0 -0
  75. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/rotatedEntryPoint.py +1 -1
  76. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
  77. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/RecipeJob.py +0 -0
  78. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/__init__.py +0 -0
  79. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/_toolIfThis.py +0 -0
  80. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
  81. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/infoBooth.py +0 -0
  82. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/toolkitNumba.py +0 -0
  83. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/someAssemblyRequired/transformationTools.py +0 -0
  84. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/syntheticModules/__init__.py +0 -0
  85. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/__init__.py +0 -0
  86. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/conftest.py +0 -0
  87. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/test_filesystem.py +0 -0
  88. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/test_oeis.py +0 -0
  89. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/test_other.py +0 -0
  90. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding/tests/test_tasks.py +0 -0
  91. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding.egg-info/dependency_links.txt +0 -0
  92. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding.egg-info/entry_points.txt +0 -0
  93. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding.egg-info/requires.txt +0 -0
  94. {mapfolding-0.14.1 → mapfolding-0.15.1}/mapFolding.egg-info/top_level.txt +0 -0
  95. {mapfolding-0.14.1 → mapfolding-0.15.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapFolding
3
- Version: 0.14.1
3
+ Version: 0.15.1
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,A001415,A001416,A001417,A001418,A005315,A005316,A195646,A223094,A259702,A301620,abstract syntax tree,algorithmic combinatorics,algorithmic optimization,arch configurations,AST manipulation,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,GPU acceleration,high-performance computing,integer sequences,JIT compilation,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,Numba optimization,numerical algorithms,numerical computation,OEIS,open meandric systems,paper folding mathematics,parallel computing,pattern recognition,performance optimization,permutation patterns,permutations,post-setup optimization,pyproject,Python optimization,scientific computing,semi-meanders,sequence analysis,sequence calculator,sequence enumeration,sequence explorer,sequence generation,source code analysis,stamp folding,symbolic computation,topological combinatorics,topological patterns,typed Python
11
+ Keywords: A000136,A000560,A000682,A001415,A001416,A001417,A001418,A005315,A005316,A007822,A195646,A223094,A259702,A301620,abstract syntax tree,algorithmic combinatorics,algorithmic optimization,arch configurations,AST manipulation,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,GPU acceleration,high-performance computing,integer sequences,JIT compilation,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,Numba optimization,numerical algorithms,numerical computation,OEIS,open meandric systems,paper folding mathematics,parallel computing,pattern recognition,performance optimization,permutation patterns,permutations,post-setup optimization,pyproject,Python optimization,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
@@ -46,7 +46,7 @@ from mapFolding._theTypes import (
46
46
  Array1DElephino as Array1DElephino,
47
47
  Array1DFoldsTotal as Array1DFoldsTotal,
48
48
  Array1DLeavesTotal as Array1DLeavesTotal,
49
- Array3D as Array3D,
49
+ Array3DLeavesTotal as Array3DLeavesTotal,
50
50
  DatatypeElephino as DatatypeElephino,
51
51
  DatatypeFoldsTotal as DatatypeFoldsTotal,
52
52
  DatatypeLeavesTotal as DatatypeLeavesTotal,
@@ -85,4 +85,5 @@ from mapFolding.oeis import (
85
85
  getOEISids as getOEISids,
86
86
  OEIS_for_n as OEIS_for_n,
87
87
  oeisIDfor_n as oeisIDfor_n,
88
+ dictionaryOEIS as dictionaryOEIS,
88
89
  )
@@ -1,7 +1,7 @@
1
- from mapFolding._oeisFormulas.matrixMeanders import count, curveMaximum
1
+ from mapFolding._oeisFormulas.matrixMeanders import count
2
2
 
3
3
  def initializeA000682(n: int) -> dict[int, int]:
4
- curveLocationsMAXIMUM = curveMaximum[n].curveLocationsMAXIMUM
4
+ curveLocationsMAXIMUM = 1 << (2 * n + 4)
5
5
 
6
6
  curveSeed: int = 5 - (n & 0b1) * 4
7
7
  listCurveLocations = [(curveSeed << 1) | curveSeed]
@@ -0,0 +1,18 @@
1
+ from mapFolding._oeisFormulas.A000682 import A000682
2
+ from mapFolding.oeis import oeisIDfor_n
3
+
4
+ def A001010(Z0Z_n: int) -> tuple[int, int]:
5
+ """Complicated.
6
+
7
+ a(2n+1) = 2*A007822(n)
8
+ a(2n) = 2*A000682(n+2)
9
+ """
10
+ if Z0Z_n & 0b1:
11
+ foldsTotal = 2 * oeisIDfor_n('A007822', Z0Z_n)
12
+ A001010n = 2 * Z0Z_n + 1
13
+ else:
14
+ foldsTotal = 2 * A000682(Z0Z_n + 2)
15
+ A001010n = 2 * Z0Z_n
16
+
17
+ return (A001010n, foldsTotal)
18
+
@@ -0,0 +1,21 @@
1
+ from mapFolding._oeisFormulas.A000136 import A000136
2
+ from mapFolding._oeisFormulas.A000682 import A000682
3
+ from mapFolding._oeisFormulas.Z0Z_oeisMeanders import dictionaryOEISMeanders
4
+ from mapFolding.oeis import dictionaryOEIS
5
+ import sys
6
+ import time
7
+
8
+ # ruff: noqa: ERA001
9
+
10
+ if __name__ == '__main__':
11
+ oeisID = 'A000136'
12
+ oeisID = 'A000682'
13
+ for n in range(3, 13):
14
+
15
+ # sys.stdout.write(f"{n = }\n")
16
+
17
+ timeStart = time.perf_counter()
18
+ foldsTotal = eval(oeisID)(n)
19
+ # sys.stdout.write(f"{n} {foldsTotal} {time.perf_counter() - timeStart:.2f}\n")
20
+ sys.stdout.write(f"{foldsTotal == dictionaryOEISMeanders[oeisID]['valuesKnown'][n]} {n} {foldsTotal} {time.perf_counter() - timeStart:.2f}\n") # pyright: ignore[reportIndexIssue]
21
+
@@ -1,5 +1,6 @@
1
1
  from mapFolding._oeisFormulas.A000560 import A000560
2
2
  from mapFolding._oeisFormulas.A000682 import A000682
3
+ from mapFolding._oeisFormulas.A001010 import A001010
3
4
  from mapFolding._oeisFormulas.A005315 import A005315
4
5
  from mapFolding._oeisFormulas.A005316 import A005316
5
6
  from mapFolding._oeisFormulas.A223094 import A223094
@@ -8,9 +9,13 @@ from mapFolding._oeisFormulas.A301620 import A301620
8
9
  from mapFolding.oeis import getOEISidInformation, getOEISidValues
9
10
  import sys
10
11
 
12
+ 'A001011'
13
+ # a(n) = (A001010(n) + A000136(n)) / 4
14
+
11
15
  oeisIDsMeanders: list[str] = [
12
16
  'A000560',
13
17
  'A000682',
18
+ 'A001010',
14
19
  'A005315',
15
20
  'A005316',
16
21
  'A223094',
@@ -39,6 +44,8 @@ if __name__ == '__main__':
39
44
  assert A000560for_n == dictionaryOEISMeanders['A000560']['valuesKnown'][n]
40
45
  A000682for_n = A000682(n)
41
46
  assert A000682for_n == dictionaryOEISMeanders['A000682']['valuesKnown'][n]
47
+ nComputed, foldsTotal = A001010(n)
48
+ assert foldsTotal == dictionaryOEISMeanders['A001010']['valuesKnown'][nComputed]
42
49
  A005315for_n = A005315(n)
43
50
  assert A005315for_n == dictionaryOEISMeanders['A005315']['valuesKnown'][n]
44
51
  A005316for_n = A005316(n)
@@ -0,0 +1,126 @@
1
+ def count(bridges: int, startingCurveLocations: dict[int, int]) -> int:
2
+ listCurveMaximums: list[tuple[int, int, int]] = [
3
+ (0x15, 0x2a, 0x10),
4
+ (0x55, 0xaa, 0x40),
5
+ (0x155, 0x2aa, 0x100),
6
+ (0x555, 0xaaa, 0x400),
7
+ (0x1555, 0x2aaa, 0x1000),
8
+ (0x5555, 0xaaaa, 0x4000),
9
+ (0x15555, 0x2aaaa, 0x10000),
10
+ (0x55555, 0xaaaaa, 0x40000),
11
+ (0x155555, 0x2aaaaa, 0x100000),
12
+ (0x555555, 0xaaaaaa, 0x400000),
13
+ (0x1555555, 0x2aaaaaa, 0x1000000),
14
+ (0x5555555, 0xaaaaaaa, 0x4000000),
15
+ (0x15555555, 0x2aaaaaaa, 0x10000000),
16
+ (0x55555555, 0xaaaaaaaa, 0x40000000),
17
+ (0x155555555, 0x2aaaaaaaa, 0x100000000),
18
+ (0x555555555, 0xaaaaaaaaa, 0x400000000),
19
+ (0x1555555555, 0x2aaaaaaaaa, 0x1000000000),
20
+ (0x5555555555, 0xaaaaaaaaaa, 0x4000000000),
21
+ (0x15555555555, 0x2aaaaaaaaaa, 0x10000000000),
22
+ (0x55555555555, 0xaaaaaaaaaaa, 0x40000000000),
23
+ (0x155555555555, 0x2aaaaaaaaaaa, 0x100000000000),
24
+ (0x555555555555, 0xaaaaaaaaaaaa, 0x400000000000),
25
+ (0x1555555555555, 0x2aaaaaaaaaaaa, 0x1000000000000),
26
+ (0x5555555555555, 0xaaaaaaaaaaaaa, 0x4000000000000),
27
+ (0x15555555555555, 0x2aaaaaaaaaaaaa, 0x10000000000000),
28
+ (0x55555555555555, 0xaaaaaaaaaaaaaa, 0x40000000000000),
29
+ (0x155555555555555, 0x2aaaaaaaaaaaaaa, 0x100000000000000),
30
+ (0x555555555555555, 0xaaaaaaaaaaaaaaa, 0x400000000000000),
31
+ (0x1555555555555555, 0x2aaaaaaaaaaaaaaa, 0x1000000000000000),
32
+ (0x5555555555555555, 0xaaaaaaaaaaaaaaaa, 0x4000000000000000),
33
+ (0x15555555555555555, 0x2aaaaaaaaaaaaaaaa, 0x10000000000000000),
34
+ (0x55555555555555555, 0xaaaaaaaaaaaaaaaaa, 0x40000000000000000),
35
+ (0x155555555555555555, 0x2aaaaaaaaaaaaaaaaa, 0x100000000000000000),
36
+ (0x555555555555555555, 0xaaaaaaaaaaaaaaaaaa, 0x400000000000000000),
37
+ (0x1555555555555555555, 0x2aaaaaaaaaaaaaaaaaa, 0x1000000000000000000),
38
+ (0x5555555555555555555, 0xaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000),
39
+ (0x15555555555555555555, 0x2aaaaaaaaaaaaaaaaaaa, 0x10000000000000000000),
40
+ (0x55555555555555555555, 0xaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000),
41
+ (0x155555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000),
42
+ (0x555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000),
43
+ (0x1555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000),
44
+ (0x5555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000),
45
+ (0x15555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000),
46
+ (0x55555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000),
47
+ (0x155555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000000),
48
+ (0x555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000000),
49
+ (0x1555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000000),
50
+ (0x5555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000000),
51
+ (0x15555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000000),
52
+ (0x55555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000000),
53
+ (0x155555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000000000),
54
+ (0x555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000000000),
55
+ (0x1555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000000000),
56
+ (0x5555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000000000),
57
+ (0x15555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000000000),
58
+ (0x55555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000000000),
59
+ (0x155555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000000000000),
60
+ (0x555555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000000000000),
61
+ (0x1555555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000000000000),
62
+ (0x5555555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000000000000),
63
+ (0x15555555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000000000000),
64
+ (0x55555555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000000000000),
65
+ ]
66
+ listCurveMaximums = listCurveMaximums[0:bridges]
67
+
68
+ dictionaryCurveLocations: dict[int, int] = {}
69
+ while bridges > 0:
70
+ bridges -= 1
71
+
72
+ bifurcationAlphaLocator, bifurcationZuluLocator, curveLocationsMAXIMUM = listCurveMaximums[bridges]
73
+ for curveLocations, distinctCrossings in startingCurveLocations.items():
74
+ bifurcationAlpha = (curveLocations & bifurcationAlphaLocator)
75
+ bifurcationZulu = (curveLocations & bifurcationZuluLocator) >> 1
76
+
77
+ bifurcationAlphaHasCurves = bifurcationAlpha != 1
78
+ bifurcationZuluHasCurves = bifurcationZulu != 1
79
+
80
+ # Curve location analysis
81
+ curveLocationAnalysis = ((bifurcationAlpha | (bifurcationZulu << 1)) << 2) | 3
82
+ if curveLocationAnalysis < curveLocationsMAXIMUM:
83
+ dictionaryCurveLocations[curveLocationAnalysis] = dictionaryCurveLocations.get(curveLocationAnalysis, 0) + distinctCrossings
84
+
85
+ # Curve location analysis, conditional
86
+ if bifurcationZuluHasCurves:
87
+ curveLocationAnalysis = (bifurcationZulu >> 1) | (bifurcationAlpha << 2) | (bifurcationZuluIsEven := not (bifurcationZulu & 1))
88
+ if curveLocationAnalysis < curveLocationsMAXIMUM:
89
+ dictionaryCurveLocations[curveLocationAnalysis] = dictionaryCurveLocations.get(curveLocationAnalysis, 0) + distinctCrossings
90
+
91
+ # Curve location analysis, conditional
92
+ if bifurcationAlphaHasCurves:
93
+ curveLocationAnalysis = (bifurcationAlphaShiftRight2 := bifurcationAlpha >> 2) | (bifurcationZulu << 3) | ((bifurcationAlphaIsEven := 1 - (bifurcationAlpha & 0b1)) << 1)
94
+ if curveLocationAnalysis < curveLocationsMAXIMUM:
95
+ dictionaryCurveLocations[curveLocationAnalysis] = dictionaryCurveLocations.get(curveLocationAnalysis, 0) + distinctCrossings
96
+
97
+ # Curve location analysis, uber-conditional
98
+ if bifurcationZuluHasCurves and bifurcationAlphaHasCurves:
99
+ # One Truth-check to select a code path
100
+ finalZeroCombination = (bifurcationZuluIsEven << 1) | bifurcationAlphaIsEven # pyright: ignore[reportPossiblyUnboundVariable]
101
+
102
+ if finalZeroCombination != 0: # Case 0 (False, False)
103
+ XOrHere2makePair = 0b1
104
+ findUnpairedBinary1 = 0
105
+
106
+ if finalZeroCombination == 1: # Case 1: (False, True)
107
+ while findUnpairedBinary1 >= 0:
108
+ XOrHere2makePair <<= 2
109
+ findUnpairedBinary1 += 1 if (bifurcationAlpha & XOrHere2makePair) == 0 else -1
110
+ bifurcationAlphaShiftRight2 = (bifurcationAlpha ^ XOrHere2makePair) >> 2
111
+ elif finalZeroCombination == 2: # Case 2: (True, False)
112
+ while findUnpairedBinary1 >= 0:
113
+ XOrHere2makePair <<= 2
114
+ findUnpairedBinary1 += 1 if (bifurcationZulu & XOrHere2makePair) == 0 else -1
115
+ bifurcationZulu ^= XOrHere2makePair
116
+
117
+ # Cases 1, 2, and 3 all compute curveLocationAnalysis
118
+ # TODO https://github.com/hunterhogan/mapFolding/issues/19
119
+ curveLocationAnalysis = ((bifurcationZulu >> 2) << 1) | bifurcationAlphaShiftRight2 # pyright: ignore[reportPossiblyUnboundVariable]
120
+ if curveLocationAnalysis < curveLocationsMAXIMUM:
121
+ dictionaryCurveLocations[curveLocationAnalysis] = dictionaryCurveLocations.get(curveLocationAnalysis, 0) + distinctCrossings
122
+
123
+ startingCurveLocations = dictionaryCurveLocations.copy()
124
+ dictionaryCurveLocations = {}
125
+
126
+ return sum(startingCurveLocations.values())
@@ -0,0 +1,84 @@
1
+ from typing import NamedTuple
2
+ import sys
3
+
4
+ class limitLocators(NamedTuple):
5
+ bifurcationAlphaLocator: int
6
+ bifurcationZuluLocator: int
7
+ curveLocationsMAXIMUM: int
8
+
9
+ curveMaximum: dict[int, limitLocators] = {
10
+ 0: limitLocators(0x15, 0x2a, 0x10),
11
+ 1: limitLocators(0x55, 0xaa, 0x40),
12
+ 2: limitLocators(0x155, 0x2aa, 0x100),
13
+ 3: limitLocators(0x555, 0xaaa, 0x400),
14
+ 4: limitLocators(0x1555, 0x2aaa, 0x1000),
15
+ 5: limitLocators(0x5555, 0xaaaa, 0x4000),
16
+ 6: limitLocators(0x15555, 0x2aaaa, 0x10000),
17
+ 7: limitLocators(0x55555, 0xaaaaa, 0x40000),
18
+ 8: limitLocators(0x155555, 0x2aaaaa, 0x100000),
19
+ 9: limitLocators(0x555555, 0xaaaaaa, 0x400000),
20
+ 10: limitLocators(0x1555555, 0x2aaaaaa, 0x1000000),
21
+ 11: limitLocators(0x5555555, 0xaaaaaaa, 0x4000000),
22
+ 12: limitLocators(0x15555555, 0x2aaaaaaa, 0x10000000),
23
+ 13: limitLocators(0x55555555, 0xaaaaaaaa, 0x40000000),
24
+ 14: limitLocators(0x155555555, 0x2aaaaaaaa, 0x100000000),
25
+ 15: limitLocators(0x555555555, 0xaaaaaaaaa, 0x400000000),
26
+ 16: limitLocators(0x1555555555, 0x2aaaaaaaaa, 0x1000000000),
27
+ 17: limitLocators(0x5555555555, 0xaaaaaaaaaa, 0x4000000000),
28
+ 18: limitLocators(0x15555555555, 0x2aaaaaaaaaa, 0x10000000000),
29
+ 19: limitLocators(0x55555555555, 0xaaaaaaaaaaa, 0x40000000000),
30
+ 20: limitLocators(0x155555555555, 0x2aaaaaaaaaaa, 0x100000000000),
31
+ 21: limitLocators(0x555555555555, 0xaaaaaaaaaaaa, 0x400000000000),
32
+ 22: limitLocators(0x1555555555555, 0x2aaaaaaaaaaaa, 0x1000000000000),
33
+ 23: limitLocators(0x5555555555555, 0xaaaaaaaaaaaaa, 0x4000000000000),
34
+ 24: limitLocators(0x15555555555555, 0x2aaaaaaaaaaaaa, 0x10000000000000),
35
+ 25: limitLocators(0x55555555555555, 0xaaaaaaaaaaaaaa, 0x40000000000000),
36
+ 26: limitLocators(0x155555555555555, 0x2aaaaaaaaaaaaaa, 0x100000000000000),
37
+ 27: limitLocators(0x555555555555555, 0xaaaaaaaaaaaaaaa, 0x400000000000000),
38
+ 28: limitLocators(0x1555555555555555, 0x2aaaaaaaaaaaaaaa, 0x1000000000000000), # 0x2aaaaaaaaaaaaaaa.bit_length() = 62
39
+ 29: limitLocators(0x5555555555555555, 0xaaaaaaaaaaaaaaaa, 0x4000000000000000),
40
+ 30: limitLocators(0x15555555555555555, 0x2aaaaaaaaaaaaaaaa, 0x10000000000000000),
41
+ 31: limitLocators(0x55555555555555555, 0xaaaaaaaaaaaaaaaaa, 0x40000000000000000),
42
+ 32: limitLocators(0x155555555555555555, 0x2aaaaaaaaaaaaaaaaa, 0x100000000000000000),
43
+ 33: limitLocators(0x555555555555555555, 0xaaaaaaaaaaaaaaaaaa, 0x400000000000000000),
44
+ 34: limitLocators(0x1555555555555555555, 0x2aaaaaaaaaaaaaaaaaa, 0x1000000000000000000),
45
+ 35: limitLocators(0x5555555555555555555, 0xaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000),
46
+ 36: limitLocators(0x15555555555555555555, 0x2aaaaaaaaaaaaaaaaaaa, 0x10000000000000000000),
47
+ 37: limitLocators(0x55555555555555555555, 0xaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000),
48
+ 38: limitLocators(0x155555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000),
49
+ 39: limitLocators(0x555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000),
50
+ 40: limitLocators(0x1555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000),
51
+ 41: limitLocators(0x5555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000),
52
+ 42: limitLocators(0x15555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000),
53
+ 43: limitLocators(0x55555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000),
54
+ 44: limitLocators(0x155555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000000),
55
+ 45: limitLocators(0x555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000000),
56
+ 46: limitLocators(0x1555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000000),
57
+ 47: limitLocators(0x5555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000000),
58
+ 48: limitLocators(0x15555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000000),
59
+ 49: limitLocators(0x55555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000000),
60
+ 50: limitLocators(0x155555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000000000),
61
+ 51: limitLocators(0x555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000000000),
62
+ 52: limitLocators(0x1555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000000000),
63
+ 53: limitLocators(0x5555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000000000),
64
+ 54: limitLocators(0x15555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000000000),
65
+ 55: limitLocators(0x55555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000000000),
66
+ 56: limitLocators(0x155555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x100000000000000000000000000000),
67
+ 57: limitLocators(0x555555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x400000000000000000000000000000),
68
+ 58: limitLocators(0x1555555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x1000000000000000000000000000000),
69
+ 59: limitLocators(0x5555555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x4000000000000000000000000000000),
70
+ 60: limitLocators(0x15555555555555555555555555555555, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x10000000000000000000000000000000),
71
+ 61: limitLocators(0x55555555555555555555555555555555, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x40000000000000000000000000000000),
72
+ }
73
+
74
+ def makeCurveMaximum() -> None:
75
+ sys.stdout.write("curveMaximum: dict[int, limitLocators] = {\n")
76
+ for n in range(62):
77
+ curveLocationsMAXIMUM = 1 << (2 * n + 4)
78
+ bifurcationAlphaLocator = int('01' * ((curveLocationsMAXIMUM.bit_length() + 1) // 2), 2)
79
+ sys.stdout.write(f"{n}: limitLocators({hex(bifurcationAlphaLocator)}, {hex(bifurcationAlphaLocator << 1)}, {hex(curveLocationsMAXIMUM)}),\n")
80
+ sys.stdout.write("}\n")
81
+
82
+ if __name__ == '__main__':
83
+ makeCurveMaximum()
84
+
@@ -76,19 +76,19 @@ concurrencyPackage = concurrencyPackageHARDCODED
76
76
  # TODO I made a `TypedDict` before I knew how to make dataclasses and classes. Think about other data structures.
77
77
  settingsOEISManuallySelected: dict[str, MetadataOEISidManuallySet] = {
78
78
  'A000136': {
79
- 'getMapShape': lambda n: tuple(sorted([1, n])),
79
+ 'getMapShape': lambda n: (1, n),
80
80
  'valuesBenchmark': [14],
81
81
  'valuesTestParallelization': [*range(3, 7)],
82
82
  'valuesTestValidation': [random.randint(2, 9)], # noqa: S311
83
83
  },
84
84
  'A001415': {
85
- 'getMapShape': lambda n: tuple(sorted([2, n])),
85
+ 'getMapShape': lambda n: (2, n),
86
86
  'valuesBenchmark': [14],
87
87
  'valuesTestParallelization': [*range(3, 7)],
88
88
  'valuesTestValidation': [random.randint(2, 9)], # noqa: S311
89
89
  },
90
90
  'A001416': {
91
- 'getMapShape': lambda n: tuple(sorted([3, n])),
91
+ 'getMapShape': lambda n: (3, n),
92
92
  'valuesBenchmark': [9],
93
93
  'valuesTestParallelization': [*range(3, 5)],
94
94
  'valuesTestValidation': [random.randint(2, 6)], # noqa: S311
@@ -111,6 +111,12 @@ settingsOEISManuallySelected: dict[str, MetadataOEISidManuallySet] = {
111
111
  'valuesTestParallelization': [*range(2, 4)],
112
112
  'valuesTestValidation': [random.randint(2, 4)], # noqa: S311
113
113
  },
114
+ 'A007822': {
115
+ 'getMapShape': lambda n: (1, 2 * n),
116
+ 'valuesBenchmark': [7],
117
+ 'valuesTestParallelization': [*range(2, 4)],
118
+ 'valuesTestValidation': [random.randint(2, 4)], # noqa: S311
119
+ },
114
120
  }
115
121
 
116
122
  packageSettings = mapFoldingPackageSettings(
@@ -0,0 +1,52 @@
1
+ """Types for defensive coding and for computation optimization."""
2
+
3
+ from numpy import dtype, int_ as numpy_int, integer, ndarray, uint64 as numpy_uint64
4
+ from typing import Any, TypeAlias, TypeVar
5
+
6
+ NumPyIntegerType = TypeVar('NumPyIntegerType', bound=integer[Any], covariant=True)
7
+ """Any NumPy integer type, which is usually between 8-bit signed and 64-bit unsigned."""
8
+
9
+ DatatypeLeavesTotal: TypeAlias = int # 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.
10
+ """Use on unsigned integers that will never exceed the magnitude of `leavesTotal`."""
11
+
12
+ NumPyLeavesTotal: TypeAlias = numpy_int # 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.
13
+ """Use in NumPy data structures whose elements are unsigned integers that will never exceed the magnitude of `leavesTotal`."""
14
+
15
+ DatatypeElephino: TypeAlias = int # 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.
16
+ """Use on unsigned integers that will exceed the magnitude of `leavesTotal` but that are not "colossal."
17
+
18
+ Note well
19
+ ---------
20
+ Colossal values are found with the cross humpy inequality:
21
+
22
+ ⎡ el ⎤ ⎡ ⎤
23
+ ⎢ eph ⎥ X ⎢ rhi ⎥ <= elephino
24
+ ⎣ ant ⎦ ⎣ no ⎦
25
+
26
+ """
27
+
28
+ NumPyElephino: TypeAlias = numpy_int # 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.
29
+ """Use in NumPy data structures whose elements are unsigned integers that might exceed the magnitude of `leavesTotal` but that are not 'colossal.'"""
30
+
31
+ DatatypeFoldsTotal: TypeAlias = int # 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.
32
+ """Use on unsigned integers that might have colossal magnitudes similar to `foldsTotal`."""
33
+
34
+ NumPyFoldsTotal: TypeAlias = numpy_uint64 # 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.
35
+ """Use in NumPy data structures whose elements are unsigned integers that might have colossal magnitudes similar to `foldsTotal`.
36
+
37
+ Note well
38
+ ---------
39
+ If your elements might exceed 1.8 x 10^19, then you should take extra steps to ensure the integrity of the data in NumPy or use a
40
+ different data structure."""
41
+
42
+ 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.
43
+ """A `numpy.ndarray` with three axes and elements of type `NumPyLeavesTotal`."""
44
+
45
+ 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.
46
+ """A `numpy.ndarray` with one axis and elements of type `NumPyLeavesTotal`."""
47
+
48
+ Array1DElephino: TypeAlias = ndarray[tuple[int], dtype[NumPyElephino]] # 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.
49
+ """A `numpy.ndarray` with one axis and elements of type `NumPyElephino`."""
50
+
51
+ 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
+ """A `numpy.ndarray` with one axis and elements of type `NumPyFoldsTotal`."""
@@ -31,7 +31,7 @@ from os import PathLike
31
31
  from pathlib import PurePath
32
32
  import contextlib
33
33
 
34
- def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR0912, PLR0915
34
+ def countFolds(listDimensions: Sequence[int] | None = None
35
35
  , pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None
36
36
  , computationDivisions: int | str | None = None
37
37
  # , * # TODO improve `standardizedEqualToCallableReturn` so it will work with keyword arguments
@@ -134,7 +134,79 @@ def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR091
134
134
 
135
135
  # Flow control until I can figure out a good way ---------------------------------
136
136
 
137
- if flow == 'daoOfMapFolding':
137
+ # A007822 flow control until I can figure out a good way ---------------------------------
138
+ if oeisID == 'A007822':
139
+ """Temporary notes.
140
+
141
+ The REAL motivation for integrating into basecamp is to integrate into the test modules. No, wait: to stop having to work
142
+ around the test modules.
143
+
144
+ I put `if oeisID == 'A007822'` in the `elif flow ==` cascade, before the `flow` checks because I want to remove A007822
145
+ from those flow paths. It is fundamentally incompatible and it will cause `Exception` or incorrect computations.
146
+
147
+ To use A007822, oeisID is mandatory.
148
+
149
+ Parameters:
150
+ listDimensions should work. mapShape should work. oeis_n should work. `pathLikeWriteFoldsTotal` should work!!! I
151
+ didn't think about that, and I like it.
152
+
153
+ Parallel version:
154
+ idk. The computation division logic will try to execute. As of 2025 Aug 6 at 7 PM, I haven't tried or thought about a
155
+ parallel version. TODO Watch out for errors.
156
+
157
+ `flow`:
158
+ It looks like I will need to make decisions tree just for A007822. That's probably not a big deal since all of the
159
+ possible routes are predictable.
160
+
161
+ """
162
+ match flow:
163
+ case 'numba':
164
+ from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
165
+ mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
166
+
167
+ from mapFolding.syntheticModules.algorithmA007822Numba import doTheNeedful # noqa: PLC0415
168
+ mapFoldingState = doTheNeedful(mapFoldingState)
169
+
170
+ case 'theorem2':
171
+ from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
172
+ mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
173
+
174
+ from mapFolding.syntheticModules.initializeStateA007822 import transitionOnGroupsOfFolds # noqa: PLC0415
175
+ mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
176
+
177
+ from mapFolding.syntheticModules.theorem2A007822 import count # noqa: PLC0415
178
+ mapFoldingState = count(mapFoldingState)
179
+
180
+ case 'theorem2Numba':
181
+ from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
182
+ mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
183
+
184
+ from mapFolding.syntheticModules.initializeStateA007822 import transitionOnGroupsOfFolds # noqa: PLC0415
185
+ mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
186
+
187
+ from mapFolding.syntheticModules.theorem2A007822Numba import count # noqa: PLC0415
188
+ mapFoldingState = count(mapFoldingState)
189
+
190
+ case 'theorem2Trimmed':
191
+ from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
192
+ mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
193
+
194
+ from mapFolding.syntheticModules.initializeStateA007822 import transitionOnGroupsOfFolds # noqa: PLC0415
195
+ mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
196
+
197
+ from mapFolding.syntheticModules.theorem2A007822Trimmed import count # noqa: PLC0415
198
+ mapFoldingState = count(mapFoldingState)
199
+
200
+ case _:
201
+ from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
202
+ mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
203
+
204
+ from mapFolding.syntheticModules.algorithmA007822 import doTheNeedful # noqa: PLC0415
205
+ mapFoldingState = doTheNeedful(mapFoldingState)
206
+
207
+ foldsTotal = mapFoldingState.groupsOfFolds
208
+
209
+ elif flow == 'daoOfMapFolding':
138
210
  from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
139
211
  mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
140
212
 
@@ -142,12 +214,20 @@ def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR091
142
214
  mapFoldingState = doTheNeedful(mapFoldingState)
143
215
  foldsTotal = mapFoldingState.foldsTotal
144
216
 
217
+ elif flow == 'numba':
218
+ from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
219
+ mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
220
+
221
+ from mapFolding.syntheticModules.daoOfMapFoldingNumba import doTheNeedful # noqa: PLC0415
222
+ mapFoldingState = doTheNeedful(mapFoldingState)
223
+ foldsTotal = mapFoldingState.foldsTotal
224
+
145
225
  elif flow == 'theorem2' and any(dimension > 2 for dimension in mapShape):
146
226
  from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
147
227
  mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
148
228
 
149
- from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds # noqa: PLC0415
150
- mapFoldingState = initializeGroupsOfFolds(mapFoldingState)
229
+ from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds # noqa: PLC0415
230
+ mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
151
231
 
152
232
  from mapFolding.syntheticModules.theorem2 import count # noqa: PLC0415
153
233
  mapFoldingState = count(mapFoldingState)
@@ -158,8 +238,8 @@ def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR091
158
238
  from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
159
239
  mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
160
240
 
161
- from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds # noqa: PLC0415
162
- mapFoldingState = initializeGroupsOfFolds(mapFoldingState)
241
+ from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds # noqa: PLC0415
242
+ mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
163
243
 
164
244
  from mapFolding.syntheticModules.theorem2Trimmed import count # noqa: PLC0415
165
245
  mapFoldingState = count(mapFoldingState)
@@ -170,8 +250,8 @@ def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR091
170
250
  from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
171
251
  mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
172
252
 
173
- from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds # noqa: PLC0415
174
- mapFoldingState = initializeGroupsOfFolds(mapFoldingState)
253
+ from mapFolding.syntheticModules.initializeState import transitionOnGroupsOfFolds # noqa: PLC0415
254
+ mapFoldingState = transitionOnGroupsOfFolds(mapFoldingState)
175
255
 
176
256
  from mapFolding.syntheticModules.dataPacking import sequential # noqa: PLC0415
177
257
  mapFoldingState = sequential(mapFoldingState)
@@ -182,7 +262,7 @@ def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR091
182
262
  from mapFolding.dataBaskets import ParallelMapFoldingState # noqa: PLC0415
183
263
  parallelMapFoldingState: ParallelMapFoldingState = ParallelMapFoldingState(mapShape, taskDivisions=taskDivisions)
184
264
 
185
- from mapFolding.syntheticModules.countParallel import doTheNeedful # noqa: PLC0415
265
+ from mapFolding.syntheticModules.countParallelNumba import doTheNeedful # noqa: PLC0415
186
266
 
187
267
  # `listStatesParallel` exists in case you want to research the parallel computation.
188
268
  foldsTotal, listStatesParallel = doTheNeedful(parallelMapFoldingState, concurrencyLimit) # pyright: ignore[reportUnusedVariable]
@@ -191,7 +271,7 @@ def countFolds(listDimensions: Sequence[int] | None = None # noqa: C901, PLR091
191
271
  from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
192
272
  mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
193
273
 
194
- from mapFolding.syntheticModules.daoOfMapFolding import doTheNeedful # noqa: PLC0415
274
+ from mapFolding.syntheticModules.daoOfMapFoldingNumba import doTheNeedful # noqa: PLC0415
195
275
  mapFoldingState = doTheNeedful(mapFoldingState)
196
276
  foldsTotal = mapFoldingState.foldsTotal
197
277
 
@@ -121,12 +121,6 @@ def getTaskDivisions(computationDivisions: int | str | None, concurrencyLimit: i
121
121
  def _makeConnectionGraph(mapShape: tuple[int, ...], leavesTotal: int) -> ndarray[tuple[int, int, int], numpy_dtype[numpy_int64]]:
122
122
  """Implement connection graph generation for map folding.
123
123
 
124
- (AI generated docstring)
125
-
126
- This is the internal implementation that calculates all possible connections between leaves in a map folding problem
127
- based on Lunnon's algorithm. The function constructs a three-dimensional array representing which leaves can be
128
- connected to each other for each dimension of the map.
129
-
130
124
  Parameters
131
125
  ----------
132
126
  mapShape : tuple[int, ...]
@@ -177,12 +171,6 @@ def _makeConnectionGraph(mapShape: tuple[int, ...], leavesTotal: int) -> ndarray
177
171
  def getConnectionGraph(mapShape: tuple[int, ...], leavesTotal: int, datatype: type[NumPyIntegerType]) -> ndarray[tuple[int, int, int], numpy_dtype[NumPyIntegerType]]:
178
172
  """Create a properly typed connection graph for the map folding algorithm.
179
173
 
180
- (AI generated docstring)
181
-
182
- This function serves as a typed wrapper around the internal implementation that generates connection graphs. It
183
- provides the correct type information for the returned array, ensuring consistency throughout the computation
184
- assembly-line.
185
-
186
174
  Parameters
187
175
  ----------
188
176
  mapShape : tuple[int, ...]
@@ -204,25 +192,21 @@ def getConnectionGraph(mapShape: tuple[int, ...], leavesTotal: int, datatype: ty
204
192
  return connectionGraph.astype(datatype)
205
193
 
206
194
  def makeDataContainer(shape: int | tuple[int, ...], datatype: type[NumPyIntegerType]) -> ndarray[Any, numpy_dtype[NumPyIntegerType]]:
207
- """Create a typed NumPy array container with initialized values.
208
-
209
- (AI generated docstring)
195
+ """Create any data container as long as it is a `numpy.ndarray` full of zeroes of type `numpy.integer`.
210
196
 
211
- This function centralizes the creation of data containers used throughout the computation assembly-line, enabling
212
- easy switching between different container types or implementation strategies if needed in the future.
197
+ By centralizing data container creation, you can more easily make global changes.
213
198
 
214
199
  Parameters
215
200
  ----------
216
201
  shape : int | tuple[int, ...]
217
- Either an integer (for 1D arrays) or a tuple of integers (for multi-dimensional arrays) specifying the
218
- dimensions of the array.
202
+ The array shape, either as a single axis length or a tuple of axes lengths.
219
203
  datatype : type[NumPyIntegerType]
220
- The NumPy integer type to use for the array elements, ensuring proper type consistency and memory efficiency.
204
+ The `numpy.integer` type for the array elements.
221
205
 
222
206
  Returns
223
207
  -------
224
208
  container : ndarray[Any, numpy_dtype[NumPyIntegerType]]
225
- A NumPy array of zeros with the specified shape and `datatype`.
209
+ A zero-filled `ndarray` with the specified `shape` and `datatype`.
226
210
 
227
211
  """
228
212
  return numpy.zeros(shape, dtype=datatype)
@@ -1,3 +1,4 @@
1
+ # ruff: noqa: D100 D103
1
2
  from mapFolding.dataBaskets import MapFoldingState
2
3
 
3
4
  def activeLeafGreaterThan0(state: MapFoldingState) -> bool:
@@ -139,4 +140,4 @@ def count(state: MapFoldingState) -> MapFoldingState:
139
140
 
140
141
  def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
141
142
  state = count(state)
142
- return state
143
+ return state # noqa: RET504