mapFolding 0.2.0__py3-none-any.whl → 0.2.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.
@@ -46,15 +46,15 @@ def countFolds(listDimensions: List[int]) -> int:
46
46
 
47
47
  """Step for... for... for...: fill the connection graph"""
48
48
  for dimension1ndex in range(1, dimensionsTotal + 1):
49
- for activeLeaf1ndex in range(1, leavesTotal + 1):
50
- for leaf1ndexConnectee in range(1, activeLeaf1ndex + 1):
51
- connectionGraph[dimension1ndex, activeLeaf1ndex, leaf1ndexConnectee] = (0 if leaf1ndexConnectee == 0
52
- else ((leaf1ndexConnectee if coordinateSystem[dimension1ndex, leaf1ndexConnectee] == 1
53
- else leaf1ndexConnectee - cumulativeProduct[dimension1ndex - 1])
54
- if (coordinateSystem[dimension1ndex, activeLeaf1ndex] & 1) == (coordinateSystem[dimension1ndex, leaf1ndexConnectee] & 1)
55
- else (leaf1ndexConnectee if coordinateSystem[dimension1ndex, leaf1ndexConnectee] == listDimensions[dimension1ndex-1]
56
- or leaf1ndexConnectee + cumulativeProduct[dimension1ndex - 1] > activeLeaf1ndex
57
- else leaf1ndexConnectee + cumulativeProduct[dimension1ndex - 1])))
49
+ for leaf1ndex in range(1, leavesTotal + 1):
50
+ for leafConnectee in range(1, leaf1ndex + 1):
51
+ connectionGraph[dimension1ndex, leaf1ndex, leafConnectee] = (0 if leafConnectee == 0
52
+ else ((leafConnectee if coordinateSystem[dimension1ndex, leafConnectee] == 1
53
+ else leafConnectee - cumulativeProduct[dimension1ndex - 1])
54
+ if (coordinateSystem[dimension1ndex, leaf1ndex] & 1) == (coordinateSystem[dimension1ndex, leafConnectee] & 1)
55
+ else (leafConnectee if coordinateSystem[dimension1ndex, leafConnectee] == listDimensions[dimension1ndex-1]
56
+ or leafConnectee + cumulativeProduct[dimension1ndex - 1] > leaf1ndex
57
+ else leafConnectee + cumulativeProduct[dimension1ndex - 1])))
58
58
 
59
59
  """Indices of array `track` (to "track" the execution state), which is a collection of one-dimensional arrays each of length `leavesTotal + 1`."""
60
60
  leafAbove = numba.literally(0)
@@ -66,67 +66,67 @@ def countFolds(listDimensions: List[int]) -> int:
66
66
  gapsWhere = numpy.zeros(integerLarge(integerLarge(leavesTotal) * integerLarge(leavesTotal) + 1), dtype=dtypeMaximum)
67
67
 
68
68
  foldsTotal = integerLarge(0)
69
- activeLeaf1ndex = integerSmall(1)
70
- activeGap1ndex = integerSmall(0)
69
+ leaf1ndex = integerSmall(1)
70
+ gap1ndex = integerSmall(0)
71
71
 
72
- while activeLeaf1ndex > 0:
73
- if activeLeaf1ndex <= 1 or track[leafBelow, 0] == 1:
74
- if activeLeaf1ndex > leavesTotal:
72
+ while leaf1ndex > 0:
73
+ if leaf1ndex <= 1 or track[leafBelow, 0] == 1:
74
+ if leaf1ndex > leavesTotal:
75
75
  foldsTotal += leavesTotal
76
76
  else:
77
77
  dimensionsUnconstrained = integerSmall(0)
78
- """Track possible gaps for activeLeaf1ndex in each section"""
79
- gap1ndexCeiling = track[gapRangeStart, activeLeaf1ndex - 1]
78
+ """Track possible gaps for leaf1ndex in each section"""
79
+ gap1ndexCeiling = track[gapRangeStart, leaf1ndex - 1]
80
80
 
