mapFolding 0.3.4__py3-none-any.whl → 0.3.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mapFolding
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Count distinct ways to fold a map (or a strip of stamps)
5
5
  Author-email: Hunter Hogan <HunterHogan@pm.me>
6
6
  License: CC-BY-NC-4.0
@@ -14,13 +14,13 @@ someAssemblyRequired/generalizeSourceCode.py,sha256=qyJD0ZdG0t-SYTItL_JjaIXm3-jo
14
14
  someAssemblyRequired/getLLVMforNoReason.py,sha256=FtJzw2pZS3A4NimWdZsegXaU-vKeCw8m67kcfb5wvGM,894
15
15
  someAssemblyRequired/makeJob.py,sha256=iaLjr-FhFloTF6wSuwOpurgpqJulZht9CxNo9MDidbg,949
16
16
  someAssemblyRequired/synthesizeModuleJob.py,sha256=xLak-ZZ1zQ92jBobhJqbnA1Fua9ofiRvLdK1fmD8s_s,7271
17
- someAssemblyRequired/synthesizeModules.py,sha256=JGOx69DGCcCntRtw7aOXXcmERCHqVyhFo1oiKh3P8Mg,8842
17
+ someAssemblyRequired/synthesizeModules.py,sha256=6aXlCjvObg28-zxjA1EUnqnLWOnY9nnbJQjUoWHGIcg,12386
18
18
  syntheticModules/__init__.py,sha256=nDtS5UFMKN-F5pTp0qKA0J0I-XR3n3OFxV2bosieBu8,131
19
- syntheticModules/countInitialize.py,sha256=QqKfQxCmUJuJutNxOZ0VfqYEHnuk7XSkCYx7RKz3kn4,4239
20
- syntheticModules/countParallel.py,sha256=77JzO3TsccjSUJRExZ0Nxdqowd_Sm0_2bRziVx5XMI4,5355
21
- syntheticModules/countSequential.py,sha256=QixgcN9R5zcrmJjxSO4oOCYViWogA35HbDNlni9hw8o,3655
22
- mapFolding-0.3.4.dist-info/METADATA,sha256=v8MJLZBzqS2hBp4trsRjjLzn8RAsddUPg16IiI9J1cg,7617
23
- mapFolding-0.3.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
24
- mapFolding-0.3.4.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
25
- mapFolding-0.3.4.dist-info/top_level.txt,sha256=yVG9dNZywoaddcsUdEDg7o0XOBzJd_4Z-sDaXGHpiMY,69
26
- mapFolding-0.3.4.dist-info/RECORD,,
19
+ syntheticModules/countInitialize.py,sha256=6lau9X-1isrp4r0ujBzU0kZRA-0EoSet1y0VkUjDuO0,4239
20
+ syntheticModules/countParallel.py,sha256=fZEExMrepcNaH7pxfLKPAzHDegHYErT2v1J7wXJrv1Y,5340
21
+ syntheticModules/countSequential.py,sha256=1lYp9_0oYs3W_-2vRrDmeXc2MxjTQeQZ2IFdJW5FOIU,3640
22
+ mapFolding-0.3.5.dist-info/METADATA,sha256=NlyubESEbm95_tv3g2Uwr9U1imEkSlv8WXXnM7fLV_8,7617
23
+ mapFolding-0.3.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
24
+ mapFolding-0.3.5.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
25
+ mapFolding-0.3.5.dist-info/top_level.txt,sha256=yVG9dNZywoaddcsUdEDg7o0XOBzJd_4Z-sDaXGHpiMY,69
26
+ mapFolding-0.3.5.dist-info/RECORD,,
@@ -1,10 +1,10 @@
1
1
  from mapFolding import indexMy, indexTrack, getAlgorithmSource, ParametersNumba, parametersNumbaDEFAULT, hackSSOTdtype
2
- from mapFolding import datatypeLargeDEFAULT, datatypeMediumDEFAULT, datatypeSmallDEFAULT
2
+ from mapFolding import datatypeLargeDEFAULT, datatypeMediumDEFAULT, datatypeSmallDEFAULT, EnumIndices
3
3
  import pathlib
