mapFolding 0.4.2__py3-none-any.whl → 0.5.0__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 (32) hide show
  1. mapFolding/__init__.py +3 -2
  2. mapFolding/basecamp.py +12 -14
  3. mapFolding/beDRY.py +81 -58
  4. mapFolding/oeis.py +35 -33
  5. mapFolding/someAssemblyRequired/makeJob.py +8 -7
  6. mapFolding/someAssemblyRequired/synthesizeModuleJAX.py +1 -3
  7. mapFolding/someAssemblyRequired/synthesizeNumba.py +57 -60
  8. mapFolding/someAssemblyRequired/synthesizeNumbaGeneralized.py +102 -30
  9. mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +18 -36
  10. mapFolding/someAssemblyRequired/synthesizeNumbaModules.py +77 -31
  11. mapFolding/syntheticModules/numbaCount.py +158 -0
  12. mapFolding/syntheticModules/numba_doTheNeedful.py +5 -12
  13. mapFolding/theDao.py +105 -105
  14. mapFolding/theSSOT.py +80 -205
  15. mapFolding/theSSOTdatatypes.py +166 -0
  16. {mapFolding-0.4.2.dist-info → mapFolding-0.5.0.dist-info}/METADATA +2 -1
  17. mapFolding-0.5.0.dist-info/RECORD +39 -0
  18. tests/conftest.py +84 -26
  19. tests/test_computations.py +29 -66
  20. tests/test_oeis.py +8 -12
  21. tests/test_other.py +11 -7
  22. tests/test_tasks.py +5 -5
  23. mapFolding/syntheticModules/numba_countInitialize.py +0 -52
  24. mapFolding/syntheticModules/numba_countParallel.py +0 -65
  25. mapFolding/syntheticModules/numba_countSequential.py +0 -67
  26. mapFolding/theSSOTnumba.py +0 -125
  27. mapFolding-0.4.2.dist-info/RECORD +0 -42
  28. tests/test_types.py +0 -5
  29. {mapFolding-0.4.2.dist-info → mapFolding-0.5.0.dist-info}/LICENSE +0 -0
  30. {mapFolding-0.4.2.dist-info → mapFolding-0.5.0.dist-info}/WHEEL +0 -0
  31. {mapFolding-0.4.2.dist-info → mapFolding-0.5.0.dist-info}/entry_points.txt +0 -0
  32. {mapFolding-0.4.2.dist-info → mapFolding-0.5.0.dist-info}/top_level.txt +0 -0