81
- """Count possible gaps for activeLeaf1ndex in each section"""
81
+ """Count possible gaps for leaf1ndex in each section"""
82
82
  dimension1ndex = integerSmall(1)
83
83
  while dimension1ndex <= dimensionsTotal:
84
- if connectionGraph[dimension1ndex, activeLeaf1ndex, activeLeaf1ndex] == activeLeaf1ndex:
84
+ if connectionGraph[dimension1ndex, leaf1ndex, leaf1ndex] == leaf1ndex:
85
85
  dimensionsUnconstrained += 1
86
86
  else:
87
- leaf1ndexConnectee = connectionGraph[dimension1ndex, activeLeaf1ndex, activeLeaf1ndex]
88
- while leaf1ndexConnectee != activeLeaf1ndex:
89
- gapsWhere[gap1ndexCeiling] = leaf1ndexConnectee
90
- if track[countDimensionsGapped, leaf1ndexConnectee] == 0:
87
+ leafConnectee = connectionGraph[dimension1ndex, leaf1ndex, leaf1ndex]
88
+ while leafConnectee != leaf1ndex:
89
+ gapsWhere[gap1ndexCeiling] = leafConnectee
90
+ if track[countDimensionsGapped, leafConnectee] == 0:
91
91
  gap1ndexCeiling += 1
92
- track[countDimensionsGapped, leaf1ndexConnectee] += 1
93
- leaf1ndexConnectee = connectionGraph[dimension1ndex, activeLeaf1ndex, track[leafBelow, leaf1ndexConnectee]]
92
+ track[countDimensionsGapped, leafConnectee] += 1
93
+ leafConnectee = connectionGraph[dimension1ndex, leaf1ndex, track[leafBelow, leafConnectee]]
94
94
  dimension1ndex += 1
95
95
 
96
- """If activeLeaf1ndex is unconstrained in all sections, it can be inserted anywhere"""
96
+ """If leaf1ndex is unconstrained in all sections, it can be inserted anywhere"""
97
97
  if dimensionsUnconstrained == dimensionsTotal:
98
- leaf1ndex = integerSmall(0)
99
- while leaf1ndex < activeLeaf1ndex:
100
- gapsWhere[gap1ndexCeiling] = leaf1ndex
98
+ indexLeaf = integerSmall(0)
99
+ while indexLeaf < leaf1ndex:
100
+ gapsWhere[gap1ndexCeiling] = indexLeaf
101
101
  gap1ndexCeiling += 1
102
- leaf1ndex += 1
102
+ indexLeaf += 1
103
103
 
104
104
  """Filter gaps that are common to all sections"""
105
- indexMiniGap = activeGap1ndex
105
+ indexMiniGap = gap1ndex
106
106
  while indexMiniGap < gap1ndexCeiling:
107
- gapsWhere[activeGap1ndex] = gapsWhere[indexMiniGap]
107
+ gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
108
108
  if track[countDimensionsGapped, gapsWhere[indexMiniGap]] == dimensionsTotal - dimensionsUnconstrained:
109
- activeGap1ndex += 1
109
+ gap1ndex += 1
110
110
  """Reset track[countDimensionsGapped] for next iteration"""
111
111
  track[countDimensionsGapped, gapsWhere[indexMiniGap]] = 0
112
112
  indexMiniGap += 1
113
113
 
114
114
  """Recursive backtracking steps"""
115
- while activeLeaf1ndex > 0 and activeGap1ndex == track[gapRangeStart, activeLeaf1ndex - 1]:
116
- activeLeaf1ndex -= 1
117
- track[leafBelow, track[leafAbove, activeLeaf1ndex]] = track[leafBelow, activeLeaf1ndex]
118
- track[leafAbove, track[leafBelow, activeLeaf1ndex]] = track[leafAbove, activeLeaf1ndex]
115
+ while leaf1ndex > 0 and gap1ndex == track[gapRangeStart, leaf1ndex - 1]:
116
+ leaf1ndex -= 1
117
+ track[leafBelow, track[leafAbove, leaf1ndex]] = track[leafBelow, leaf1ndex]
118
+ track[leafAbove, track[leafBelow, leaf1ndex]] = track[leafAbove, leaf1ndex]
119
119
 