4
4
  import inspect
5
5
  import numpy
6
6
  import numba
7
- from typing import Dict, Optional, List, Set, Union, Sequence
7
+ from typing import Dict, Optional, List, Union, Sequence, Type, cast
8
8
  import ast
9
9
 
10
10
  algorithmSource = getAlgorithmSource()
@@ -15,7 +15,7 @@ class RecursiveInliner(ast.NodeTransformer):
15
15
  self.processed = set()
16
16
 
17
17
  def inlineFunctionBody(self, functionName: str) -> Optional[ast.FunctionDef]:
18
- if functionName in self.processed:
18
+ if (functionName in self.processed):
19
19
  return None
20
20
 
21
21
  self.processed.add(functionName)
@@ -27,39 +27,38 @@ class RecursiveInliner(ast.NodeTransformer):
27
27
 
28
28
  def visit_Call(self, node: ast.Call) -> ast.AST:
29
29
  callNode = self.generic_visit(node)
30
- if isinstance(callNode, ast.Call) and isinstance(callNode.func, ast.Name) and callNode.func.id in self.dictionaryFunctions:
30
+ if (isinstance(callNode, ast.Call) and isinstance(callNode.func, ast.Name) and callNode.func.id in self.dictionaryFunctions):
31
31
  inlineDefinition = self.inlineFunctionBody(callNode.func.id)
32
32
  if (inlineDefinition and inlineDefinition.body):
33
33
  lastStmt = inlineDefinition.body[-1]
34
- if isinstance(lastStmt, ast.Return) and lastStmt.value is not None:
34
+ if (isinstance(lastStmt, ast.Return) and lastStmt.value is not None):
35
35
  return self.visit(lastStmt.value)
36
- elif isinstance(lastStmt, ast.Expr) and lastStmt.value is not None:
36
+ elif (isinstance(lastStmt, ast.Expr) and lastStmt.value is not None):
37
37
  return self.visit(lastStmt.value)
38
38
  return ast.Constant(value=None)
39
39
  return callNode
40
40
 
41
41
  def visit_Expr(self, node: ast.Expr) -> Union[ast.AST, List[ast.AST]]:
42
- if isinstance(node.value, ast.Call):
43
- if isinstance(node.value.func, ast.Name) and node.value.func.id in self.dictionaryFunctions:
42
+ if (isinstance(node.value, ast.Call)):
43
+ if (isinstance(node.value.func, ast.Name) and node.value.func.id in self.dictionaryFunctions):
44
44
  inlineDefinition = self.inlineFunctionBody(node.value.func.id)
45
- if inlineDefinition:
45
+ if (inlineDefinition):
46
46
  return [self.visit(stmt) for stmt in inlineDefinition.body]
47
47
  return self.generic_visit(node)
48
48
 
49
- def decorateCallableWithNumba(astCallable: ast.FunctionDef, parallel: bool=False, **keywordArguments: Optional[str]):
49
+ def decorateCallableWithNumba(astCallable: ast.FunctionDef, parallel: bool=False, **keywordArguments: Optional[str]) -> ast.FunctionDef:
50
50
  def makeNumbaParameterSignatureElement(signatureElement: ast.arg):
51
51
  if isinstance(signatureElement.annotation, ast.Subscript) and isinstance(signatureElement.annotation.slice, ast.Tuple):
52
-
53
52
  annotationShape = signatureElement.annotation.slice.elts[0]
54
53
  if isinstance(annotationShape, ast.Subscript) and isinstance(annotationShape.slice, ast.Tuple):
55
- shapeAsListSlices = [ast.Slice() for axis in range(len(annotationShape.slice.elts))]
54
+ shapeAsListSlices: Sequence[ast.expr] = [ast.Slice() for axis in range(len(annotationShape.slice.elts))]
56
55
  shapeAsListSlices[-1] = ast.Slice(step=ast.Constant(value=1))
57
- shapeAST = ast.Tuple(elts=shapeAsListSlices, ctx=ast.Load())
56
+ shapeAST = ast.Tuple(elts=list(shapeAsListSlices), ctx=ast.Load())
58
57
  else:
