mapFolding 0.15.0__py3-none-any.whl → 0.15.2__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.
- mapFolding/__init__.py +1 -0
- mapFolding/_oeisFormulas/A001010.py +19 -0
- mapFolding/_oeisFormulas/A001011.py +5 -0
- mapFolding/_oeisFormulas/Z0Z_aOFn.py +15 -3
- mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py +13 -16
- mapFolding/_theTypes.py +1 -1
- mapFolding/basecamp.py +89 -9
- mapFolding/daoOfMapFolding.py +2 -1
- mapFolding/oeis.py +1 -5
- mapFolding/reference/jaxCount.py +1 -1
- mapFolding/reference/rotatedEntryPoint.py +1 -1
- mapFolding/someAssemblyRequired/A007822rawMaterials.py +46 -0
- mapFolding/someAssemblyRequired/makeAllModules.py +185 -203
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +2 -2
- mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +2 -2
- mapFolding/syntheticModules/algorithmA007822.py +166 -0
- mapFolding/syntheticModules/algorithmA007822Numba.py +95 -0
- mapFolding/syntheticModules/{countParallel.py → countParallelNumba.py} +4 -6
- mapFolding/syntheticModules/{daoOfMapFolding.py → daoOfMapFoldingNumba.py} +4 -5
- mapFolding/syntheticModules/dataPacking.py +2 -1
- mapFolding/syntheticModules/dataPackingA007822.py +28 -0
- mapFolding/syntheticModules/{initializeCount.py → initializeState.py} +1 -1
- mapFolding/syntheticModules/initializeStateA007822.py +69 -0
- mapFolding/syntheticModules/theorem2.py +2 -1
- mapFolding/syntheticModules/theorem2A007822.py +70 -0
- mapFolding/syntheticModules/theorem2A007822Numba.py +66 -0
- mapFolding/syntheticModules/theorem2A007822Trimmed.py +64 -0
- mapFolding/syntheticModules/theorem2Numba.py +4 -4
- mapFolding/syntheticModules/theorem2Trimmed.py +2 -1
- mapFolding/tests/test_computations.py +29 -4
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.2.dist-info}/METADATA +2 -2
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.2.dist-info}/RECORD +36 -27
- mapFolding/_A007822.py +0 -181
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.2.dist-info}/WHEEL +0 -0
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.2.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.2.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.15.0.dist-info → mapfolding-0.15.2.dist-info}/top_level.txt +0 -0
mapFolding/__init__.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from mapFolding import countFolds
|
|
2
|
+
from mapFolding._oeisFormulas.A000682 import A000682
|
|
3
|
+
|
|
4
|
+
def A001010(n: int) -> int:
|
|
5
|
+
"""Complicated.
|
|
6
|
+
|
|
7
|
+
a(2n-1) = 2*A007822(n)
|
|
8
|
+
OddQ[n], 2*A007822[[(n - 1)/2 + 1]]]
|
|
9
|
+
|
|
10
|
+
a(2n) = 2*A000682(n+1)
|
|
11
|
+
EvenQ[n], 2*A000682[[n/2 + 1]]
|
|
12
|
+
"""
|
|
13
|
+
if n & 0b1:
|
|
14
|
+
foldsTotal = 2 * countFolds(oeisID='A007822', oeis_n=(n - 1)//2 + 1, flow='theorem2Numba')
|
|
15
|
+
else:
|
|
16
|
+
foldsTotal = 2 * A000682(n // 2 + 1)
|
|
17
|
+
|
|
18
|
+
return foldsTotal
|
|
19
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from mapFolding._oeisFormulas.A000136 import A000136
|
|
2
2
|
from mapFolding._oeisFormulas.A000682 import A000682
|
|
3
|
+
from mapFolding._oeisFormulas.A001010 import A001010
|
|
3
4
|
from mapFolding._oeisFormulas.Z0Z_oeisMeanders import dictionaryOEISMeanders
|
|
4
5
|
from mapFolding.oeis import dictionaryOEIS
|
|
5
6
|
import sys
|
|
@@ -8,14 +9,25 @@ import time
|
|
|
8
9
|
# ruff: noqa: ERA001
|
|
9
10
|
|
|
10
11
|
if __name__ == '__main__':
|
|
12
|
+
def _write() -> None:
|
|
13
|
+
sys.stdout.write(
|
|
14
|
+
f"{(match:=foldsTotal == dictionaryOEISMeanders[oeisID]['valuesKnown'][n])}\t"
|
|
15
|
+
f"\033[{(not match)*91}m"
|
|
16
|
+
f"{n}\t"
|
|
17
|
+
f"{foldsTotal=}\t"
|
|
18
|
+
f"{dictionaryOEISMeanders[oeisID]['valuesKnown'][n]=}\t"
|
|
19
|
+
f"{time.perf_counter() - timeStart:.2f}\t"
|
|
20
|
+
# f"{description}\t"
|
|
21
|
+
"\033[0m\n"
|
|
22
|
+
)
|
|
11
23
|
oeisID = 'A000136'
|
|
12
24
|
oeisID = 'A000682'
|
|
13
|
-
|
|
25
|
+
oeisID = 'A001010'
|
|
26
|
+
for n in range(2, 13):
|
|
14
27
|
|
|
15
28
|
# sys.stdout.write(f"{n = }\n")
|
|
16
29
|
|
|
17
30
|
timeStart = time.perf_counter()
|
|
18
31
|
foldsTotal = eval(oeisID)(n)
|
|
19
32
|
# sys.stdout.write(f"{n} {foldsTotal} {time.perf_counter() - timeStart:.2f}\n")
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
_write()
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from mapFolding._oeisFormulas.A000560 import A000560
|
|
2
2
|
from mapFolding._oeisFormulas.A000682 import A000682
|
|
3
|
+
from mapFolding._oeisFormulas.A001010 import A001010
|
|
4
|
+
from mapFolding._oeisFormulas.A001011 import A001011
|
|
3
5
|
from mapFolding._oeisFormulas.A005315 import A005315
|
|
4
6
|
from mapFolding._oeisFormulas.A005316 import A005316
|
|
5
7
|
from mapFolding._oeisFormulas.A223094 import A223094
|
|
@@ -8,11 +10,11 @@ from mapFolding._oeisFormulas.A301620 import A301620
|
|
|
8
10
|
from mapFolding.oeis import getOEISidInformation, getOEISidValues
|
|
9
11
|
import sys
|
|
10
12
|
|
|
11
|
-
'A001010'
|
|
12
|
-
'A001011'
|
|
13
13
|
oeisIDsMeanders: list[str] = [
|
|
14
14
|
'A000560',
|
|
15
15
|
'A000682',
|
|
16
|
+
'A001010',
|
|
17
|
+
'A001011',
|
|
16
18
|
'A005315',
|
|
17
19
|
'A005316',
|
|
18
20
|
'A223094',
|
|
@@ -37,19 +39,14 @@ rangeTest = range(5, 13)
|
|
|
37
39
|
if __name__ == '__main__':
|
|
38
40
|
for n in rangeTest:
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
assert
|
|
42
|
-
|
|
43
|
-
assert
|
|
44
|
-
|
|
45
|
-
assert
|
|
46
|
-
|
|
47
|
-
assert
|
|
48
|
-
|
|
49
|
-
assert A223094for_n == dictionaryOEISMeanders['A223094']['valuesKnown'][n]
|
|
50
|
-
A259702for_n = A259702(n)
|
|
51
|
-
assert A259702for_n == dictionaryOEISMeanders['A259702']['valuesKnown'][n]
|
|
52
|
-
A301620for_n = A301620(n)
|
|
53
|
-
assert A301620for_n == dictionaryOEISMeanders['A301620']['valuesKnown'][n]
|
|
42
|
+
assert A000560(n) == dictionaryOEISMeanders['A000560']['valuesKnown'][n]
|
|
43
|
+
assert A000682(n) == dictionaryOEISMeanders['A000682']['valuesKnown'][n]
|
|
44
|
+
assert A001010(n) == dictionaryOEISMeanders['A001010']['valuesKnown'][n]
|
|
45
|
+
assert A001011(n) == dictionaryOEISMeanders['A001011']['valuesKnown'][n]
|
|
46
|
+
assert A005315(n) == dictionaryOEISMeanders['A005315']['valuesKnown'][n]
|
|
47
|
+
assert A005316(n) == dictionaryOEISMeanders['A005316']['valuesKnown'][n]
|
|
48
|
+
assert A223094(n) == dictionaryOEISMeanders['A223094']['valuesKnown'][n]
|
|
49
|
+
assert A259702(n) == dictionaryOEISMeanders['A259702']['valuesKnown'][n]
|
|
50
|
+
assert A301620(n) == dictionaryOEISMeanders['A301620']['valuesKnown'][n]
|
|
54
51
|
|
|
55
52
|
sys.stdout.write(f"\nTrue for {str(rangeTest)}\n")
|
mapFolding/_theTypes.py
CHANGED
|
@@ -36,7 +36,7 @@ NumPyFoldsTotal: TypeAlias = numpy_uint64 # noqa: UP040 The TypeAlias may be us
|
|
|
36
36
|
|
|
37
37
|
Note well
|
|
38
38
|
---------
|
|
39
|
-
If your elements might exceed 1.8
|
|
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
40
|
different data structure."""
|
|
41
41
|
|
|
42
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.
|
mapFolding/basecamp.py
CHANGED
|
@@ -134,7 +134,79 @@ def countFolds(listDimensions: Sequence[int] | None = None
|
|
|
134
134
|
|
|
135
135
|
# Flow control until I can figure out a good way ---------------------------------
|
|
136
136
|
|
|
137
|
-
|
|
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.dataPackingA007822 import sequential # noqa: PLC0415
|
|
188
|
+
mapFoldingState = sequential(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
|
|
|
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.
|
|
150
|
-
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
|
|
|
158
238
|
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
159
239
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
160
240
|
|
|
161
|
-
from mapFolding.syntheticModules.
|
|
162
|
-
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
|
|
|
170
250
|
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
171
251
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
172
252
|
|
|
173
|
-
from mapFolding.syntheticModules.
|
|
174
|
-
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
|
|
|
182
262
|
from mapFolding.dataBaskets import ParallelMapFoldingState # noqa: PLC0415
|
|
183
263
|
parallelMapFoldingState: ParallelMapFoldingState = ParallelMapFoldingState(mapShape, taskDivisions=taskDivisions)
|
|
184
264
|
|
|
185
|
-
from mapFolding.syntheticModules.
|
|
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
|
|
|
191
271
|
from mapFolding.dataBaskets import MapFoldingState # noqa: PLC0415
|
|
192
272
|
mapFoldingState: MapFoldingState = MapFoldingState(mapShape)
|
|
193
273
|
|
|
194
|
-
from mapFolding.syntheticModules.
|
|
274
|
+
from mapFolding.syntheticModules.daoOfMapFoldingNumba import doTheNeedful # noqa: PLC0415
|
|
195
275
|
mapFoldingState = doTheNeedful(mapFoldingState)
|
|
196
276
|
foldsTotal = mapFoldingState.foldsTotal
|
|
197
277
|
|
mapFolding/daoOfMapFolding.py
CHANGED
|
@@ -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
|
mapFolding/oeis.py
CHANGED
|
@@ -451,11 +451,7 @@ def oeisIDfor_n(oeisID: str, n: int) -> int:
|
|
|
451
451
|
foldsTotal: int = dictionaryOEIS[oeisID]['valuesKnown'][n]
|
|
452
452
|
return foldsTotal
|
|
453
453
|
|
|
454
|
-
|
|
455
|
-
from mapFolding._A007822 import Z0Z_flowNeedsFixing # noqa: PLC0415
|
|
456
|
-
return Z0Z_flowNeedsFixing(mapShape)
|
|
457
|
-
|
|
458
|
-
return countFolds(mapShape)
|
|
454
|
+
return countFolds(mapShape, oeisID=oeisID)
|
|
459
455
|
|
|
460
456
|
def OEIS_for_n() -> None:
|
|
461
457
|
"""Command-line interface for calculating OEIS sequence values.
|
mapFolding/reference/jaxCount.py
CHANGED
|
@@ -18,7 +18,7 @@ over other approaches and presented additional complexity. It serves as a valuab
|
|
|
18
18
|
for exploring alternative acceleration strategies and understanding the limitations of
|
|
19
19
|
different computational frameworks for this specific algorithm.
|
|
20
20
|
"""
|
|
21
|
-
from flattened import
|
|
21
|
+
from flattened import getLeavesTotal, makeConnectionGraph, validateListDimensions
|
|
22
22
|
from numpy.typing import NDArray
|
|
23
23
|
from typing import Any
|
|
24
24
|
import jax
|
|
@@ -18,8 +18,8 @@ structure can be creatively redesigned while maintaining the core computational
|
|
|
18
18
|
|
|
19
19
|
from mapFolding import outfitFoldings
|
|
20
20
|
from numba import njit
|
|
21
|
-
import numpy
|
|
22
21
|
from numpy.typing import NDArray
|
|
22
|
+
import numpy
|
|
23
23
|
|
|
24
24
|
"""
|
|
25
25
|
It is possible to enter the main `while` loop from an arbitrary point. This version is "rotated" to effectively enter at the modulo operator.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from astToolkit import extractFunctionDef # noqa: D100
|
|
2
|
+
from hunterMakesPy import raiseIfNone
|
|
3
|
+
from mapFolding.someAssemblyRequired.infoBooth import (
|
|
4
|
+
dataclassInstanceIdentifierDEFAULT, sourceCallableIdentifierDEFAULT, theCountingIdentifierDEFAULT)
|
|
5
|
+
import ast
|
|
6
|
+
|
|
7
|
+
Z0Z_identifier = 'filterAsymmetricFolds'
|
|
8
|
+
ImaString = f"""
|
|
9
|
+
def {Z0Z_identifier}(state: MapFoldingState) -> MapFoldingState:
|
|
10
|
+
state.indexLeaf = 0
|
|
11
|
+
leafConnectee = 0
|
|
12
|
+
while leafConnectee < state.leavesTotal + 1:
|
|
13
|
+
leafNumber = int(state.leafBelow[state.indexLeaf])
|
|
14
|
+
state.leafComparison[leafConnectee] = (leafNumber - state.indexLeaf + state.leavesTotal) % state.leavesTotal
|
|
15
|
+
state.indexLeaf = leafNumber
|
|
16
|
+
leafConnectee += 1
|
|
17
|
+
|
|
18
|
+
indexInMiddle = state.leavesTotal // 2
|
|
19
|
+
state.indexMiniGap = 0
|
|
20
|
+
while state.indexMiniGap < state.leavesTotal + 1:
|
|
21
|
+
ImaSymmetricFold = True
|
|
22
|
+
leafConnectee = 0
|
|
23
|
+
while leafConnectee < indexInMiddle:
|
|
24
|
+
if state.leafComparison[(state.indexMiniGap + leafConnectee) % (state.leavesTotal + 1)] != state.leafComparison[(state.indexMiniGap + state.leavesTotal + 1 - 2 - leafConnectee) % (state.leavesTotal + 1)]:
|
|
25
|
+
ImaSymmetricFold = False
|
|
26
|
+
break
|
|
27
|
+
leafConnectee += 1
|
|
28
|
+
if ImaSymmetricFold:
|
|
29
|
+
state.groupsOfFolds += 1
|
|
30
|
+
state.indexMiniGap += 1
|
|
31
|
+
|
|
32
|
+
return state
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
FunctionDef_filterAsymmetricFolds: ast.FunctionDef = raiseIfNone(extractFunctionDef(ast.parse(ImaString), Z0Z_identifier))
|
|
36
|
+
del ImaString
|
|
37
|
+
|
|
38
|
+
ImaString = f"{dataclassInstanceIdentifierDEFAULT} = {Z0Z_identifier}({dataclassInstanceIdentifierDEFAULT})"
|
|
39
|
+
Z0Z_incrementCount = ast.parse(ImaString).body[0]
|
|
40
|
+
del ImaString
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
ImaString = 'state.groupsOfFolds = (state.groupsOfFolds + 1) // 2'
|
|
44
|
+
Z0Z_adjustFoldsTotal = ast.parse(ImaString).body[0]
|
|
45
|
+
del ImaString
|
|
46
|
+
|