120
120
  """Place leaf in valid position"""
121
- if activeLeaf1ndex > 0:
122
- activeGap1ndex -= 1
123
- track[leafAbove, activeLeaf1ndex] = gapsWhere[activeGap1ndex]
124
- track[leafBelow, activeLeaf1ndex] = track[leafBelow, track[leafAbove, activeLeaf1ndex]]
125
- track[leafBelow, track[leafAbove, activeLeaf1ndex]] = activeLeaf1ndex
126
- track[leafAbove, track[leafBelow, activeLeaf1ndex]] = activeLeaf1ndex
121
+ if leaf1ndex > 0:
122
+ gap1ndex -= 1
123
+ track[leafAbove, leaf1ndex] = gapsWhere[gap1ndex]
124
+ track[leafBelow, leaf1ndex] = track[leafBelow, track[leafAbove, leaf1ndex]]
125
+ track[leafBelow, track[leafAbove, leaf1ndex]] = leaf1ndex
126
+ track[leafAbove, track[leafBelow, leaf1ndex]] = leaf1ndex
127
127
  """Save current gap index"""
128
- track[gapRangeStart, activeLeaf1ndex] = activeGap1ndex
128
+ track[gapRangeStart, leaf1ndex] = gap1ndex
129
129
  """Move to next leaf"""
130
- activeLeaf1ndex += 1
130
+ leaf1ndex += 1
131
131
 
132
132
  return int(foldsTotal)
@@ -9,11 +9,11 @@ def foldings(p, job=None):
9
9
  p.insert(0, None) # NOTE mimics Atlas `array` type
10
10
 
11
11
  if job is None:
12
- global f
13
- f = 0
12
+ global G
13
+ G = 0
14
14
  def job(A, B):
15
- global f
16
- f = f + 1
15
+ global G
16
+ G = G + 1
17
17
  return foldings(p, job)
18
18
  # perform job (A, B) on each folding of a p[1] x ... x p[d] map,
19
19
  # where A and B are the above and below vectors. p[d + 1] < 0 terminates p;
@@ -150,4 +150,4 @@ def foldings(p, job=None):
150
150
  else:
151
151
  break
152
152
 
153
- return f #if job.__closure__ else None
153
+ return G #if job.__closure__ else None
@@ -13,7 +13,7 @@ def foldings(p: List[int]) -> int:
13
13
  p: A list of integers representing the dimensions of the map.
14
14
 
15
15
  Returns:
16
- f: The number of distinct foldings for the given map dimensions.
16
+ G: The number of distinct foldings for the given map dimensions.
17
17
 
18
18
  NOTE If there are fewer than two dimensions, any dimensions are not positive, or any dimensions are not integers, the output will be unreliable.
19
19
  """
@@ -65,14 +65,14 @@ def foldings(p: List[int]) -> int:
65
65
  # P[i] = p[1] x ... x p[i], C[i][m] = i-th co-ordinate of leaf m,
66
66
  # D[i][l][m] = leaf connected to m in section i when inserting l;
67
67
 
68
- f: int = 0
68
+ G: int = 0
69
69
  l: int = 1
70
70
 
71
71
  # kick off with null folding
72
72
  while l > 0:
73
73
  if l <= 1 or B[0] == 1: # NOTE This statement is part of a significant divergence from the 1971 paper. As a result, this version is greater than one order of magnitude faster.
74
74
  if l > n:
75
- f = f + n # NOTE Due to `B[0] == 1`, this implementation increments the counted foldings in batches of `n`-many foldings, rather than immediately incrementing when a folding is found, i.e. `f = f + 1`
75
+ G = G + n # NOTE Due to `B[0] == 1`, this implementation increments the counted foldings in batches of `n`-many foldings, rather than immediately incrementing when a folding is found, i.e. `G = G + 1`
76
76
  else:
77
77
  dd: int = 0
78
78
  gg: int = gapter[l - 1]
@@ -120,4 +120,4 @@ def foldings(p: List[int]) -> int:
120
120
  A[B[l]] = l
121
121
  gapter[l] = g
122
122
  l = l + 1
123
- return f
123
+ return G
@@ -12,7 +12,7 @@ def foldings(p: Sequence[int]) -> int:
12
12
  p: An array of integers representing the dimensions of the map.
13
13
 
14
14
  Returns:
15
- f: The number of distinct foldings for the given map dimensions.
15
+ G: The number of distinct foldings for the given map dimensions.
16
16
 
17
17
  NOTE If there are fewer than two dimensions, any dimensions are not positive, or any dimensions are not integers, the output will be unreliable.
18
18
  """