59
58
  shapeAST = ast.Slice(step=ast.Constant(value=1))
60
59
 
61
60
  annotationDtype = signatureElement.annotation.slice.elts[1]
62
- if isinstance(annotationDtype, ast.Subscript) and isinstance(annotationDtype.slice, ast.Attribute):
61
+ if (isinstance(annotationDtype, ast.Subscript) and isinstance(annotationDtype.slice, ast.Attribute)):
63
62
  datatypeAST = annotationDtype.slice.attr
64
63
  else:
65
64
  datatypeAST = None
@@ -75,10 +74,10 @@ def decorateCallableWithNumba(astCallable: ast.FunctionDef, parallel: bool=False
75
74
 
76
75
  # callableSourceDecorators = [decorator for decorator in callableInlined.decorator_list]
77
76
 
78
- listNumbaParameterSignature: List[ast.Subscript] = []
77
+ listNumbaParameterSignature: Sequence[ast.expr] = []
79
78
  for parameter in astCallable.args.args:
80
79
  signatureElement = makeNumbaParameterSignatureElement(parameter)
81
- if signatureElement:
80
+ if (signatureElement):
82
81
  listNumbaParameterSignature.append(signatureElement)
83
82
 
84
83
  astArgsNumbaSignature = ast.Tuple(elts=listNumbaParameterSignature, ctx=ast.Load())
@@ -91,6 +90,115 @@ def decorateCallableWithNumba(astCallable: ast.FunctionDef, parallel: bool=False
91
90
  astCallable.decorator_list = [astDecoratorNumba]
92
91
  return astCallable
93
92
 
93
+ class UnpackArrayAccesses(ast.NodeTransformer):
94
+ """AST transformer that replaces array accesses with simpler variables."""
95
+
96
+ def __init__(self, enumIndexClass: Type[EnumIndices], arrayName: str):
97
+ self.enumIndexClass = enumIndexClass
98
+ self.arrayName = arrayName
99
+ self.substitutions = {}
100
+
101
+ def extract_member_name(self, node: ast.AST) -> Optional[str]:
102
+ """Recursively extract enum member name from any node in the AST."""
103
+ if isinstance(node, ast.Attribute) and node.attr == 'value':
104
+ innerAttribute = node.value
105
+ while isinstance(innerAttribute, ast.Attribute):
106
+ if (isinstance(innerAttribute.value, ast.Name) and innerAttribute.value.id == self.enumIndexClass.__name__):
107
+ return innerAttribute.attr
108
+ innerAttribute = innerAttribute.value
109
+ return None
110
+
111
+ def transform_slice_element(self, node: ast.AST) -> ast.AST:
112
+ """Transform any enum references within a slice element."""
113
+ if isinstance(node, ast.Subscript):
114
+ if isinstance(node.slice, ast.Attribute):
115
+ member_name = self.extract_member_name(node.slice)
116
+ if member_name:
117
+ return ast.Name(id=member_name, ctx=node.ctx)
118
+ elif isinstance(node, ast.Tuple):
119
+ # Handle tuple slices by transforming each element
120
+ return ast.Tuple(
121
+ elts=cast(List[ast.expr], [self.transform_slice_element(elt) for elt in node.elts]),
122
+ ctx=node.ctx
123
+ )
124
+ elif isinstance(node, ast.Attribute):
125
+ member_name = self.extract_member_name(node)
126
+ if member_name:
127
+ return ast.Name(id=member_name, ctx=ast.Load())
128
+ return node
129
+
130
+ def visit_Subscript(self, node: ast.Subscript) -> ast.AST:
131
+ # Recursively visit any nested subscripts in value or slice
132
+ node.value = self.visit(node.value)
133
+ node.slice = self.visit(node.slice)
134
+
135
+ # If node.value is not our arrayName, just return node
136
+ if not (isinstance(node.value, ast.Name) and node.value.id == self.arrayName):
137
+ return node
138
+
139
+ # Handle scalar array access
140
+ if isinstance(node.slice, ast.Attribute):
141
+ memberName = self.extract_member_name(node.slice)
142
+ if memberName:
143
+ self.substitutions[memberName] = ('scalar', node)
144
+ return ast.Name(id=memberName, ctx=ast.Load())
145
+
146
+ # Handle array slice access
147
+ if isinstance(node.slice, ast.Tuple) and node.slice.elts:
148
+ firstElement = node.slice.elts[0]
149
+ memberName = self.extract_member_name(firstElement)
150
+ sliceRemainder = [self.visit(elem) for elem in node.slice.elts[1:]]
151
+ if memberName:
152
+ self.substitutions[memberName] = ('array', node)
153
+ if len(sliceRemainder) == 0:
154
+ return ast.Name(id=memberName, ctx=ast.Load())
155
+ return ast.Subscript(
156
+ value=ast.Name(id=memberName, ctx=ast.Load()),
157
+ slice=ast.Tuple(elts=sliceRemainder, ctx=ast.Load()) if len(sliceRemainder) > 1 else sliceRemainder[0],
158
+ ctx=ast.Load()
159
+ )
160
+
161
+ # If single-element tuple, unwrap
162
+ if isinstance(node.slice, ast.Tuple) and len(node.slice.elts) == 1:
163
+ node.slice = node.slice.elts[0]
164
+
165
+ return node
166
+
167
+ def visit_FunctionDef(self, node: ast.FunctionDef) -> ast.FunctionDef:
168
+ node = cast(ast.FunctionDef, self.generic_visit(node))
169
+
170
+ initializations = []
171
+ for name, (kind, original_node) in self.substitutions.items():
172
+ if kind == 'scalar':
173
+ initializations.append(
174
+ ast.Assign(
175
+ targets=[ast.Name(id=name, ctx=ast.Store())],
176
+ value=original_node
177
+ )
178
+ )
179
+ else: # array
180
+ initializations.append(
181
+ ast.Assign(
182
+ targets=[ast.Name(id=name, ctx=ast.Store())],
183
+ value=ast.Subscript(
184
+ value=ast.Name(id=self.arrayName, ctx=ast.Load()),
185
+ slice=ast.Attribute(
186
+ value=ast.Attribute(
187
+ value=ast.Name(id=self.enumIndexClass.__name__, ctx=ast.Load()),
188
+ attr=name,
189
+ ctx=ast.Load()
190
+ ),
191
+ attr='value',
192
+ ctx=ast.Load()
193
+ ),
194
+ ctx=ast.Load()
195
+ )
196
+ )
197
+ )
198
+
199
+ node.body = initializations + node.body
200
+ return node
201
+
94
202
  def getDictionaryEnumValues() -> Dict[str, int]:
95
203
  dictionaryEnumValues = {}
96
204
  for enumIndex in [indexMy, indexTrack]:
@@ -98,47 +206,6 @@ def getDictionaryEnumValues() -> Dict[str, int]:
98
206
  dictionaryEnumValues[f"{enumIndex.__name__}.{memberName}.value"] = memberValue.value
99
207
  return dictionaryEnumValues
100
208
 
101
- def unpackArrays(codeInlined: str) -> str:
102
- dictionaryReplaceScalars = {
103
- 'my[indexMy.dimensionsTotal.value]': 'dimensionsTotal',
104
- 'my[indexMy.dimensionsUnconstrained.value]': 'dimensionsUnconstrained',
105
- 'my[indexMy.gap1ndex.value]': 'gap1ndex',
106
- 'my[indexMy.gap1ndexCeiling.value]': 'gap1ndexCeiling',
107
- 'my[indexMy.indexDimension.value]': 'indexDimension',
108
- # 'my[indexMy.indexLeaf.value]': 'indexLeaf',
109
- 'my[indexMy.indexMiniGap.value]': 'indexMiniGap',
110
- 'my[indexMy.leaf1ndex.value]': 'leaf1ndex',
111
- 'my[indexMy.leafConnectee.value]': 'leafConnectee',
112
- # 'my[indexMy.taskDivisions.value]': 'taskDivisions',
113
- 'my[indexMy.taskIndex.value]': 'taskIndex',
114
- # 'foldGroups[-1]': 'leavesTotal',
115
- }
116
-
117
- dictionaryReplaceArrays = {
118
- "track[indexTrack.leafAbove.value, ": 'leafAbove[',
119
- "track[indexTrack.leafBelow.value, ": 'leafBelow[',
120
- 'track[indexTrack.countDimensionsGapped.value, ': 'countDimensionsGapped[',
121
- 'track[indexTrack.gapRangeStart.value, ': 'gapRangeStart[',
122
- }
123
-
124
- ImaIndent = " "
125
- linesInitialize = """"""
126
-
127
- for find, replace in dictionaryReplaceScalars.items():
128
- linesInitialize += f"{ImaIndent}{replace} = {find}\n"
129
- codeInlined = codeInlined.replace(find, replace)
130
-
131
- for find, replace in dictionaryReplaceArrays.items():
132
- linesInitialize += f"{ImaIndent}{replace[0:-1]} = {find[0:-2]}]\n"
133
- codeInlined = codeInlined.replace(find, replace)
134
-
135
- ourGuyOnTheInside = " doFindGaps = True\n"
136
- linesInitialize = ourGuyOnTheInside + linesInitialize
137
-
138
- codeInlined = codeInlined.replace(ourGuyOnTheInside, linesInitialize)
139
-
140
- return codeInlined
141
-
142
209
  def inlineMapFoldingNumba(**keywordArguments: Optional[str]):
143
210
  dictionaryEnumValues = getDictionaryEnumValues()
144
211
  codeSource = inspect.getsource(algorithmSource)
@@ -157,13 +224,20 @@ def inlineMapFoldingNumba(**keywordArguments: Optional[str]):
157
224
  ast.fix_missing_locations(callableInlined)
158
225
  callableDecorated = decorateCallableWithNumba(callableInlined, parallel, **keywordArguments)
159
226
 
160
- importsRequired = "\n".join([ast.unparse(importStatement) for importStatement in codeSourceImportStatements])
227
+ if callableTarget == 'countSequential':
228
+ myUnpacker = UnpackArrayAccesses(indexMy, 'my')
229
+ callableDecorated = cast(ast.FunctionDef, myUnpacker.visit(callableDecorated))
230
+ ast.fix_missing_locations(callableDecorated)
231
+
232
+ trackUnpacker = UnpackArrayAccesses(indexTrack, 'track')
233
+ callableDecorated = cast(ast.FunctionDef, trackUnpacker.visit(callableDecorated))
234
+ ast.fix_missing_locations(callableDecorated)
235
+
161
236
  callableInlined = ast.unparse(callableDecorated)
162
- codeUnpacked = unpackArrays(callableInlined) if callableTarget == 'countSequential' else callableInlined
163
- # inlinedCode = ast.unparse(ast.Module(body=[nodeInlined], type_ignores=[]))
237
+ importsRequired = "\n".join([ast.unparse(importStatement) for importStatement in codeSourceImportStatements])
164
238
 
165
239
  pathFilenameDestination = pathFilenameAlgorithm.parent / "syntheticModules" / pathFilenameAlgorithm.with_stem(callableTarget).name
166
- pathFilenameDestination.write_text(importsRequired + "\n" + codeUnpacked)
240
+ pathFilenameDestination.write_text(importsRequired + "\n" + callableInlined)
167
241
  listPathFilenamesDestination.append(pathFilenameDestination)
168
242
 
169
243
  if __name__ == '__main__':
@@ -1,8 +1,8 @@
1
- from numpy import integer
2
- import numba
3
1
  import numpy
4
- from mapFolding import indexMy, indexTrack
5
2
  from typing import Any, Tuple
3
+ from mapFolding import indexMy, indexTrack
4
+ import numba
5
+ from numpy import integer
6
6
  @numba.jit((numba.uint8[:, :, ::1], numba.uint8[::1], numba.uint8[::1], numba.uint8[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=False, inline='never', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=False)
7
7
  def countInitialize(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dtype[integer[Any]]], gapsWhere: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], my: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], track: numpy.ndarray[Tuple[int, int], numpy.dtype[integer[Any]]]):
8
8
  while my[indexMy.leaf1ndex.value] > 0:
@@ -6,15 +6,15 @@ import numpy
6
6
  @numba.jit((numba.uint8[:, :, ::1], numba.int64[::1], numba.uint8[::1], numba.uint8[::1], numba.uint8[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=False, inline='never', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=True)
7
7
  def countParallel(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dtype[integer[Any]]], foldGroups: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], gapsWherePARALLEL: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], myPARALLEL: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], trackPARALLEL: numpy.ndarray[Tuple[int, int], numpy.dtype[integer[Any]]]):
