mapFolding 0.16.1__py3-none-any.whl → 0.16.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. easyRun/A000682.py +1 -1
  2. easyRun/A005316.py +2 -3
  3. easyRun/NOTcountingFolds.py +6 -5
  4. easyRun/countFolds.py +1 -1
  5. easyRun/generateAllModules.py +14 -0
  6. easyRun/meanders.py +16 -18
  7. mapFolding/__init__.py +1 -0
  8. mapFolding/_theSSOT.py +3 -2
  9. mapFolding/_theTypes.py +3 -0
  10. mapFolding/algorithms/A086345.py +75 -0
  11. mapFolding/algorithms/matrixMeanders.py +15 -28
  12. mapFolding/algorithms/matrixMeandersBeDry.py +34 -116
  13. mapFolding/algorithms/matrixMeandersNumPy.py +117 -70
  14. mapFolding/algorithms/matrixMeandersPandas.py +113 -130
  15. mapFolding/algorithms/oeisIDbyFormula.py +25 -14
  16. mapFolding/algorithms/symmetricFolds.py +36 -0
  17. mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +26 -12
  18. mapFolding/basecamp.py +152 -323
  19. mapFolding/dataBaskets.py +136 -34
  20. mapFolding/filesystemToolkit.py +4 -32
  21. mapFolding/oeis.py +5 -12
  22. mapFolding/reference/A000682facts.py +785 -1264
  23. mapFolding/reference/A005316facts.py +958 -923
  24. mapFolding/reference/A086345Wu.py +25 -0
  25. mapFolding/reference/matrixMeandersAnalysis/signatures.py +2033 -0
  26. mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +9 -44
  27. mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py +51 -0
  28. mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +39 -136
  29. mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +44 -45
  30. mapFolding/someAssemblyRequired/RecipeJob.py +78 -18
  31. mapFolding/someAssemblyRequired/__init__.py +3 -8
  32. mapFolding/someAssemblyRequired/_toolkitContainers.py +32 -3
  33. mapFolding/someAssemblyRequired/infoBooth.py +40 -23
  34. mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +75 -154
  35. mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +56 -88
  36. mapFolding/someAssemblyRequired/makingModules_count.py +91 -85
  37. mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +7 -65
  38. mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/makeMapFoldingModules.py +25 -31
  39. mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +14 -13
  40. mapFolding/someAssemblyRequired/toolkitMakeModules.py +10 -10
  41. mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
  42. mapFolding/someAssemblyRequired/transformationTools.py +17 -19
  43. mapFolding/syntheticModules/A007822/algorithm.py +46 -50
  44. mapFolding/syntheticModules/A007822/asynchronous.py +93 -34
  45. mapFolding/syntheticModules/A007822/initializeState.py +15 -21
  46. mapFolding/syntheticModules/A007822/theorem2.py +21 -21
  47. mapFolding/syntheticModules/A007822/theorem2Numba.py +42 -23
  48. mapFolding/syntheticModules/A007822/theorem2Trimmed.py +21 -21
  49. mapFolding/syntheticModules/countParallelNumba.py +3 -7
  50. mapFolding/syntheticModules/daoOfMapFoldingNumba.py +3 -6
  51. mapFolding/syntheticModules/meanders/bigInt.py +15 -25
  52. mapFolding/syntheticModules/theorem2.py +6 -0
  53. mapFolding/syntheticModules/theorem2Numba.py +26 -2
  54. mapFolding/syntheticModules/theorem2Trimmed.py +6 -0
  55. mapFolding/tests/test_computations.py +1 -1
  56. mapFolding/zCuzDocStoopid/makeDocstrings.py +2 -0
  57. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/METADATA +4 -1
  58. mapfolding-0.16.4.dist-info/RECORD +106 -0
  59. mapFolding/_dataPacking.py +0 -68
  60. mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -122
  61. mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -79
  62. mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -65
  63. mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -84
  64. mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -90
  65. mapFolding/syntheticModules/A007822/algorithmNumba.py +0 -94
  66. mapFolding/syntheticModules/A007822/asynchronousAnnex.py +0 -66
  67. mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +0 -85
  68. mapFolding/syntheticModules/A007822/asynchronousNumba.py +0 -52
  69. mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +0 -53
  70. mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +0 -47
  71. mapFolding/syntheticModules/dataPacking.py +0 -28
  72. mapFolding/syntheticModules/dataPackingA007822.py +0 -92
  73. mapfolding-0.16.1.dist-info/RECORD +0 -114
  74. /mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/__init__.py +0 -0
  75. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/WHEEL +0 -0
  76. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/entry_points.txt +0 -0
  77. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/licenses/LICENSE +0 -0
  78. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/top_level.txt +0 -0