@@ -29,7 +29,7 @@ def foldings(p: Sequence[int]) -> int:
29
29
  B = [0] * (n + 1)
30
30
  count = [0] * (n + 1)
31
31
  gapter = [0] * (n + 1)
32
- gap = [0] * (n * n + 1)
32
+ gap = [0] * (n * n + 1)
33
33
 
34
34
  # B[m] is the leaf below leaf m in the current folding,
35
35
  # A[m] the leaf above. count[m] is the no. of sections in which
@@ -64,13 +64,13 @@ def foldings(p: Sequence[int]) -> int:
64
64
  # P[i] = p[1] x ... x p[i], C[i][m] = i-th co-ordinate of leaf m,
65
65
  # D[i][l][m] = leaf connected to m in section i when inserting l;
66
66
 
67
- f: int = 0
67
+ G: int = 0
68
68
  l: int = 1
69
69
 
70
70
  # kick off with null folding
71
71
  while l > 0:
72
72
  if l > n:
73
- f = f + 1
73
+ G = G + 1
74
74
  else:
75
75
  dd: int = 0
76
76
  gg: int = gapter[l - 1]
@@ -118,4 +118,4 @@ def foldings(p: Sequence[int]) -> int:
118
118
  A[B[l]] = l
119
119
  gapter[l] = g
120
120
  l = l + 1
121
- return f
121
+ return G
@@ -21,11 +21,11 @@ gapter = gapRangeStart = 3
21
21
 
22
22
  # Indices of array `my`, which holds dynamic, small, unsigned, integer values.