8
8
  for indexSherpa in numba.prange(myPARALLEL[indexMy.taskDivisions.value]):
9
+ groupsOfFolds: int = 0
9
10
  gapsWhere = gapsWherePARALLEL.copy()
10
11
  my = myPARALLEL.copy()
11
12
  my[indexMy.taskIndex.value] = indexSherpa
12
13
  track = trackPARALLEL.copy()
13
- groupsOfFolds: int = 0
14
14
  while my[indexMy.leaf1ndex.value] > 0:
15
15
  if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
16
16
  if my[indexMy.leaf1ndex.value] > foldGroups[-1]:
17
- groupsOfFolds = groupsOfFolds + 1
17
+ groupsOfFolds += 1
18
18
  else:
19
19
  my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
20
20
  my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
@@ -5,24 +5,24 @@ from mapFolding import indexMy, indexTrack
5
5
  import numpy
6
6
  @numba.jit((numba.uint8[:, :, ::1], numba.int64[::1], numba.uint8[::1], numba.uint8[::1], numba.uint8[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=False, inline='never', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=False)
7
7
  def countSequential(connectionGraph: numpy.ndarray[Tuple[int, int, int], numpy.dtype[integer[Any]]], foldGroups: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], gapsWhere: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], my: numpy.ndarray[Tuple[int], numpy.dtype[integer[Any]]], track: numpy.ndarray[Tuple[int, int], numpy.dtype[integer[Any]]]):