@@ -1,79 +0,0 @@
1
- def count(bridges: int, dictionaryCurveLocationsKnown: dict[int, int]) -> int:
2
- while bridges > 0:
3
- bridges -= 1
4
- curveLocationsMAXIMUM = 1 << (2 * bridges + 4)
5
- dictionaryCurveLocationsDiscovered: dict[int, int] = {}
6
-
7
- for curveLocations, distinctCrossings in dictionaryCurveLocationsKnown.items():
8
- bifurcationAlpha = curveLocations & 0x5555555555555555555555555555555555555555555555555555555555555555
9
- bifurcationZulu = (curveLocations ^ bifurcationAlpha) >> 1
10
-
11
- bifurcationAlphaHasCurves = bifurcationAlpha != 1
12
- bifurcationZuluHasCurves = bifurcationZulu != 1
13
- bifurcationAlphaFinalZero = not bifurcationAlpha & 1
14
- bifurcationZuluFinalZero = not bifurcationZulu & 1
15
-
16
- if bifurcationAlphaHasCurves:
17
- curveLocationAnalysis = (bifurcationAlpha >> 2) | (bifurcationZulu << 3) | (bifurcationAlphaFinalZero << 1)
18
- if curveLocationAnalysis < curveLocationsMAXIMUM:
19
- dictionaryCurveLocationsDiscovered[curveLocationAnalysis] = dictionaryCurveLocationsDiscovered.get(curveLocationAnalysis, 0) + distinctCrossings
20
-
21
- if bifurcationZuluHasCurves:
22
- curveLocationAnalysis = (bifurcationZulu >> 1) | (bifurcationAlpha << 2) | bifurcationZuluFinalZero
23
- if curveLocationAnalysis < curveLocationsMAXIMUM:
24
- dictionaryCurveLocationsDiscovered[curveLocationAnalysis] = dictionaryCurveLocationsDiscovered.get(curveLocationAnalysis, 0) + distinctCrossings
25
-
26
- curveLocationAnalysis = ((bifurcationAlpha | (bifurcationZulu << 1)) << 2) | 3
27
- if curveLocationAnalysis < curveLocationsMAXIMUM:
28
- dictionaryCurveLocationsDiscovered[curveLocationAnalysis] = dictionaryCurveLocationsDiscovered.get(curveLocationAnalysis, 0) + distinctCrossings
29
-
30
- if bifurcationAlphaHasCurves and bifurcationZuluHasCurves and (bifurcationAlphaFinalZero or bifurcationZuluFinalZero):
31
- XOrHere2makePair = 0b1
32
- findUnpairedBinary1 = 0
33
- if bifurcationAlphaFinalZero and not bifurcationZuluFinalZero:
34
- while findUnpairedBinary1 >= 0:
35
- XOrHere2makePair <<= 2
36
- findUnpairedBinary1 += 1 if (bifurcationAlpha & XOrHere2makePair) == 0 else -1
37
- bifurcationAlpha ^= XOrHere2makePair
38
-
39
- elif bifurcationZuluFinalZero and not bifurcationAlphaFinalZero:
40
- while findUnpairedBinary1 >= 0:
41
- XOrHere2makePair <<= 2
42
- findUnpairedBinary1 += 1 if (bifurcationZulu & XOrHere2makePair) == 0 else -1
43
- bifurcationZulu ^= XOrHere2makePair
44
-
45
- curveLocationAnalysis = (bifurcationAlpha >> 2) | ((bifurcationZulu >> 2) << 1)
46
- if curveLocationAnalysis < curveLocationsMAXIMUM:
47
- dictionaryCurveLocationsDiscovered[curveLocationAnalysis] = dictionaryCurveLocationsDiscovered.get(curveLocationAnalysis, 0) + distinctCrossings
48
-
49
- dictionaryCurveLocationsKnown = dictionaryCurveLocationsDiscovered
50
-
51
- return sum(dictionaryCurveLocationsKnown.values())
52
-
53
- def initializeA005316(n: int) -> dict[int, int]:
54
- if n & 1:
55
- return {22: 1}
56
- else:
57
- return {15: 1}
58
-
59
- def initializeA000682(n: int) -> dict[int, int]:
60
- stateToCount: dict[int, int] = {}
61
-
62
- curveLocationsMAXIMUM = 1 << (2 * n + 4)
63
-
64
- bitPattern = 5 - (n & 1) * 4
65
-
66
- packedState = bitPattern | (bitPattern << 1)
67
- while packedState < curveLocationsMAXIMUM:
68
- stateToCount[packedState] = 1
69
- bitPattern = ((bitPattern << 4) | 0b0101)
70
- packedState = bitPattern | (bitPattern << 1)
71
-
72
- return stateToCount
73
-
74
- def A005316(n: int) -> int:
75
- return count(n, initializeA005316(n))
76
-
77
- def A000682(n: int) -> int:
78
- return count(n - 1, initializeA000682(n - 1))
79
-
@@ -1,65 +0,0 @@
1
- from mapFolding._oeisFormulas.matrixMeandersAnnex import curveMaximum as curveMaximum
2
-
3
- dictionaryCurveLocations: dict[int, int] = {}
4
-
5
- def getCurveLocations() -> dict[int, int]:
6
- global dictionaryCurveLocations # noqa: PLW0603
7
- sherpa = dictionaryCurveLocations.copy()
8
- dictionaryCurveLocations = {}
9
- return sherpa
10
-
11
- def recordAnalysis(curveLocationAnalysis: int, curveLocationsMAXIMUM: int, distinctCrossings: int) -> None:
12
- if curveLocationAnalysis < curveLocationsMAXIMUM:
13
- dictionaryCurveLocations[curveLocationAnalysis] = dictionaryCurveLocations.get(curveLocationAnalysis, 0) + distinctCrossings
14
-
15
- def initializeCurveLocations(startingCurveLocations: dict[int, int]) -> None:
16
- global dictionaryCurveLocations # noqa: PLW0603
17
- dictionaryCurveLocations = startingCurveLocations.copy()
18
-
19
- def count(bridges: int, startingCurveLocations: dict[int, int]) -> int:
20
- initializeCurveLocations(startingCurveLocations)
21
-
22
- while bridges > 0:
23
- bridges -= 1
24
- curveLocationsMAXIMUM, bifurcationZuluLocator, bifurcationAlphaLocator = curveMaximum[bridges]
25
-
26
- for curveLocations, distinctCrossings in getCurveLocations().items():
27
- bifurcationZulu = (curveLocations & bifurcationZuluLocator) >> 1
28
- bifurcationAlpha = curveLocations & bifurcationAlphaLocator
29
-
30
- bifurcationZuluFinalZero = (bifurcationZulu & 0b1) == 0
31
- bifurcationZuluHasCurves = bifurcationZulu != 1
32
- bifurcationAlphaFinalZero = (bifurcationAlpha & 0b1) == 0
33
- bifurcationAlphaHasCurves = bifurcationAlpha != 1
34
-
35
- if bifurcationZuluHasCurves:
36
- curveLocationAnalysis = (bifurcationZulu >> 1) | (bifurcationAlpha << 2) | bifurcationZuluFinalZero
37
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
38
-
39
- if bifurcationAlphaHasCurves:
40
- curveLocationAnalysis = (bifurcationAlpha >> 2) | (bifurcationZulu << 3) | (bifurcationAlphaFinalZero << 1)
41
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
42
-
43
- curveLocationAnalysis = ((bifurcationAlpha | (bifurcationZulu << 1)) << 2) | 3
44
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
45
-
46
- if bifurcationZuluHasCurves and bifurcationAlphaHasCurves and (bifurcationZuluFinalZero or bifurcationAlphaFinalZero):
47
- XOrHere2makePair = 0b1
48
- findUnpairedBinary1 = 0
49
-
50
- if bifurcationZuluFinalZero and not bifurcationAlphaFinalZero:
51
- while findUnpairedBinary1 >= 0:
52
- XOrHere2makePair <<= 2
53
- findUnpairedBinary1 += 1 if (bifurcationZulu & XOrHere2makePair) == 0 else -1
54
- bifurcationZulu ^= XOrHere2makePair
55
-
56
- elif bifurcationAlphaFinalZero and not bifurcationZuluFinalZero:
57
- while findUnpairedBinary1 >= 0:
58
- XOrHere2makePair <<= 2
59
- findUnpairedBinary1 += 1 if (bifurcationAlpha & XOrHere2makePair) == 0 else -1
60
- bifurcationAlpha ^= XOrHere2makePair
61
-
62
- curveLocationAnalysis = ((bifurcationZulu >> 2) << 1) | (bifurcationAlpha >> 2)
63
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
64
-
65
- return sum(getCurveLocations().values())
@@ -1,84 +0,0 @@
1
- from typing import NamedTuple
2
- import sys
3
-
4
- class limitLocators(NamedTuple):
5
- curveLocationsMAXIMUM: int
6
- bifurcationZuluLocator: int
7
- bifurcationAlphaLocator: int
8
-
9
- curveMaximum: dict[int, limitLocators] = {
10
- 0: limitLocators(16, 0x2a, 0x15),
11
- 1: limitLocators(64, 0xaa, 0x55),
12
- 2: limitLocators(256, 0x2aa, 0x155),
13
- 3: limitLocators(1024, 0xaaa, 0x555),
14
- 4: limitLocators(4096, 0x2aaa, 0x1555),
15
- 5: limitLocators(16384, 0xaaaa, 0x5555),
16
- 6: limitLocators(65536, 0x2aaaa, 0x15555),
17
- 7: limitLocators(262144, 0xaaaaa, 0x55555),
18
- 8: limitLocators(1048576, 0x2aaaaa, 0x155555),
19
- 9: limitLocators(4194304, 0xaaaaaa, 0x555555),
20
- 10: limitLocators(16777216, 0x2aaaaaa, 0x1555555),
21
- 11: limitLocators(67108864, 0xaaaaaaa, 0x5555555),
22
- 12: limitLocators(268435456, 0x2aaaaaaa, 0x15555555),
23
- 13: limitLocators(1073741824, 0xaaaaaaaa, 0x55555555),
24
- 14: limitLocators(4294967296, 0x2aaaaaaaa, 0x155555555),
25
- 15: limitLocators(17179869184, 0xaaaaaaaaa, 0x555555555),
26
- 16: limitLocators(68719476736, 0x2aaaaaaaaa, 0x1555555555),
27
- 17: limitLocators(274877906944, 0xaaaaaaaaaa, 0x5555555555),
28
- 18: limitLocators(1099511627776, 0x2aaaaaaaaaa, 0x15555555555),
29
- 19: limitLocators(4398046511104, 0xaaaaaaaaaaa, 0x55555555555),
30
- 20: limitLocators(17592186044416, 0x2aaaaaaaaaaa, 0x155555555555),
31
- 21: limitLocators(70368744177664, 0xaaaaaaaaaaaa, 0x555555555555),
32
- 22: limitLocators(281474976710656, 0x2aaaaaaaaaaaa, 0x1555555555555),
33
- 23: limitLocators(1125899906842624, 0xaaaaaaaaaaaaa, 0x5555555555555),
34
- 24: limitLocators(4503599627370496, 0x2aaaaaaaaaaaaa, 0x15555555555555),
35
- 25: limitLocators(18014398509481984, 0xaaaaaaaaaaaaaa, 0x55555555555555),
36
- 26: limitLocators(72057594037927936, 0x2aaaaaaaaaaaaaa, 0x155555555555555),
37
- 27: limitLocators(288230376151711744, 0xaaaaaaaaaaaaaaa, 0x555555555555555),
38
- 28: limitLocators(1152921504606846976, 0x2aaaaaaaaaaaaaaa, 0x1555555555555555),
39
- 29: limitLocators(4611686018427387904, 0xaaaaaaaaaaaaaaaa, 0x5555555555555555),
40
- 30: limitLocators(18446744073709551616, 0x2aaaaaaaaaaaaaaaa, 0x15555555555555555),
41
- 31: limitLocators(73786976294838206464, 0xaaaaaaaaaaaaaaaaa, 0x55555555555555555),
42
- 32: limitLocators(295147905179352825856, 0x2aaaaaaaaaaaaaaaaa, 0x155555555555555555),
43
- 33: limitLocators(1180591620717411303424, 0xaaaaaaaaaaaaaaaaaa, 0x555555555555555555),
44
- 34: limitLocators(4722366482869645213696, 0x2aaaaaaaaaaaaaaaaaa, 0x1555555555555555555),
45
- 35: limitLocators(18889465931478580854784, 0xaaaaaaaaaaaaaaaaaaa, 0x5555555555555555555),
46
- 36: limitLocators(75557863725914323419136, 0x2aaaaaaaaaaaaaaaaaaa, 0x15555555555555555555),
47
- 37: limitLocators(302231454903657293676544, 0xaaaaaaaaaaaaaaaaaaaa, 0x55555555555555555555),
48
- 38: limitLocators(1208925819614629174706176, 0x2aaaaaaaaaaaaaaaaaaaa, 0x155555555555555555555),
49
- 39: limitLocators(4835703278458516698824704, 0xaaaaaaaaaaaaaaaaaaaaa, 0x555555555555555555555),
50
- 40: limitLocators(19342813113834066795298816, 0x2aaaaaaaaaaaaaaaaaaaaa, 0x1555555555555555555555),
51
- 41: limitLocators(77371252455336267181195264, 0xaaaaaaaaaaaaaaaaaaaaaa, 0x5555555555555555555555),
52
- 42: limitLocators(309485009821345068724781056, 0x2aaaaaaaaaaaaaaaaaaaaaa, 0x15555555555555555555555),
53
- 43: limitLocators(1237940039285380274899124224, 0xaaaaaaaaaaaaaaaaaaaaaaa, 0x55555555555555555555555),
54
- 44: limitLocators(4951760157141521099596496896, 0x2aaaaaaaaaaaaaaaaaaaaaaa, 0x155555555555555555555555),
55
- 45: limitLocators(19807040628566084398385987584, 0xaaaaaaaaaaaaaaaaaaaaaaaa, 0x555555555555555555555555),
56
- 46: limitLocators(79228162514264337593543950336, 0x2aaaaaaaaaaaaaaaaaaaaaaaa, 0x1555555555555555555555555),
57
- 47: limitLocators(316912650057057350374175801344, 0xaaaaaaaaaaaaaaaaaaaaaaaaa, 0x5555555555555555555555555),
58
- 48: limitLocators(1267650600228229401496703205376, 0x2aaaaaaaaaaaaaaaaaaaaaaaaa, 0x15555555555555555555555555),
59
- 49: limitLocators(5070602400912917605986812821504, 0xaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x55555555555555555555555555),
60
- 50: limitLocators(20282409603651670423947251286016, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaa, 0x155555555555555555555555555),
61
- 51: limitLocators(81129638414606681695789005144064, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x555555555555555555555555555),
62
- 52: limitLocators(324518553658426726783156020576256, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x1555555555555555555555555555),
63
- 53: limitLocators(1298074214633706907132624082305024, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x5555555555555555555555555555),
64
- 54: limitLocators(5192296858534827628530496329220096, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x15555555555555555555555555555),
65
- 55: limitLocators(20769187434139310514121985316880384, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x55555555555555555555555555555),
66
- 56: limitLocators(83076749736557242056487941267521536, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x155555555555555555555555555555),
67
- 57: limitLocators(332306998946228968225951765070086144, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x555555555555555555555555555555),
68
- 58: limitLocators(1329227995784915872903807060280344576, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x1555555555555555555555555555555),
69
- 59: limitLocators(5316911983139663491615228241121378304, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x5555555555555555555555555555555),
70
- 60: limitLocators(21267647932558653966460912964485513216, 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x15555555555555555555555555555555),
71
- 61: limitLocators(85070591730234615865843651857942052864, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 0x55555555555555555555555555555555),
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({curveLocationsMAXIMUM}, {hex(bifurcationAlphaLocator << 1)}, {hex(bifurcationAlphaLocator)}),\n")
80
- sys.stdout.write("}\n")
81
-
82
- if __name__ == '__main__':
83
- makeCurveMaximum()
84
-
@@ -1,90 +0,0 @@
1
- from mapFolding._oeisFormulas.matrixMeandersAnnex import curveMaximum as curveMaximum
2
- from queue import Empty, SimpleQueue
3
- from typing import NamedTuple
4
- import contextlib
5
-
6
- class BifurcatedCurves(NamedTuple):
7
- bifurcationZulu: int
8
- bifurcationAlpha: int
9
- distinctCrossings: int
10
- curveLocationsMAXIMUM: int
11
-
12
- dictionaryCurveLocations: dict[int, int] = {}
13
- simpleQueueCurveLocations: SimpleQueue[tuple[int, int]] = SimpleQueue()
14
-
15
- def unpackQueue() -> dict[int, int]:
16
- with contextlib.suppress(Empty):
17
- while True:
18
- curveLocations, distinctCrossings = simpleQueueCurveLocations.get_nowait()
19
- dictionaryCurveLocations[curveLocations] = dictionaryCurveLocations.get(curveLocations, 0) + distinctCrossings
20
-
21
- return dictionaryCurveLocations
22
-
23
- def getCurveLocations(bridges: int) -> list[BifurcatedCurves]:
24
- global dictionaryCurveLocations # noqa: PLW0603
25
- dictionaryCurveLocations = unpackQueue()
26
- curveLocationsMAXIMUM, bifurcationZuluLocator, bifurcationAlphaLocator = curveMaximum[bridges]
27
- listBifurcatedCurves: list[BifurcatedCurves] = []
28
- # TODO This is ready for concurrency and/or vectorization.
29
- for curveLocations, distinctCrossings in dictionaryCurveLocations.items():
30
- bifurcationZulu = (curveLocations & bifurcationZuluLocator) >> 1
31
- bifurcationAlpha = (curveLocations & bifurcationAlphaLocator)
32
- listBifurcatedCurves.append(BifurcatedCurves(bifurcationZulu, bifurcationAlpha, distinctCrossings, curveLocationsMAXIMUM))
33
- dictionaryCurveLocations = {}
34
- return listBifurcatedCurves
35
-
36
- def recordAnalysis(curveLocationAnalysis: int, curveLocationsMAXIMUM: int, distinctCrossings: int) -> None:
37
- if curveLocationAnalysis < curveLocationsMAXIMUM:
38
- simpleQueueCurveLocations.put((curveLocationAnalysis, distinctCrossings))
39
-
40
- def analyzeCurve(bifurcationZulu: int, bifurcationAlpha: int, distinctCrossings: int, curveLocationsMAXIMUM: int) -> None:
41
- bifurcationZuluFinalZero = (bifurcationZulu & 0b1) == 0
42
- bifurcationZuluHasCurves = bifurcationZulu != 1
43
- bifurcationAlphaFinalZero = (bifurcationAlpha & 0b1) == 0
44
- bifurcationAlphaHasCurves = bifurcationAlpha != 1
45
-
46
- if bifurcationZuluHasCurves:
47
- curveLocationAnalysis = (bifurcationZulu >> 1) | (bifurcationAlpha << 2) | bifurcationZuluFinalZero
48
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
49
-
50
- if bifurcationAlphaHasCurves:
51
- curveLocationAnalysis = (bifurcationAlpha >> 2) | (bifurcationZulu << 3) | (bifurcationAlphaFinalZero << 1)
52
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
53
-
54
- curveLocationAnalysis = ((bifurcationAlpha | (bifurcationZulu << 1)) << 2) | 3
55
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
56
-
57
- if bifurcationZuluHasCurves and bifurcationAlphaHasCurves and (bifurcationZuluFinalZero or bifurcationAlphaFinalZero):
58
- XOrHere2makePair = 0b1
59
- findUnpairedBinary1 = 0
60
-
61
- if bifurcationZuluFinalZero and not bifurcationAlphaFinalZero:
62
- while findUnpairedBinary1 >= 0:
63
- XOrHere2makePair <<= 2
64
- findUnpairedBinary1 += 1 if (bifurcationZulu & XOrHere2makePair) == 0 else -1
65
- bifurcationZulu ^= XOrHere2makePair
66
-
67
- elif bifurcationAlphaFinalZero and not bifurcationZuluFinalZero:
68
- while findUnpairedBinary1 >= 0:
69
- XOrHere2makePair <<= 2
70
- findUnpairedBinary1 += 1 if (bifurcationAlpha & XOrHere2makePair) == 0 else -1
71
- bifurcationAlpha ^= XOrHere2makePair
72
-
73
- curveLocationAnalysis = ((bifurcationZulu >> 2) << 1) | (bifurcationAlpha >> 2)
74
- recordAnalysis(curveLocationAnalysis, curveLocationsMAXIMUM, distinctCrossings)
75
-
76
- def initializeCurveLocations(startingCurveLocations: dict[int, int]) -> None:
77
- global dictionaryCurveLocations # noqa: PLW0603
78
- dictionaryCurveLocations = startingCurveLocations.copy()
79
-
80
- def count(bridges: int, startingCurveLocations: dict[int, int]) -> int:
81
- initializeCurveLocations(startingCurveLocations)
82
-
83
- while bridges > 0:
84
- bridges -= 1
85
-
86
- # TODO This could be parallelized when `recordAnalysis` is thread-safe
87
- for bifurcatedCurve in getCurveLocations(bridges):
88
- analyzeCurve(*bifurcatedCurve)
89
-
90
- return getCurveLocations(bridges)[0].distinctCrossings
@@ -1,94 +0,0 @@
1
- from mapFolding.dataBaskets import Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal, MapFoldingState
2
- from numba import jit
3
-
4
- @jit(cache=True, error_model='numpy', fastmath=True, forceinline=True)
5
- def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1ndexCeiling: DatatypeElephino, indexDimension: DatatypeLeavesTotal, indexLeaf: DatatypeLeavesTotal, indexMiniGap: DatatypeElephino, leaf1ndex: DatatypeLeavesTotal, leafConnectee: DatatypeLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, leafComparison: Array1DLeavesTotal, connectionGraph: Array3DLeavesTotal, dimensionsTotal: DatatypeLeavesTotal, leavesTotal: DatatypeLeavesTotal) -> tuple[DatatypeFoldsTotal, DatatypeElephino, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal, Array1DLeavesTotal, Array1DElephino, Array1DLeavesTotal, Array1DLeavesTotal, Array1DLeavesTotal, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal]:
6
- while leaf1ndex > 0:
7
- if leaf1ndex <= 1 or leafBelow[0] == 1:
8
- if leaf1ndex > leavesTotal:
9
- indexLeaf = 0
10
- leafConnectee = 0
11
- while leafConnectee < leavesTotal + 1:
12
- leafNumber = int(leafBelow[indexLeaf])
13
- leafComparison[leafConnectee] = (leafNumber - indexLeaf + leavesTotal) % leavesTotal
14
- indexLeaf = leafNumber
15
- leafConnectee += 1
16
- indexInMiddle = leavesTotal // 2
17
- indexMiniGap = 0
18
- while indexMiniGap < leavesTotal + 1:
19
- ImaSymmetricFold = True
20
- leafConnectee = 0
21
- while leafConnectee < indexInMiddle:
22
- if leafComparison[(indexMiniGap + leafConnectee) % (leavesTotal + 1)] != leafComparison[(indexMiniGap + leavesTotal - 1 - leafConnectee) % (leavesTotal + 1)]:
23
- ImaSymmetricFold = False
24
- break
25
- leafConnectee += 1
26
- groupsOfFolds += ImaSymmetricFold
27
- indexMiniGap += 1
28
- else:
29
- dimensionsUnconstrained = dimensionsTotal
30
- gap1ndexCeiling = gapRangeStart[leaf1ndex - 1]
31
- indexDimension = 0
32
- while indexDimension < dimensionsTotal:
33
- leafConnectee = connectionGraph[indexDimension, leaf1ndex, leaf1ndex]
34
- if leafConnectee == leaf1ndex:
35
- dimensionsUnconstrained -= 1
36
- else:
37
- while leafConnectee != leaf1ndex:
38
- gapsWhere[gap1ndexCeiling] = leafConnectee
39
- if countDimensionsGapped[leafConnectee] == 0:
40
- gap1ndexCeiling += 1
41
- countDimensionsGapped[leafConnectee] += 1
42
- leafConnectee = connectionGraph[indexDimension, leaf1ndex, leafBelow[leafConnectee]]
43
- indexDimension += 1
44
- if not dimensionsUnconstrained:
45
- indexLeaf = 0
46
- while indexLeaf < leaf1ndex:
47
- gapsWhere[gap1ndexCeiling] = indexLeaf
48
- gap1ndexCeiling += 1
49
- indexLeaf += 1
50
- indexMiniGap = gap1ndex
51
- while indexMiniGap < gap1ndexCeiling:
52
- gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
53
- if countDimensionsGapped[gapsWhere[indexMiniGap]] == dimensionsUnconstrained:
54
- gap1ndex += 1
55
- countDimensionsGapped[gapsWhere[indexMiniGap]] = 0
56
- indexMiniGap += 1
57
- while leaf1ndex > 0 and gap1ndex == gapRangeStart[leaf1ndex - 1]:
58
- leaf1ndex -= 1
59
- leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
60
- leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
61
- if leaf1ndex > 0:
62
- gap1ndex -= 1
63
- leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
64
- leafBelow[leaf1ndex] = leafBelow[leafAbove[leaf1ndex]]
65
- leafBelow[leafAbove[leaf1ndex]] = leaf1ndex
66
- leafAbove[leafBelow[leaf1ndex]] = leaf1ndex
67
- gapRangeStart[leaf1ndex] = gap1ndex
68
- leaf1ndex += 1
69
- groupsOfFolds = (groupsOfFolds + 1) // 2
70
- return (groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, leafComparison, connectionGraph, dimensionsTotal, leavesTotal)
71
-
72
- def doTheNeedful(state: MapFoldingState) -> MapFoldingState:
73
- mapShape: tuple[DatatypeLeavesTotal, ...] = state.mapShape
74
- groupsOfFolds: DatatypeFoldsTotal = state.groupsOfFolds
75
- gap1ndex: DatatypeElephino = state.gap1ndex
76
- gap1ndexCeiling: DatatypeElephino = state.gap1ndexCeiling
77
- indexDimension: DatatypeLeavesTotal = state.indexDimension
78
- indexLeaf: DatatypeLeavesTotal = state.indexLeaf
79
- indexMiniGap: DatatypeElephino = state.indexMiniGap
80
- leaf1ndex: DatatypeLeavesTotal = state.leaf1ndex
81
- leafConnectee: DatatypeLeavesTotal = state.leafConnectee
82
- dimensionsUnconstrained: DatatypeLeavesTotal = state.dimensionsUnconstrained
83
- countDimensionsGapped: Array1DLeavesTotal = state.countDimensionsGapped
84
- gapRangeStart: Array1DElephino = state.gapRangeStart
85
- gapsWhere: Array1DLeavesTotal = state.gapsWhere
86
- leafAbove: Array1DLeavesTotal = state.leafAbove
87
- leafBelow: Array1DLeavesTotal = state.leafBelow
88
- leafComparison: Array1DLeavesTotal = state.leafComparison
89
- connectionGraph: Array3DLeavesTotal = state.connectionGraph
90
- dimensionsTotal: DatatypeLeavesTotal = state.dimensionsTotal
91
- leavesTotal: DatatypeLeavesTotal = state.leavesTotal
92
- groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, leafComparison, connectionGraph, dimensionsTotal, leavesTotal = count(groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexLeaf, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, leafComparison, connectionGraph, dimensionsTotal, leavesTotal)
93
- state = MapFoldingState(mapShape=mapShape, groupsOfFolds=groupsOfFolds, gap1ndex=gap1ndex, gap1ndexCeiling=gap1ndexCeiling, indexDimension=indexDimension, indexLeaf=indexLeaf, indexMiniGap=indexMiniGap, leaf1ndex=leaf1ndex, leafConnectee=leafConnectee, dimensionsUnconstrained=dimensionsUnconstrained, countDimensionsGapped=countDimensionsGapped, gapRangeStart=gapRangeStart, gapsWhere=gapsWhere, leafAbove=leafAbove, leafBelow=leafBelow, leafComparison=leafComparison)
94
- return state
@@ -1,66 +0,0 @@
1
- from concurrent.futures import Future as ConcurrentFuture, ThreadPoolExecutor
2
- from hunterMakesPy import raiseIfNone
3
- from mapFolding import Array1DLeavesTotal
4
- from queue import Empty, Queue
5
- from threading import Thread
6
- import numpy
7
-
8
- concurrencyManager = None
9
- groupsOfFoldsTotal: int = 0
10
- processingThread = None
11
- queueFutures: Queue[ConcurrentFuture[int]] = Queue()
12
-
13
- def initializeConcurrencyManager(maxWorkers: int | None=None, groupsOfFolds: int=0) -> None:
14
- global concurrencyManager, queueFutures, groupsOfFoldsTotal, processingThread
15
- concurrencyManager = ThreadPoolExecutor(max_workers=maxWorkers)
16
- queueFutures = Queue()
17
- groupsOfFoldsTotal = groupsOfFolds
18
- processingThread = Thread(target=_processCompletedFutures)
19
- processingThread.start()
20
-
21
- def _processCompletedFutures() -> None:
22
- global queueFutures, groupsOfFoldsTotal
23
- while True:
24
- try:
25
- claimTicket: ConcurrentFuture[int] = queueFutures.get(timeout=1)
26
- if claimTicket is None:
27
- break
28
- groupsOfFoldsTotal += claimTicket.result()
29
- except Empty:
30
- continue
31
-
32
- def _filterAsymmetricFolds(leafBelow: Array1DLeavesTotal) -> int:
33
- groupsOfFolds = 0
34
- leafComparison: Array1DLeavesTotal = numpy.zeros_like(leafBelow)
35
- leavesTotal = leafBelow.size - 1
36
- indexLeaf = 0
37
- leafConnectee = 0
38
- while leafConnectee < leavesTotal + 1:
39
- leafNumber = int(leafBelow[indexLeaf])
40
- leafComparison[leafConnectee] = (leafNumber - indexLeaf + leavesTotal) % leavesTotal
41
- indexLeaf = leafNumber
42
- leafConnectee += 1
43
- indexInMiddle = leavesTotal // 2
44
- indexDistance = 0
45
- while indexDistance < leavesTotal + 1:
46
- ImaSymmetricFold = True
47
- leafConnectee = 0
48
- while leafConnectee < indexInMiddle:
49
- if leafComparison[(indexDistance + leafConnectee) % (leavesTotal + 1)] != leafComparison[(indexDistance + leavesTotal - 1 - leafConnectee) % (leavesTotal + 1)]:
50
- ImaSymmetricFold = False
51
- break
52
- leafConnectee += 1
53
- groupsOfFolds += ImaSymmetricFold
54
- indexDistance += 1
55
- return groupsOfFolds
56
-
57
- def filterAsymmetricFolds(leafBelow: Array1DLeavesTotal) -> None:
58
- global concurrencyManager, queueFutures
59
- queueFutures.put_nowait(raiseIfNone(concurrencyManager).submit(_filterAsymmetricFolds, leafBelow.copy()))
60
-
61
- def getAsymmetricFoldsTotal() -> int:
62
- global concurrencyManager, queueFutures, processingThread
63
- raiseIfNone(concurrencyManager).shutdown(wait=True)
64
- queueFutures.put(None)
65
- raiseIfNone(processingThread).join()
66
- return groupsOfFoldsTotal
@@ -1,85 +0,0 @@
1
- from mapFolding import Array1DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal
2
- from queue import Queue
3
- from threading import Lock, Thread
4
- import numba
5
- import numpy
6
-
7
- listThreads: list[Thread] = []
8
- queueFutures: Queue[Array1DLeavesTotal] = Queue()
9
- groupsOfFoldsTotal: int = 0
10
- groupsOfFoldsTotalLock = Lock()
11
- sentinelStop = object()
12
-
13
- def initializeConcurrencyManager(maxWorkers: int, groupsOfFolds: int=0) -> None:
14
- global listThreads, groupsOfFoldsTotal, queueFutures # noqa: PLW0603
15
- listThreads = []
16
- queueFutures = Queue()
17
- groupsOfFoldsTotal = groupsOfFolds
18
- indexThread = 0
19
- while indexThread < maxWorkers:
20
- thread = Thread(target=_threadDoesSomething, name=f"thread{indexThread}", daemon=True)
21
- thread.start()
22
- listThreads.append(thread)
23
- indexThread += 1
24
-
25
- def _threadDoesSomething() -> None:
26
- global groupsOfFoldsTotal # noqa: PLW0603
27
- while True:
28
- leafBelow = queueFutures.get()
29
- if leafBelow is sentinelStop: # pyright: ignore[reportUnnecessaryComparison]
30
- break
31
- symmetricFolds = _filterAsymmetricFolds(leafBelow)
32
- with groupsOfFoldsTotalLock:
33
- groupsOfFoldsTotal += symmetricFolds
34
-
35
- @numba.jit(cache=True, error_model='numpy', fastmath=True)
36
- def _filterAsymmetricFolds(leafBelow: Array1DLeavesTotal) -> int:
37
- groupsOfFolds = 0
38
- leafComparison: Array1DLeavesTotal = numpy.zeros_like(leafBelow)
39
- leavesTotal = leafBelow.size - 1
40
- indexLeaf = 0
41
- leafConnectee = 0
42
- while leafConnectee < leavesTotal + 1:
43
- leafNumber = int(leafBelow[indexLeaf])
44
- leafComparison[leafConnectee] = (leafNumber - indexLeaf + leavesTotal) % leavesTotal
45
- indexLeaf = leafNumber
46
- leafConnectee += 1
47
- indexInMiddle = leavesTotal // 2
48
- indexDistance = 0
49
- while indexDistance < leavesTotal + 1:
50
- ImaSymmetricFold = True
51
- leafConnectee = 0
52
- while leafConnectee < indexInMiddle:
53
- if leafComparison[(indexDistance + leafConnectee) % (leavesTotal + 1)] != leafComparison[(indexDistance + leavesTotal - 1 - leafConnectee) % (leavesTotal + 1)]:
54
- ImaSymmetricFold = False
55
- break
56
- leafConnectee += 1
57
- groupsOfFolds += ImaSymmetricFold
58
- indexDistance += 1
59
- return groupsOfFolds
60
-
61
- def _go(leafBelow: Array1DLeavesTotal) -> None:
62
- queueFutures.put_nowait(leafBelow.copy())
63
-
64
-
65
- # @numba.jit(numba.int64(numba.int64[:]), cache=True, error_model='numpy', fastmath=True)
66
- def filterAsymmetricFolds(leafBelow: Array1DLeavesTotal) -> int: # non-blocking submission
67
- # Must not block caller; enqueue for background processing
68
- _go(leafBelow)
69
- return 60 # GO
70
-
71
- def _stop() -> DatatypeFoldsTotal:
72
- global listThreads # noqa: PLW0602
73
- # Signal all workers to stop after queue drained
74
- for _thread in listThreads:
75
- queueFutures.put(sentinelStop) # pyright: ignore[reportArgumentType]
76
- for thread in listThreads:
77
- thread.join()
78
- return groupsOfFoldsTotal
79
-
80
-
81
-
82
- @numba.jit(numba.uint64(), cache=True, error_model='numpy', fastmath=True, forceobj=True)
83
- def getAsymmetricFoldsTotal() -> DatatypeFoldsTotal:
84
- total = _stop()
85
- return total
@@ -1,52 +0,0 @@
1
- from mapFolding.dataBaskets import (
2
- Array1DElephino, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal)
3
- from mapFolding.syntheticModules.A007822.asynchronousAnnexNumba import filterAsymmetricFolds, getAsymmetricFoldsTotal
4
- from mapFolding.syntheticModules.dataPackingA007822 import unRePackDataclassAsynchronous
5
- from numba import jit
6
-
7
- @unRePackDataclassAsynchronous
8
- @jit(cache=True, error_model='numpy', fastmath=True, forceinline=True)
9
- def count(groupsOfFolds: DatatypeFoldsTotal, gap1ndex: DatatypeElephino, gap1ndexCeiling: DatatypeElephino, indexDimension: DatatypeLeavesTotal, indexMiniGap: DatatypeElephino, leaf1ndex: DatatypeLeavesTotal, leafConnectee: DatatypeLeavesTotal, dimensionsUnconstrained: DatatypeLeavesTotal, countDimensionsGapped: Array1DLeavesTotal, gapRangeStart: Array1DElephino, gapsWhere: Array1DLeavesTotal, leafAbove: Array1DLeavesTotal, leafBelow: Array1DLeavesTotal, connectionGraph: Array3DLeavesTotal, dimensionsTotal: DatatypeLeavesTotal, leavesTotal: DatatypeLeavesTotal) -> tuple[DatatypeFoldsTotal, DatatypeElephino, DatatypeElephino, DatatypeLeavesTotal, DatatypeElephino, DatatypeLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal, Array1DLeavesTotal, Array1DElephino, Array1DLeavesTotal, Array1DLeavesTotal, Array1DLeavesTotal, Array3DLeavesTotal, DatatypeLeavesTotal, DatatypeLeavesTotal]:
10
- while leaf1ndex > 4:
11
- if leafBelow[0] == 1:
12
- if leaf1ndex > leavesTotal:
13
- filterAsymmetricFolds(leafBelow)
14
- else:
15
- dimensionsUnconstrained = dimensionsTotal
16
- gap1ndexCeiling = gapRangeStart[leaf1ndex - 1]
17
- indexDimension = 0
18
- while indexDimension < dimensionsTotal:
19
- leafConnectee = connectionGraph[indexDimension, leaf1ndex, leaf1ndex]
20
- if leafConnectee == leaf1ndex:
21
- dimensionsUnconstrained -= 1
22
- else:
23
- while leafConnectee != leaf1ndex:
24
- gapsWhere[gap1ndexCeiling] = leafConnectee
25
- if countDimensionsGapped[leafConnectee] == 0:
26
- gap1ndexCeiling += 1
27
- countDimensionsGapped[leafConnectee] += 1
28
- leafConnectee = connectionGraph[indexDimension, leaf1ndex, leafBelow[leafConnectee]]
29
- indexDimension += 1
30
- indexMiniGap = gap1ndex
31
- while indexMiniGap < gap1ndexCeiling:
32
- gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
33
- if countDimensionsGapped[gapsWhere[indexMiniGap]] == dimensionsUnconstrained:
34
- gap1ndex += 1
35
- countDimensionsGapped[gapsWhere[indexMiniGap]] = 0
36
- indexMiniGap += 1
37
- while gap1ndex == gapRangeStart[leaf1ndex - 1]:
38
- leaf1ndex -= 1
39
- leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
40
- leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
41
- gap1ndex -= 1
42
- leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
43
- leafBelow[leaf1ndex] = leafBelow[leafAbove[leaf1ndex]]
44
- leafBelow[leafAbove[leaf1ndex]] = leaf1ndex
45
- leafAbove[leafBelow[leaf1ndex]] = leaf1ndex
46
- gapRangeStart[leaf1ndex] = gap1ndex
47
- leaf1ndex += 1
48
- else:
49
- groupsOfFolds = getAsymmetricFoldsTotal()
50
- groupsOfFolds *= 2
51
- groupsOfFolds = (groupsOfFolds + 1) // 2
52
- return (groupsOfFolds, gap1ndex, gap1ndexCeiling, indexDimension, indexMiniGap, leaf1ndex, leafConnectee, dimensionsUnconstrained, countDimensionsGapped, gapRangeStart, gapsWhere, leafAbove, leafBelow, connectionGraph, dimensionsTotal, leavesTotal)