23
23
  tricky = [
24
- (activeLeaf1ndex := 0),
25
- (activeGap1ndex := 1),
24
+ (leaf1ndex := 0),
25
+ (gap1ndex := 1),
26
26
  (unconstrainedLeaf := 2),
27
27
  (gap1ndexCeiling := 3),
28
- (leaf1ndexConnectee := 4),
28
+ (leafConnectee := 4),
29
29
  (taskIndex := 5),
30
30
  (dimension1ndex := 6),
31
31
  (foldingsSubtotal := 7),
@@ -76,7 +76,7 @@ def countFoldings(TEMPLATEtrack: NDArray,
76
76
  ):
77
77
 
78
78
  TEMPLATEmy = numpy.zeros(COUNTindicesDynamic, dtype=numpy.int64)
79
- TEMPLATEmy[activeLeaf1ndex] = 1
79
+ TEMPLATEmy[leaf1ndex] = 1
80
80
 
81
81
  taskDivisions = 0
82
82
  # taskDivisions = the[leavesTotal]
@@ -87,61 +87,61 @@ def countFoldings(TEMPLATEtrack: NDArray,
87
87
  my: NDArray) -> tuple[NDArray, NDArray, NDArray]:
88
88
  foldingsTotal = 0
89
89
  while True:
90
- if my[activeLeaf1ndex] <= 1 or track[leafBelow][0] == 1:
91
- if my[activeLeaf1ndex] > the[leavesTotal]:
90
+ if my[leaf1ndex] <= 1 or track[leafBelow][0] == 1:
91
+ if my[leaf1ndex] > the[leavesTotal]:
92
92
  foldingsTotal += the[leavesTotal]
93
93
  else:
94
94
  my[unconstrainedLeaf] = 0
95
- my[gap1ndexCeiling] = track[gapRangeStart][my[activeLeaf1ndex] - 1]
96
- my[activeGap1ndex] = my[gap1ndexCeiling]
95
+ my[gap1ndexCeiling] = track[gapRangeStart][my[leaf1ndex] - 1]
96
+ my[gap1ndex] = my[gap1ndexCeiling]
97
97
 
98
98
  for PREPAREdimension1ndex in range(1, the[dimensionsPlus1]):
99
- if connectionGraph[PREPAREdimension1ndex][my[activeLeaf1ndex]][my[activeLeaf1ndex]] == my[activeLeaf1ndex]:
99
+ if connectionGraph[PREPAREdimension1ndex][my[leaf1ndex]][my[leaf1ndex]] == my[leaf1ndex]:
100
100
  my[unconstrainedLeaf] += 1
101
101
  else:
102
- my[leaf1ndexConnectee] = connectionGraph[PREPAREdimension1ndex][my[activeLeaf1ndex]][my[activeLeaf1ndex]]
103
- while my[leaf1ndexConnectee] != my[activeLeaf1ndex]:
102
+ my[leafConnectee] = connectionGraph[PREPAREdimension1ndex][my[leaf1ndex]][my[leaf1ndex]]
103
+ while my[leafConnectee] != my[leaf1ndex]:
104
104
 
105
- if my[leaf1ndexConnectee] != my[activeLeaf1ndex]:
105
+ if my[leafConnectee] != my[leaf1ndex]:
106
106
  my[dimension1ndex] = PREPAREdimension1ndex
107
107
  return track, gapsWhere, my
108
108
 
109
- if my[activeLeaf1ndex] != the[leavesTotal]:
110
- gapsWhere[my[gap1ndexCeiling]] = my[leaf1ndexConnectee]
111
- if track[countDimensionsGapped][my[leaf1ndexConnectee]] == 0:
109
+ if my[leaf1ndex] != the[leavesTotal]:
110
+ gapsWhere[my[gap1ndexCeiling]] = my[leafConnectee]
111
+ if track[countDimensionsGapped][my[leafConnectee]] == 0:
112
112
  my[gap1ndexCeiling] += 1
113
- track[countDimensionsGapped][my[leaf1ndexConnectee]] += 1
113
+ track[countDimensionsGapped][my[leafConnectee]] += 1
114
114
  else:
115
115
  print("else")
116
116
  my[dimension1ndex] = PREPAREdimension1ndex
117
117
  return track, gapsWhere, my
118
- # PREPAREmy[leaf1ndexConnectee] % the[leavesTotal] == PREPAREmy[taskIndex]
119
- my[leaf1ndexConnectee] = connectionGraph[dimension1ndex][my[activeLeaf1ndex]][track[leafBelow][my[leaf1ndexConnectee]]]
118
+ # PREPAREmy[leafConnectee] % the[leavesTotal] == PREPAREmy[taskIndex]
119
+ my[leafConnectee] = connectionGraph[dimension1ndex][my[leaf1ndex]][track[leafBelow][my[leafConnectee]]]
120
120
 
121
121
  if my[unconstrainedLeaf] == the[dimensionsTotal]:
122
- for leaf1ndex in range(my[activeLeaf1ndex]):
123
- gapsWhere[my[gap1ndexCeiling]] = leaf1ndex
122
+ for indexLeaf in range(my[leaf1ndex]):
123
+ gapsWhere[my[gap1ndexCeiling]] = indexLeaf
124
124
  my[gap1ndexCeiling] += 1
125
125
 
126
- for indexMiniGap in range(my[activeGap1ndex], my[gap1ndexCeiling]):
127
- gapsWhere[my[activeGap1ndex]] = gapsWhere[indexMiniGap]
126
+ for indexMiniGap in range(my[gap1ndex], my[gap1ndexCeiling]):
127
+ gapsWhere[my[gap1ndex]] = gapsWhere[indexMiniGap]
128
128
  if track[countDimensionsGapped][gapsWhere[indexMiniGap]] == the[dimensionsTotal] - my[unconstrainedLeaf]:
129
- my[activeGap1ndex] += 1
129
+ my[gap1ndex] += 1
130
130
  track[countDimensionsGapped][gapsWhere[indexMiniGap]] = 0
131
131
 
132
- while my[activeLeaf1ndex] > 0 and my[activeGap1ndex] == track[gapRangeStart][my[activeLeaf1ndex] - 1]:
133
- my[activeLeaf1ndex] -= 1
134
- track[leafBelow][track[leafAbove][my[activeLeaf1ndex]]] = track[leafBelow][my[activeLeaf1ndex]]
135
- track[leafAbove][track[leafBelow][my[activeLeaf1ndex]]] = track[leafAbove][my[activeLeaf1ndex]]
132
+ while my[leaf1ndex] > 0 and my[gap1ndex] == track[gapRangeStart][my[leaf1ndex] - 1]:
133
+ my[leaf1ndex] -= 1
134
+ track[leafBelow][track[leafAbove][my[leaf1ndex]]] = track[leafBelow][my[leaf1ndex]]
135
+ track[leafAbove][track[leafBelow][my[leaf1ndex]]] = track[leafAbove][my[leaf1ndex]]
136
136
 
137
- if my[activeLeaf1ndex] > 0:
138
- my[activeGap1ndex] -= 1
139
- track[leafAbove][my[activeLeaf1ndex]] = gapsWhere[my[activeGap1ndex]]
140
- track[leafBelow][my[activeLeaf1ndex]] = track[leafBelow][track[leafAbove][my[activeLeaf1ndex]]]
141
- track[leafBelow][track[leafAbove][my[activeLeaf1ndex]]] = my[activeLeaf1ndex]
142
- track[leafAbove][track[leafBelow][my[activeLeaf1ndex]]] = my[activeLeaf1ndex]
143
- track[gapRangeStart][my[activeLeaf1ndex]] = my[activeGap1ndex]
144
- my[activeLeaf1ndex] += 1
137
+ if my[leaf1ndex] > 0:
138
+ my[gap1ndex] -= 1
139
+ track[leafAbove][my[leaf1ndex]] = gapsWhere[my[gap1ndex]]
140
+ track[leafBelow][my[leaf1ndex]] = track[leafBelow][track[leafAbove][my[leaf1ndex]]]
141
+ track[leafBelow][track[leafAbove][my[leaf1ndex]]] = my[leaf1ndex]
142
+ track[leafAbove][track[leafBelow][my[leaf1ndex]]] = my[leaf1ndex]
143
+ track[gapRangeStart][my[leaf1ndex]] = my[gap1ndex]
144
+ my[leaf1ndex] += 1
145
145
 
146
146
  RETURNtrack, RETURNgapsWhere, RETURNmy = prepareWork(TEMPLATEtrack.copy(), TEMPLATEgapsWhere.copy(), TEMPLATEmy.copy())
147
147
 
@@ -166,44 +166,44 @@ def doWork(track: NDArray,
166
166
  thisIsNotTheFirstPass = False
167
167
 
168
168
  while papasGotABrandNewBag:
169
- if my[activeLeaf1ndex] <= 1 or track[leafBelow][0] == 1 or if_activeLeaf1ndex_LTE_1_or_leafBelow_index_0_equals_1 == True:
169
+ if my[leaf1ndex] <= 1 or track[leafBelow][0] == 1 or if_activeLeaf1ndex_LTE_1_or_leafBelow_index_0_equals_1 == True:
170
170
  if_activeLeaf1ndex_LTE_1_or_leafBelow_index_0_equals_1 = False
171
- if my[activeLeaf1ndex] > the[leavesTotal] and thisIsNotTheFirstPass:
171
+ if my[leaf1ndex] > the[leavesTotal] and thisIsNotTheFirstPass:
172
172
  my[foldingsSubtotal] += the[leavesTotal]
173
173
  else:
174
174
  if thisIsNotTheFirstPass:
175
175
  my[unconstrainedLeaf] = 0
176
- my[gap1ndexCeiling] = track[gapRangeStart][my[activeLeaf1ndex] - 1]
177
- my[activeGap1ndex] = my[gap1ndexCeiling]
176
+ my[gap1ndexCeiling] = track[gapRangeStart][my[leaf1ndex] - 1]
177
+ my[gap1ndex] = my[gap1ndexCeiling]
178
178
 
179
179
  for_dimension1ndex_in_range_1_to_dimensionsPlus1 = True
180
180
  while for_dimension1ndex_in_range_1_to_dimensionsPlus1 == True:
181
181
  for_dimension1ndex_in_range_1_to_dimensionsPlus1 = False
182
- if connectionGraph[my[dimension1ndex]][my[activeLeaf1ndex]][my[activeLeaf1ndex]] == my[activeLeaf1ndex] and thisIsNotTheFirstPass:
182
+ if connectionGraph[my[dimension1ndex]][my[leaf1ndex]][my[leaf1ndex]] == my[leaf1ndex] and thisIsNotTheFirstPass:
183
183
  my[unconstrainedLeaf] += 1
184
184
  else:
185
185
  if thisIsNotTheFirstPass:
186
- my[leaf1ndexConnectee] = connectionGraph[my[dimension1ndex]][my[activeLeaf1ndex]][my[activeLeaf1ndex]]
187
- if my[leaf1ndexConnectee] != my[activeLeaf1ndex]:
186
+ my[leafConnectee] = connectionGraph[my[dimension1ndex]][my[leaf1ndex]][my[leaf1ndex]]
187
+ if my[leafConnectee] != my[leaf1ndex]:
188
188
  while_leaf1ndexConnectee_notEquals_activeLeaf1ndex = True
189
189
 
190
190
  while while_leaf1ndexConnectee_notEquals_activeLeaf1ndex == True:
191
191
  while_leaf1ndexConnectee_notEquals_activeLeaf1ndex = False
192
192
  thisIsNotTheFirstPass = True
193
- if taskDivisions==0 or my[activeLeaf1ndex] != taskDivisions:
193
+ if taskDivisions==0 or my[leaf1ndex] != taskDivisions:
194
194
  myTask = True
195
195
  else:
196
- modulo = my[leaf1ndexConnectee] % the[leavesTotal]
196
+ modulo = my[leafConnectee] % the[leavesTotal]
197
197
  if modulo == my[taskIndex]: myTask = True
198
198
  else:
199
199
  myTask = False
200
200
  if myTask:
201
- gapsWhere[my[gap1ndexCeiling]] = my[leaf1ndexConnectee]
202
- if track[countDimensionsGapped][my[leaf1ndexConnectee]] == 0:
201
+ gapsWhere[my[gap1ndexCeiling]] = my[leafConnectee]
202
+ if track[countDimensionsGapped][my[leafConnectee]] == 0:
203
203
  my[gap1ndexCeiling] += 1
204
- track[countDimensionsGapped][my[leaf1ndexConnectee]] += 1
205
- my[leaf1ndexConnectee] = connectionGraph[my[dimension1ndex]][my[activeLeaf1ndex]][track[leafBelow][my[leaf1ndexConnectee]]]
206
- if my[leaf1ndexConnectee] != my[activeLeaf1ndex]:
204
+ track[countDimensionsGapped][my[leafConnectee]] += 1
205
+ my[leafConnectee] = connectionGraph[my[dimension1ndex]][my[leaf1ndex]][track[leafBelow][my[leafConnectee]]]
206
+ if my[leafConnectee] != my[leaf1ndex]:
207
207
  while_leaf1ndexConnectee_notEquals_activeLeaf1ndex = True
208
208
  my[dimension1ndex] += 1
209
209
  if my[dimension1ndex] < the[dimensionsPlus1]:
@@ -212,29 +212,29 @@ def doWork(track: NDArray,
212
212
  my[dimension1ndex] = 1
213
213
 
214
214
  if my[unconstrainedLeaf] == the[dimensionsTotal]:
215
- for leaf1ndex in range(my[activeLeaf1ndex]):
215
+ for leaf1ndex in range(my[leaf1ndex]):
216
216
  gapsWhere[my[gap1ndexCeiling]] = leaf1ndex
217
217
  my[gap1ndexCeiling] += 1
218
218
 
219
- for indexMiniGap in range(my[activeGap1ndex], my[gap1ndexCeiling]):
220
- gapsWhere[my[activeGap1ndex]] = gapsWhere[indexMiniGap]
219
+ for indexMiniGap in range(my[gap1ndex], my[gap1ndexCeiling]):
220
+ gapsWhere[my[gap1ndex]] = gapsWhere[indexMiniGap]
221
221
  if track[countDimensionsGapped][gapsWhere[indexMiniGap]] == the[dimensionsTotal] - my[unconstrainedLeaf]:
222
- my[activeGap1ndex] += 1
222
+ my[gap1ndex] += 1
223
223
  track[countDimensionsGapped][gapsWhere[indexMiniGap]] = 0
224
224
 
225
- while my[activeLeaf1ndex] > 0 and my[activeGap1ndex] == track[gapRangeStart][my[activeLeaf1ndex] - 1]:
226
- my[activeLeaf1ndex] -= 1
227
- track[leafBelow][track[leafAbove][my[activeLeaf1ndex]]] = track[leafBelow][my[activeLeaf1ndex]]
228
- track[leafAbove][track[leafBelow][my[activeLeaf1ndex]]] = track[leafAbove][my[activeLeaf1ndex]]
229
-
230
- if my[activeLeaf1ndex] > 0:
231
- my[activeGap1ndex] -= 1
232
- track[leafAbove][my[activeLeaf1ndex]] = gapsWhere[my[activeGap1ndex]]
233
- track[leafBelow][my[activeLeaf1ndex]] = track[leafBelow][track[leafAbove][my[activeLeaf1ndex]]]
234
- track[leafBelow][track[leafAbove][my[activeLeaf1ndex]]] = my[activeLeaf1ndex]
235
- track[leafAbove][track[leafBelow][my[activeLeaf1ndex]]] = my[activeLeaf1ndex]
236
- track[gapRangeStart][my[activeLeaf1ndex]] = my[activeGap1ndex]
237
- my[activeLeaf1ndex] += 1
238
-
239
- if my[activeLeaf1ndex] <= 0:
225
+ while my[leaf1ndex] > 0 and my[gap1ndex] == track[gapRangeStart][my[leaf1ndex] - 1]:
226
+ my[leaf1ndex] -= 1
227
+ track[leafBelow][track[leafAbove][my[leaf1ndex]]] = track[leafBelow][my[leaf1ndex]]
228
+ track[leafAbove][track[leafBelow][my[leaf1ndex]]] = track[leafAbove][my[leaf1ndex]]
229
+
230
+ if my[leaf1ndex] > 0:
231
+ my[gap1ndex] -= 1
232
+ track[leafAbove][my[leaf1ndex]] = gapsWhere[my[gap1ndex]]
233
+ track[leafBelow][my[leaf1ndex]] = track[leafBelow][track[leafAbove][my[leaf1ndex]]]
234
+ track[leafBelow][track[leafAbove][my[leaf1ndex]]] = my[leaf1ndex]
235
+ track[leafAbove][track[leafBelow][my[leaf1ndex]]] = my[leaf1ndex]
236
+ track[gapRangeStart][my[leaf1ndex]] = my[gap1ndex]
237
+ my[leaf1ndex] += 1
238
+
239
+ if my[leaf1ndex] <= 0:
240
240
  return my[foldingsSubtotal]