8
- doFindGaps = True
9
- dimensionsTotal = my[indexMy.dimensionsTotal.value]
8
+ leafBelow = track[indexTrack.leafBelow.value]
9
+ gapRangeStart = track[indexTrack.gapRangeStart.value]
10
+ countDimensionsGapped = track[indexTrack.countDimensionsGapped.value]
11
+ leafAbove = track[indexTrack.leafAbove.value]
12
+ leaf1ndex = my[indexMy.leaf1ndex.value]
10
13
  dimensionsUnconstrained = my[indexMy.dimensionsUnconstrained.value]
11
- gap1ndex = my[indexMy.gap1ndex.value]
14
+ dimensionsTotal = my[indexMy.dimensionsTotal.value]
12
15
  gap1ndexCeiling = my[indexMy.gap1ndexCeiling.value]
13
16
  indexDimension = my[indexMy.indexDimension.value]
14
- indexMiniGap = my[indexMy.indexMiniGap.value]
15
- leaf1ndex = my[indexMy.leaf1ndex.value]
16
17
  leafConnectee = my[indexMy.leafConnectee.value]
18
+ indexMiniGap = my[indexMy.indexMiniGap.value]
19
+ gap1ndex = my[indexMy.gap1ndex.value]
17
20
  taskIndex = my[indexMy.taskIndex.value]
18
- leafAbove = track[indexTrack.leafAbove.value]
19
- leafBelow = track[indexTrack.leafBelow.value]
20
- countDimensionsGapped = track[indexTrack.countDimensionsGapped.value]
21
- gapRangeStart = track[indexTrack.gapRangeStart.value]
22
21
  groupsOfFolds: int = 0
22
+ doFindGaps = True
23
23
  while leaf1ndex > 0:
24
24
  if (doFindGaps := (leaf1ndex <= 1 or leafBelow[0] == 1)) and leaf1ndex > foldGroups[-1]:
25
- groupsOfFolds = groupsOfFolds + 1
25
+ groupsOfFolds += 1
26
26
  elif doFindGaps:
27
27
  dimensionsUnconstrained = dimensionsTotal
28
28
  gap1ndexCeiling = gapRangeStart[leaf1ndex - 1]