@@ -4,42 +4,76 @@ everything I am doing. I would rather benefit from humanity's
4
4
  collective wisdom."""
5
5
  from mapFolding.someAssemblyRequired.synthesizeNumba import *
6
6
 
7
- def makeFlowNumbaOptimized(listCallablesInline: List[str], callableDispatcher: Optional[bool] = False, algorithmSource: Optional[ModuleType] = None, relativePathWrite: Optional[pathlib.Path] = None, formatFilenameWrite: Optional[str] = None) -> List[youOughtaKnow]:
8
- if relativePathWrite and relativePathWrite.is_absolute():
9
- raise ValueError("The path to write the module must be relative to the root of the package.")
10
- if not algorithmSource:
11
- algorithmSource = getAlgorithmSource()
7
+ def getFunctionDef(algorithmSource: ModuleType, *arguments, **keywordArguments) -> tuple[ast.FunctionDef, UniversalImportTracker]:
8
+ pythonSource = inspect.getsource(algorithmSource)
9
+ astModule: ast.Module = ast.parse(pythonSource, type_comments=True)
10
+ FunctionDefTarget, allImports = makeFunctionDef(astModule, *arguments, **keywordArguments)
11
+ return FunctionDefTarget, allImports
12
+
13
+ def makePythonSource(listFunctionDefs: list[ast.FunctionDef], listAstImports: list[ast.Import | ast.ImportFrom], additional_imports: list[str]) -> str:
14
+ astModule = ast.Module(body=cast(list[ast.stmt], listAstImports + listFunctionDefs), type_ignores=[])
15
+ ast.fix_missing_locations(astModule)
16
+ pythonSource = ast.unparse(astModule)
17
+ if not pythonSource: raise FREAKOUT
18
+ pythonSource = autoflake.fix_code(pythonSource, additional_imports)
19
+ return pythonSource
12
20
 
13
- listStuffYouOughtaKnow: List[youOughtaKnow] = []
21
+ def writePythonAsModule(pythonSource: str, listCallableSynthesized: list[str], relativePathWrite: Path | None, filenameWrite: str | None, formatFilenameWrite: str | None) -> list[youOughtaKnow]:
22
+ pathFilename = None
23
+ if not relativePathWrite:
24
+ pathWrite = getPathSyntheticModules()
25
+ else:
26
+ pathWrite = getPathPackage() / relativePathWrite
14
27
 
15
- def doThisStuff(callableTarget: str, parametersNumba: Optional[ParametersNumba], inlineCallables: bool, unpackArrays: bool, allImports: Optional[UniversalImportTracker], relativePathWrite: Optional[pathlib.Path], formatFilenameWrite: Optional[str]) -> youOughtaKnow:
16
- pythonSource = inspect.getsource(algorithmSource)
17
- pythonSource = makeAstModuleForOneCallable(pythonSource, callableTarget, parametersNumba, inlineCallables, unpackArrays, allImports)
18
- if not pythonSource: raise FREAKOUT
19
- pythonSource = autoflake.fix_code(pythonSource, ['mapFolding', 'numba', 'numpy'])
28
+ if not formatFilenameWrite:
29
+ formatFilenameWrite = formatFilenameModuleDEFAULT
20
30
 
21
- if not relativePathWrite:
22
- pathWrite = getPathSyntheticModules()
31
+ if not filenameWrite:
32
+ if len(listCallableSynthesized) == 1:
33
+ callableTarget = listCallableSynthesized[0]
23
34
  else:
24
- pathWrite = getPathPackage() / relativePathWrite
25
- if not formatFilenameWrite:
26
- formatFilenameWrite = formatModuleNameDEFAULT + '.py'
27
- pathFilename = pathWrite / formatFilenameWrite.format(callableTarget=callableTarget)
35
+ callableTarget = 'count'
36
+ filenameWrite = formatFilenameWrite.format(callableTarget=callableTarget)
37
+ else:
38
+ if not filenameWrite.endswith('.py'):
39
+ warnings.warn(f"Filename {filenameWrite=} does not end with '.py'.")
28
40
 
29
- pathFilename.write_text(pythonSource)
41
+ pathFilename = pathWrite / filenameWrite
30
42
 
31
- howIsThisStillAThing = getPathPackage().parent
32
- dumbassPythonNamespace = pathFilename.relative_to(howIsThisStillAThing).with_suffix('').parts
33
- ImaModule = '.'.join(dumbassPythonNamespace)
43
+ pathFilename.write_text(pythonSource)
44
+
45
+ howIsThisStillAThing = getPathPackage().parent
46
+ dumbassPythonNamespace = pathFilename.relative_to(howIsThisStillAThing).with_suffix('').parts
47
+ ImaModule = '.'.join(dumbassPythonNamespace)
48
+
49
+ listStuffYouOughtaKnow: list[youOughtaKnow] = []
50
+
51
+ for callableTarget in listCallableSynthesized:
34
52
  astImportFrom = ast.ImportFrom(module=ImaModule, names=[ast.alias(name=callableTarget, asname=None)], level=0)
53
+ stuff = youOughtaKnow(callableSynthesized=callableTarget, pathFilenameForMe=pathFilename, astForCompetentProgrammers=astImportFrom)
54
+ listStuffYouOughtaKnow.append(stuff)
55
+
56
+ return listStuffYouOughtaKnow
35
57
 
36
- return youOughtaKnow(callableSynthesized=callableTarget, pathFilenameForMe=pathFilename, astForCompetentProgrammers=astImportFrom)
58
+ def makeFlowNumbaOptimized(listCallablesInline: list[str], callableDispatcher: bool | None = False, algorithmSource: ModuleType | None = None, relativePathWrite: Path | None = None, filenameModuleWrite: str | None = None, formatFilenameWrite: str | None = None) -> list[youOughtaKnow]:
59
+ if relativePathWrite and relativePathWrite.is_absolute():
60
+ raise ValueError("The path to write the module must be relative to the root of the package.")
61
+ if not algorithmSource:
62
+ algorithmSource = getAlgorithmSource()
63
+
64
+ Z0Z_filenameModuleWrite = 'numbaCount.py'
37
65
 
66
+ listStuffYouOughtaKnow: list[youOughtaKnow] = []
67
+ additional_imports = ['mapFolding', 'numba', 'numpy']
68
+
69
+ listFunctionDefs: list[ast.FunctionDef] = []
70
+ allImportsModule = UniversalImportTracker()
38
71
  for callableTarget in listCallablesInline:
39
72
  parametersNumba = None
40
73
  inlineCallables = True
41
74
  unpackArrays = False
42
75
  allImports = None
76
+ filenameWrite = None
43
77
  match callableTarget:
44
78
  case 'countParallel':
45
79
  parametersNumba = parametersNumbaSuperJitParallel
@@ -48,7 +82,17 @@ def makeFlowNumbaOptimized(listCallablesInline: List[str], callableDispatcher: O
48
82
  unpackArrays = True
49
83
  case 'countInitialize':
50
84
  parametersNumba = parametersNumbaDEFAULT
51
- listStuffYouOughtaKnow.append(doThisStuff(callableTarget, parametersNumba, inlineCallables, unpackArrays, allImports, relativePathWrite, formatFilenameWrite))
85
+ FunctionDefTarget, allImports = getFunctionDef(algorithmSource, callableTarget, parametersNumba, inlineCallables, unpackArrays, allImports)
86
+ listFunctionDefs.append(FunctionDefTarget)
87
+ allImportsModule.update(allImports)
88
+
89
+ listAstImports = allImportsModule.makeListAst()
90
+ pythonSource = makePythonSource(listFunctionDefs, listAstImports, additional_imports)
91
+
92
+ filenameWrite = filenameModuleWrite or Z0Z_filenameModuleWrite
93
+
94
+ listStuff = writePythonAsModule(pythonSource, listCallablesInline, relativePathWrite, filenameWrite, formatFilenameWrite)
95
+ listStuffYouOughtaKnow.extend(listStuff)
52
96
 
53
97
  if callableDispatcher:
54
98
  callableTarget = getAlgorithmDispatcher().__name__
@@ -56,22 +100,24 @@ def makeFlowNumbaOptimized(listCallablesInline: List[str], callableDispatcher: O
56
100
  inlineCallables = False
57
101
  unpackArrays = False
58
102
  allImports = UniversalImportTracker()
103
+ filenameWrite = None
59
104
  for stuff in listStuffYouOughtaKnow:
60
105
  statement = stuff.astForCompetentProgrammers
61
106
  if isinstance(statement, (ast.Import, ast.ImportFrom)):
62
107
  allImports.addAst(statement)
108
+ FunctionDefTarget, allImports = getFunctionDef(algorithmSource, callableTarget, parametersNumba, inlineCallables, unpackArrays, allImports)
109
+ listAstImports = allImports.makeListAst()
110
+
111
+ pythonSource = makePythonSource([FunctionDefTarget], listAstImports, additional_imports)
63
112
 
64
- listStuffYouOughtaKnow.append(doThisStuff(callableTarget, parametersNumba, inlineCallables, unpackArrays, allImports, relativePathWrite, formatFilenameWrite))
113
+ listStuff = writePythonAsModule(pythonSource, [callableTarget], relativePathWrite, filenameWrite, formatFilenameWrite)
114
+ listStuffYouOughtaKnow.extend(listStuff)
65
115
 
66
116
  return listStuffYouOughtaKnow
67
117
 
68
118
  if __name__ == '__main__':
69
- setDatatypeModule('numpy', sourGrapes=True)
70
- setDatatypeFoldsTotal('int64', sourGrapes=True)
71
- setDatatypeElephino('uint8', sourGrapes=True)
72
- setDatatypeLeavesTotal('uint8', sourGrapes=True)
73
- Z0Z_setDatatypeModuleScalar('numba')
74
- Z0Z_setDecoratorCallable('jit')
75
- listCallablesInline: List[str] = ['countInitialize', 'countParallel', 'countSequential']
119
+ # Z0Z_setDatatypeModuleScalar('numba')
120
+ # Z0Z_setDecoratorCallable('jit')
121
+ listCallablesInline: list[str] = ['countInitialize', 'countParallel', 'countSequential']
76
122
  callableDispatcher = True
77
123
  makeFlowNumbaOptimized(listCallablesInline, callableDispatcher)
@@ -0,0 +1,158 @@
1
+ from mapFolding import indexTrack, indexMy
2
+ from numba import int64, prange, uint16, jit
3
+ from numpy import ndarray, dtype, integer
4
+ from typing import Any
5
+
6
+ @jit((uint16[:, :, ::1], uint16[::1], uint16[::1], uint16[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=False, no_cpython_wrapper=False, nopython=True, parallel=False)
7
+ def countInitialize(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
8
+ while my[indexMy.leaf1ndex.value] > 0:
9
+ if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
10
+ my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
11
+ my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
12
+ my[indexMy.indexDimension.value] = 0
13
+ while my[indexMy.indexDimension.value] < my[indexMy.dimensionsTotal.value]:
14
+ if connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]] == my[indexMy.leaf1ndex.value]:
15
+ my[indexMy.dimensionsUnconstrained.value] -= 1
16
+ else:
17
+ my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]]
18
+ while my[indexMy.leafConnectee.value] != my[indexMy.leaf1ndex.value]:
19
+ gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.leafConnectee.value]
20
+ if track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] == 0:
21
+ my[indexMy.gap1ndexCeiling.value] += 1
22
+ track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] += 1
23
+ my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], track[indexTrack.leafBelow.value, my[indexMy.leafConnectee.value]]]
24
+ my[indexMy.indexDimension.value] += 1
25
+ if not my[indexMy.dimensionsUnconstrained.value]:
26
+ my[indexMy.indexLeaf.value] = 0
27
+ while my[indexMy.indexLeaf.value] < my[indexMy.leaf1ndex.value]:
28
+ gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.indexLeaf.value]
29
+ my[indexMy.gap1ndexCeiling.value] += 1
30
+ my[indexMy.indexLeaf.value] += 1
31
+ my[indexMy.indexMiniGap.value] = my[indexMy.gap1ndex.value]
32
+ while my[indexMy.indexMiniGap.value] < my[indexMy.gap1ndexCeiling.value]:
33
+ gapsWhere[my[indexMy.gap1ndex.value]] = gapsWhere[my[indexMy.indexMiniGap.value]]
34
+ if track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] == my[indexMy.dimensionsUnconstrained.value]:
35
+ my[indexMy.gap1ndex.value] += 1
36
+ track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
37
+ my[indexMy.indexMiniGap.value] += 1
38
+ if my[indexMy.leaf1ndex.value] > 0:
39
+ my[indexMy.gap1ndex.value] -= 1
40
+ track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
41
+ track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
42
+ track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
43
+ track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
44
+ track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value]] = my[indexMy.gap1ndex.value]
45
+ my[indexMy.leaf1ndex.value] += 1
46
+ if my[indexMy.gap1ndex.value] > 0:
47
+ return
48
+
49
+ @jit((uint16[:, :, ::1], int64[::1], uint16[::1], uint16[::1], uint16[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=True)
50
+ def countParallel(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], foldGroups: ndarray[tuple[int], dtype[integer[Any]]], gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
51
+ gapsWherePARALLEL = gapsWhere.copy()
52
+ myPARALLEL = my.copy()
53
+ trackPARALLEL = track.copy()
54
+ taskDivisionsPrange = myPARALLEL[indexMy.taskDivisions.value]
55
+ for indexSherpa in prange(taskDivisionsPrange):
56
+ groupsOfFolds: int = 0
57
+ gapsWhere = gapsWherePARALLEL.copy()
58
+ my = myPARALLEL.copy()
59
+ track = trackPARALLEL.copy()
60
+ my[indexMy.taskIndex.value] = indexSherpa
61
+ while my[indexMy.leaf1ndex.value] > 0:
62
+ if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
63
+ if my[indexMy.leaf1ndex.value] > foldGroups[-1]:
64
+ groupsOfFolds += 1
65
+ else:
66
+ my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
67
+ my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
68
+ my[indexMy.indexDimension.value] = 0
69
+ while my[indexMy.indexDimension.value] < my[indexMy.dimensionsTotal.value]:
70
+ if connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]] == my[indexMy.leaf1ndex.value]:
71
+ my[indexMy.dimensionsUnconstrained.value] -= 1
72
+ else:
73
+ my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]]
74
+ while my[indexMy.leafConnectee.value] != my[indexMy.leaf1ndex.value]:
75
+ if my[indexMy.leaf1ndex.value] != my[indexMy.taskDivisions.value] or my[indexMy.leafConnectee.value] % my[indexMy.taskDivisions.value] == my[indexMy.taskIndex.value]:
76
+ gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.leafConnectee.value]
77
+ if track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] == 0:
78
+ my[indexMy.gap1ndexCeiling.value] += 1
79
+ track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] += 1
80
+ my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], track[indexTrack.leafBelow.value, my[indexMy.leafConnectee.value]]]
81
+ my[indexMy.indexDimension.value] += 1
82
+ my[indexMy.indexMiniGap.value] = my[indexMy.gap1ndex.value]
83
+ while my[indexMy.indexMiniGap.value] < my[indexMy.gap1ndexCeiling.value]:
84
+ gapsWhere[my[indexMy.gap1ndex.value]] = gapsWhere[my[indexMy.indexMiniGap.value]]
85
+ if track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] == my[indexMy.dimensionsUnconstrained.value]:
86
+ my[indexMy.gap1ndex.value] += 1
87
+ track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
88
+ my[indexMy.indexMiniGap.value] += 1
89
+ while my[indexMy.leaf1ndex.value] > 0 and my[indexMy.gap1ndex.value] == track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]:
90
+ my[indexMy.leaf1ndex.value] -= 1
91
+ track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]
92
+ track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]
93
+ if my[indexMy.leaf1ndex.value] > 0:
94
+ my[indexMy.gap1ndex.value] -= 1
95
+ track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
96
+ track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
97
+ track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
98
+ track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
99
+ track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value]] = my[indexMy.gap1ndex.value]
100
+ my[indexMy.leaf1ndex.value] += 1
101
+ foldGroups[my[indexMy.taskIndex.value]] = groupsOfFolds
102
+
103
+ @jit((uint16[:, :, ::1], int64[::1], uint16[::1], uint16[::1], uint16[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=True, no_cpython_wrapper=True, nopython=True, parallel=False)
104
+ def countSequential(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], foldGroups: ndarray[tuple[int], dtype[integer[Any]]], gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
105
+ leafBelow = track[indexTrack.leafBelow.value]
106
+ gapRangeStart = track[indexTrack.gapRangeStart.value]
107
+ countDimensionsGapped = track[indexTrack.countDimensionsGapped.value]
108
+ leafAbove = track[indexTrack.leafAbove.value]
109
+ leaf1ndex = my[indexMy.leaf1ndex.value]
110
+ dimensionsUnconstrained = my[indexMy.dimensionsUnconstrained.value]
111
+ dimensionsTotal = my[indexMy.dimensionsTotal.value]
112
+ gap1ndexCeiling = my[indexMy.gap1ndexCeiling.value]
113
+ indexDimension = my[indexMy.indexDimension.value]
114
+ leafConnectee = my[indexMy.leafConnectee.value]
115
+ indexMiniGap = my[indexMy.indexMiniGap.value]
116
+ gap1ndex = my[indexMy.gap1ndex.value]
117
+ taskIndex = my[indexMy.taskIndex.value]
118
+ groupsOfFolds: int = 0
119
+ while leaf1ndex > 0:
120
+ if leaf1ndex <= 1 or leafBelow[0] == 1:
121
+ if leaf1ndex > foldGroups[-1]:
122
+ groupsOfFolds += 1
123
+ else:
124
+ dimensionsUnconstrained = dimensionsTotal
125
+ gap1ndexCeiling = gapRangeStart[leaf1ndex - 1]
126
+ indexDimension = 0
127
+ while indexDimension < dimensionsTotal:
128
+ leafConnectee = connectionGraph[indexDimension, leaf1ndex, leaf1ndex]
129
+ if leafConnectee == leaf1ndex:
130
+ dimensionsUnconstrained -= 1
131
+ else:
132
+ while leafConnectee != leaf1ndex:
133
+ gapsWhere[gap1ndexCeiling] = leafConnectee
134
+ if countDimensionsGapped[leafConnectee] == 0:
135
+ gap1ndexCeiling += 1
136
+ countDimensionsGapped[leafConnectee] += 1
137
+ leafConnectee = connectionGraph[indexDimension, leaf1ndex, leafBelow[leafConnectee]]
138
+ indexDimension += 1
139
+ indexMiniGap = gap1ndex
140
+ while indexMiniGap < gap1ndexCeiling:
141
+ gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
142
+ if countDimensionsGapped[gapsWhere[indexMiniGap]] == dimensionsUnconstrained:
143
+ gap1ndex += 1
144
+ countDimensionsGapped[gapsWhere[indexMiniGap]] = 0
145
+ indexMiniGap += 1
146
+ while leaf1ndex > 0 and gap1ndex == gapRangeStart[leaf1ndex - 1]:
147
+ leaf1ndex -= 1
148
+ leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
149
+ leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
150
+ if leaf1ndex > 0:
151
+ gap1ndex -= 1
152
+ leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
153
+ leafBelow[leaf1ndex] = leafBelow[leafAbove[leaf1ndex]]
154
+ leafBelow[leafAbove[leaf1ndex]] = leaf1ndex
155
+ leafAbove[leafBelow[leaf1ndex]] = leaf1ndex
156
+ gapRangeStart[leaf1ndex] = gap1ndex
157
+ leaf1ndex += 1
158
+ foldGroups[taskIndex] = groupsOfFolds
@@ -1,18 +1,11 @@
1
- from mapFolding.syntheticModules.numba_countInitialize import countInitialize
2
- from mapFolding.syntheticModules.numba_countParallel import countParallel
3
- from mapFolding.syntheticModules.numba_countSequential import countSequential
4
1
  from mapFolding import indexMy
5
- from numba import int64
6
- from numba import jit
7
- from numba import uint8
8
- from numpy import dtype
9
- from numpy import ndarray
10
- from numpy import integer
11
- from typing import Tuple
2
+ from mapFolding.syntheticModules.numbaCount import countInitialize, countParallel, countSequential
3
+ from numba import uint16, jit, int64
4
+ from numpy import ndarray, dtype, integer
12
5
  from typing import Any
13
6
 
14
- @jit((uint8[:, :, ::1], int64[::1], uint8[::1], uint8[::1], uint8[::1], uint8[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=False, no_cpython_wrapper=False, nopython=True, parallel=False)
15
- def doTheNeedful(connectionGraph: ndarray[Tuple[int, int, int], dtype[integer[Any]]], foldGroups: ndarray[Tuple[int], dtype[integer[Any]]], gapsWhere: ndarray[Tuple[int], dtype[integer[Any]]], mapShape: ndarray[Tuple[int], dtype[integer[Any]]], my: ndarray[Tuple[int], dtype[integer[Any]]], track: ndarray[Tuple[int, int], dtype[integer[Any]]]) -> None:
7
+ @jit((uint16[:, :, ::1], int64[::1], uint16[::1], uint16[::1], uint16[::1], uint16[:, ::1]), _nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, no_cfunc_wrapper=False, no_cpython_wrapper=False, nopython=True, parallel=False)
8
+ def doTheNeedful(connectionGraph: ndarray[tuple[int, int, int], dtype[integer[Any]]], foldGroups: ndarray[tuple[int], dtype[integer[Any]]], gapsWhere: ndarray[tuple[int], dtype[integer[Any]]], mapShape: ndarray[tuple[int], dtype[integer[Any]]], my: ndarray[tuple[int], dtype[integer[Any]]], track: ndarray[tuple[int, int], dtype[integer[Any]]]) -> None:
16
9
  countInitialize(connectionGraph, gapsWhere, my, track)
17
10
  if my[indexMy.taskDivisions.value] > 0:
18
11
  countParallel(connectionGraph, foldGroups, gapsWhere, my, track)