mapFolding 0.6.0__py3-none-any.whl → 0.7.1__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 +6 -104
- mapFolding/basecamp.py +12 -8
- mapFolding/beDRY.py +103 -286
- mapFolding/filesystem.py +95 -0
- mapFolding/noHomeYet.py +20 -0
- mapFolding/oeis.py +46 -39
- mapFolding/reference/flattened.py +377 -0
- mapFolding/reference/hunterNumba.py +132 -0
- mapFolding/reference/irvineJavaPort.py +120 -0
- mapFolding/reference/jax.py +208 -0
- mapFolding/reference/lunnan.py +153 -0
- mapFolding/reference/lunnanNumpy.py +123 -0
- mapFolding/reference/lunnanWhile.py +121 -0
- mapFolding/reference/rotatedEntryPoint.py +240 -0
- mapFolding/reference/total_countPlus1vsPlusN.py +211 -0
- mapFolding/someAssemblyRequired/Z0Z_workbench.py +33 -0
- mapFolding/someAssemblyRequired/__init__.py +16 -0
- mapFolding/someAssemblyRequired/getLLVMforNoReason.py +21 -0
- mapFolding/someAssemblyRequired/ingredientsNumba.py +100 -0
- mapFolding/someAssemblyRequired/synthesizeCountingFunctions.py +7 -0
- mapFolding/someAssemblyRequired/synthesizeDataConverters.py +135 -0
- mapFolding/someAssemblyRequired/synthesizeNumba.py +91 -0
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +417 -0
- mapFolding/someAssemblyRequired/synthesizeNumbaModules.py +91 -0
- mapFolding/someAssemblyRequired/transformationTools.py +425 -0
- mapFolding/someAssemblyRequired/whatWillBe.py +357 -0
- mapFolding/syntheticModules/__init__.py +0 -0
- mapFolding/syntheticModules/dataNamespaceFlattened.py +30 -0
- mapFolding/syntheticModules/multiprocessingCount_doTheNeedful.py +216 -0
- mapFolding/syntheticModules/numbaCount.py +90 -0
- mapFolding/syntheticModules/numbaCountExample.py +158 -0
- mapFolding/syntheticModules/numbaCountSequential.py +111 -0
- mapFolding/syntheticModules/numbaCount_doTheNeedful.py +13 -0
- mapFolding/syntheticModules/numba_doTheNeedful.py +12 -0
- mapFolding/syntheticModules/numba_doTheNeedfulExample.py +13 -0
- mapFolding/theDao.py +216 -229
- mapFolding/theSSOT.py +269 -101
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/METADATA +7 -6
- mapfolding-0.7.1.dist-info/RECORD +51 -0
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/WHEEL +1 -1
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/top_level.txt +1 -0
- tests/__init__.py +0 -0
- tests/conftest.py +278 -0
- tests/test_computations.py +53 -0
- tests/test_filesystem.py +52 -0
- tests/test_oeis.py +128 -0
- tests/test_other.py +84 -0
- tests/test_tasks.py +56 -0
- mapFolding/theConfiguration.py +0 -58
- mapFolding/theSSOTdatatypes.py +0 -155
- mapFolding/theWrongWay.py +0 -7
- mapfolding-0.6.0.dist-info/RECORD +0 -16
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/LICENSE +0 -0
- {mapfolding-0.6.0.dist-info → mapfolding-0.7.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from import , ,
|
|
2
|
+
from mapFolding.theSSOT import ComputationState, ComputationState, ComputationState
|
|
3
|
+
import copy
|
|
4
|
+
|
|
5
|
+
@(ComputationState(ComputationState), _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)
|
|
6
|
+
def countParallel(statePARALLEL: ComputationState) -> ComputationState:
|
|
7
|
+
stateComplete = copy.deepcopy(statePARALLEL)
|
|
8
|
+
for indexSherpa in range(statePARALLEL.taskDivisions):
|
|
9
|
+
state = copy.deepcopy(statePARALLEL)
|
|
10
|
+
state.taskIndex = indexSherpa
|
|
11
|
+
while state.leaf1ndex > 0:
|
|
12
|
+
if state.leaf1ndex <= 1 or state.leafBelow[0] == 1:
|
|
13
|
+
if state.leaf1ndex > state.leavesTotal:
|
|
14
|
+
state.groupsOfFolds += 1
|
|
15
|
+
else:
|
|
16
|
+
state = state
|
|
17
|
+
while state.indexDimension < state.dimensionsTotal:
|
|
18
|
+
if state.connectionGraph[state.indexDimension, state.leaf1ndex, state.leaf1ndex] == state.leaf1ndex:
|
|
19
|
+
state = state
|
|
20
|
+
else:
|
|
21
|
+
state = state
|
|
22
|
+
while state.leafConnectee != state.leaf1ndex:
|
|
23
|
+
if state.leaf1ndex != state.taskDivisions or state.leafConnectee % state.taskDivisions == state.taskIndex:
|
|
24
|
+
state = state
|
|
25
|
+
state = state
|
|
26
|
+
state = state
|
|
27
|
+
state = state
|
|
28
|
+
while state.indexMiniGap < state.gap1ndexCeiling:
|
|
29
|
+
state = state
|
|
30
|
+
state = state
|
|
31
|
+
while state.leaf1ndex > 0 and state.gap1ndex == state.gapRangeStart[state.leaf1ndex - 1]:
|
|
32
|
+
state = state
|
|
33
|
+
if state.leaf1ndex > 0:
|
|
34
|
+
state = state
|
|
35
|
+
stateComplete.foldGroups[state.taskIndex] = state.groupsOfFolds
|
|
36
|
+
return stateComplete
|
|
37
|
+
|
|
38
|
+
@(ComputationState(ComputationState), _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)
|
|
39
|
+
def countSequential(state: ComputationState) -> ComputationState:
|
|
40
|
+
while state.leaf1ndex > 0:
|
|
41
|
+
if state.leaf1ndex <= 1 or state.leafBelow[0] == 1:
|
|
42
|
+
if state.leaf1ndex > state.leavesTotal:
|
|
43
|
+
state.groupsOfFolds += 1
|
|
44
|
+
else:
|
|
45
|
+
state = state
|
|
46
|
+
while state.indexDimension < state.dimensionsTotal:
|
|
47
|
+
state = state
|
|
48
|
+
if state.leafConnectee == state.leaf1ndex:
|
|
49
|
+
state = state
|
|
50
|
+
else:
|
|
51
|
+
while state.leafConnectee != state.leaf1ndex:
|
|
52
|
+
state = state
|
|
53
|
+
state = state
|
|
54
|
+
state = state
|
|
55
|
+
state = state
|
|
56
|
+
while state.indexMiniGap < state.gap1ndexCeiling:
|
|
57
|
+
state = state
|
|
58
|
+
state = state
|
|
59
|
+
while state.leaf1ndex > 0 and state.gap1ndex == state.gapRangeStart[state.leaf1ndex - 1]:
|
|
60
|
+
state = state
|
|
61
|
+
if state.leaf1ndex > 0:
|
|
62
|
+
state = state
|
|
63
|
+
state.foldGroups[state.taskIndex] = state.groupsOfFolds
|
|
64
|
+
return state
|
|
65
|
+
|
|
66
|
+
@(ComputationState(ComputationState), _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)
|
|
67
|
+
def countInitialize(state: ComputationState) -> ComputationState:
|
|
68
|
+
while state.leaf1ndex > 0:
|
|
69
|
+
if state.leaf1ndex <= 1 or state.leafBelow[0] == 1:
|
|
70
|
+
state = state
|
|
71
|
+
while state.indexDimension < state.dimensionsTotal:
|
|
72
|
+
state = state
|
|
73
|
+
if state.leafConnectee == state.leaf1ndex:
|
|
74
|
+
state = state
|
|
75
|
+
else:
|
|
76
|
+
while state.leafConnectee != state.leaf1ndex:
|
|
77
|
+
state = state
|
|
78
|
+
state = state
|
|
79
|
+
state = state
|
|
80
|
+
if not state.dimensionsUnconstrained:
|
|
81
|
+
state = state
|
|
82
|
+
state = state
|
|
83
|
+
while state.indexMiniGap < state.gap1ndexCeiling:
|
|
84
|
+
state = state
|
|
85
|
+
state = state
|
|
86
|
+
if state.leaf1ndex > 0:
|
|
87
|
+
state = state
|
|
88
|
+
if state.gap1ndex > 0:
|
|
89
|
+
break
|
|
90
|
+
return state
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
from mapFolding.theSSOT import indexMy, indexTrack
|
|
2
|
+
from numba import uint16, prange, int64, 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] > 0:
|
|
9
|
+
if my[indexMy.leaf1ndex] <= 1 or track[indexTrack.leafBelow, 0] == 1:
|
|
10
|
+
my[indexMy.dimensionsUnconstrained] = my[indexMy.dimensionsTotal]
|
|
11
|
+
my[indexMy.gap1ndexCeiling] = track[indexTrack.gapRangeStart, my[indexMy.leaf1ndex] - 1]
|
|
12
|
+
my[indexMy.indexDimension] = 0
|
|
13
|
+
while my[indexMy.indexDimension] < my[indexMy.dimensionsTotal]:
|
|
14
|
+
if connectionGraph[my[indexMy.indexDimension], my[indexMy.leaf1ndex], my[indexMy.leaf1ndex]] == my[indexMy.leaf1ndex]:
|
|
15
|
+
my[indexMy.dimensionsUnconstrained] -= 1
|
|
16
|
+
else:
|
|
17
|
+
my[indexMy.leafConnectee] = connectionGraph[my[indexMy.indexDimension], my[indexMy.leaf1ndex], my[indexMy.leaf1ndex]]
|
|
18
|
+
while my[indexMy.leafConnectee] != my[indexMy.leaf1ndex]:
|
|
19
|
+
gapsWhere[my[indexMy.gap1ndexCeiling]] = my[indexMy.leafConnectee]
|
|
20
|
+
if track[indexTrack.countDimensionsGapped, my[indexMy.leafConnectee]] == 0:
|
|
21
|
+
my[indexMy.gap1ndexCeiling] += 1
|
|
22
|
+
track[indexTrack.countDimensionsGapped, my[indexMy.leafConnectee]] += 1
|
|
23
|
+
my[indexMy.leafConnectee] = connectionGraph[my[indexMy.indexDimension], my[indexMy.leaf1ndex], track[indexTrack.leafBelow, my[indexMy.leafConnectee]]]
|
|
24
|
+
my[indexMy.indexDimension] += 1
|
|
25
|
+
if not my[indexMy.dimensionsUnconstrained]:
|
|
26
|
+
my[indexMy.indexLeaf] = 0
|
|
27
|
+
while my[indexMy.indexLeaf] < my[indexMy.leaf1ndex]:
|
|
28
|
+
gapsWhere[my[indexMy.gap1ndexCeiling]] = my[indexMy.indexLeaf]
|
|
29
|
+
my[indexMy.gap1ndexCeiling] += 1
|
|
30
|
+
my[indexMy.indexLeaf] += 1
|
|
31
|
+
my[indexMy.indexMiniGap] = my[indexMy.gap1ndex]
|
|
32
|
+
while my[indexMy.indexMiniGap] < my[indexMy.gap1ndexCeiling]:
|
|
33
|
+
gapsWhere[my[indexMy.gap1ndex]] = gapsWhere[my[indexMy.indexMiniGap]]
|
|
34
|
+
if track[indexTrack.countDimensionsGapped, gapsWhere[my[indexMy.indexMiniGap]]] == my[indexMy.dimensionsUnconstrained]:
|
|
35
|
+
my[indexMy.gap1ndex] += 1
|
|
36
|
+
track[indexTrack.countDimensionsGapped, gapsWhere[my[indexMy.indexMiniGap]]] = 0
|
|
37
|
+
my[indexMy.indexMiniGap] += 1
|
|
38
|
+
if my[indexMy.leaf1ndex] > 0:
|
|
39
|
+
my[indexMy.gap1ndex] -= 1
|
|
40
|
+
track[indexTrack.leafAbove, my[indexMy.leaf1ndex]] = gapsWhere[my[indexMy.gap1ndex]]
|
|
41
|
+
track[indexTrack.leafBelow, my[indexMy.leaf1ndex]] = track[indexTrack.leafBelow, track[indexTrack.leafAbove, my[indexMy.leaf1ndex]]]
|
|
42
|
+
track[indexTrack.leafBelow, track[indexTrack.leafAbove, my[indexMy.leaf1ndex]]] = my[indexMy.leaf1ndex]
|
|
43
|
+
track[indexTrack.leafAbove, track[indexTrack.leafBelow, my[indexMy.leaf1ndex]]] = my[indexMy.leaf1ndex]
|
|
44
|
+
track[indexTrack.gapRangeStart, my[indexMy.leaf1ndex]] = my[indexMy.gap1ndex]
|
|
45
|
+
my[indexMy.leaf1ndex] += 1
|
|
46
|
+
if my[indexMy.gap1ndex] > 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]
|
|
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] = indexSherpa
|
|
61
|
+
while my[indexMy.leaf1ndex] > 0:
|
|
62
|
+
if my[indexMy.leaf1ndex] <= 1 or track[indexTrack.leafBelow, 0] == 1:
|
|
63
|
+
if my[indexMy.leaf1ndex] > foldGroups[-1]:
|
|
64
|
+
groupsOfFolds += 1
|
|
65
|
+
else:
|
|
66
|
+
my[indexMy.dimensionsUnconstrained] = my[indexMy.dimensionsTotal]
|
|
67
|
+
my[indexMy.gap1ndexCeiling] = track[indexTrack.gapRangeStart, my[indexMy.leaf1ndex] - 1]
|
|
68
|
+
my[indexMy.indexDimension] = 0
|
|
69
|
+
while my[indexMy.indexDimension] < my[indexMy.dimensionsTotal]:
|
|
70
|
+
if connectionGraph[my[indexMy.indexDimension], my[indexMy.leaf1ndex], my[indexMy.leaf1ndex]] == my[indexMy.leaf1ndex]:
|
|
71
|
+
my[indexMy.dimensionsUnconstrained] -= 1
|
|
72
|
+
else:
|
|
73
|
+
my[indexMy.leafConnectee] = connectionGraph[my[indexMy.indexDimension], my[indexMy.leaf1ndex], my[indexMy.leaf1ndex]]
|
|
74
|
+
while my[indexMy.leafConnectee] != my[indexMy.leaf1ndex]:
|
|
75
|
+
if my[indexMy.leaf1ndex] != my[indexMy.taskDivisions] or my[indexMy.leafConnectee] % my[indexMy.taskDivisions] == my[indexMy.taskIndex]:
|
|
76
|
+
gapsWhere[my[indexMy.gap1ndexCeiling]] = my[indexMy.leafConnectee]
|
|
77
|
+
if track[indexTrack.countDimensionsGapped, my[indexMy.leafConnectee]] == 0:
|
|
78
|
+
my[indexMy.gap1ndexCeiling] += 1
|
|
79
|
+
track[indexTrack.countDimensionsGapped, my[indexMy.leafConnectee]] += 1
|
|
80
|
+
my[indexMy.leafConnectee] = connectionGraph[my[indexMy.indexDimension], my[indexMy.leaf1ndex], track[indexTrack.leafBelow, my[indexMy.leafConnectee]]]
|
|
81
|
+
my[indexMy.indexDimension] += 1
|
|
82
|
+
my[indexMy.indexMiniGap] = my[indexMy.gap1ndex]
|
|
83
|
+
while my[indexMy.indexMiniGap] < my[indexMy.gap1ndexCeiling]:
|
|
84
|
+
gapsWhere[my[indexMy.gap1ndex]] = gapsWhere[my[indexMy.indexMiniGap]]
|
|
85
|
+
if track[indexTrack.countDimensionsGapped, gapsWhere[my[indexMy.indexMiniGap]]] == my[indexMy.dimensionsUnconstrained]:
|
|
86
|
+
my[indexMy.gap1ndex] += 1
|
|
87
|
+
track[indexTrack.countDimensionsGapped, gapsWhere[my[indexMy.indexMiniGap]]] = 0
|
|
88
|
+
my[indexMy.indexMiniGap] += 1
|
|
89
|
+
while my[indexMy.leaf1ndex] > 0 and my[indexMy.gap1ndex] == track[indexTrack.gapRangeStart, my[indexMy.leaf1ndex] - 1]:
|
|
90
|
+
my[indexMy.leaf1ndex] -= 1
|
|
91
|
+
track[indexTrack.leafBelow, track[indexTrack.leafAbove, my[indexMy.leaf1ndex]]] = track[indexTrack.leafBelow, my[indexMy.leaf1ndex]]
|
|
92
|
+
track[indexTrack.leafAbove, track[indexTrack.leafBelow, my[indexMy.leaf1ndex]]] = track[indexTrack.leafAbove, my[indexMy.leaf1ndex]]
|
|
93
|
+
if my[indexMy.leaf1ndex] > 0:
|
|
94
|
+
my[indexMy.gap1ndex] -= 1
|
|
95
|
+
track[indexTrack.leafAbove, my[indexMy.leaf1ndex]] = gapsWhere[my[indexMy.gap1ndex]]
|
|
96
|
+
track[indexTrack.leafBelow, my[indexMy.leaf1ndex]] = track[indexTrack.leafBelow, track[indexTrack.leafAbove, my[indexMy.leaf1ndex]]]
|
|
97
|
+
track[indexTrack.leafBelow, track[indexTrack.leafAbove, my[indexMy.leaf1ndex]]] = my[indexMy.leaf1ndex]
|
|
98
|
+
track[indexTrack.leafAbove, track[indexTrack.leafBelow, my[indexMy.leaf1ndex]]] = my[indexMy.leaf1ndex]
|
|
99
|
+
track[indexTrack.gapRangeStart, my[indexMy.leaf1ndex]] = my[indexMy.gap1ndex]
|
|
100
|
+
my[indexMy.leaf1ndex] += 1
|
|
101
|
+
foldGroups[my[indexMy.taskIndex]] = 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
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
from mapFolding.theDao import countInitialize, doTheNeedful
|
|
2
|
+
from mapFolding.theSSOT import Array1DElephino, Array1DLeavesTotal, Array3D, ComputationState, DatatypeElephino, DatatypeFoldsTotal, DatatypeLeavesTotal
|
|
3
|
+
from numba import jit
|
|
4
|
+
|
|
5
|
+
@jit(_nrt=True, boundscheck=False, cache=True, error_model='numpy', fastmath=True, forceinline=True, inline='always', looplift=False, nopython=True, parallel=False)
|
|
6
|
+
def countSequential(
|
|
7
|
+
connectionGraph: Array3D,
|
|
8
|
+
countDimensionsGapped: Array1DLeavesTotal,
|
|
9
|
+
dimensionsTotal: DatatypeLeavesTotal,
|
|
10
|
+
dimensionsUnconstrained: DatatypeLeavesTotal,
|
|
11
|
+
gap1ndex: DatatypeLeavesTotal,
|
|
12
|
+
gap1ndexCeiling: DatatypeElephino,
|
|
13
|
+
gapRangeStart: Array1DElephino,
|
|
14
|
+
gapsWhere: Array1DLeavesTotal,
|
|
15
|
+
groupsOfFolds: DatatypeFoldsTotal,
|
|
16
|
+
indexDimension: DatatypeLeavesTotal,
|
|
17
|
+
indexMiniGap: DatatypeElephino,
|
|
18
|
+
leaf1ndex: DatatypeElephino,
|
|
19
|
+
leafAbove: Array1DLeavesTotal,
|
|
20
|
+
leafBelow: Array1DLeavesTotal,
|
|
21
|
+
leafConnectee: DatatypeElephino,
|
|
22
|
+
leavesTotal: DatatypeLeavesTotal,
|
|
23
|
+
) -> DatatypeFoldsTotal:
|
|
24
|
+
|
|
25
|
+
while leaf1ndex > 0:
|
|
26
|
+
if leaf1ndex <= 1 or leafBelow[0] == 1:
|
|
27
|
+
if leaf1ndex > leavesTotal:
|
|
28
|
+
groupsOfFolds += 1
|
|
29
|
+
else:
|
|
30
|
+
dimensionsUnconstrained = dimensionsTotal
|
|
31
|
+
gap1ndexCeiling = gapRangeStart[leaf1ndex - 1]
|
|
32
|
+
indexDimension = 0
|
|
33
|
+
while indexDimension < dimensionsTotal:
|
|
34
|
+
leafConnectee = connectionGraph[indexDimension, leaf1ndex, leaf1ndex]
|
|
35
|
+
if leafConnectee == leaf1ndex:
|
|
36
|
+
dimensionsUnconstrained -= 1
|
|
37
|
+
else:
|
|
38
|
+
while leafConnectee != leaf1ndex:
|
|
39
|
+
gapsWhere[gap1ndexCeiling] = leafConnectee
|
|
40
|
+
if countDimensionsGapped[leafConnectee] == 0:
|
|
41
|
+
gap1ndexCeiling += 1
|
|
42
|
+
countDimensionsGapped[leafConnectee] += 1
|
|
43
|
+
leafConnectee = connectionGraph[indexDimension, leaf1ndex, leafBelow[leafConnectee]]
|
|
44
|
+
indexDimension += 1
|
|
45
|
+
indexMiniGap = gap1ndex
|
|
46
|
+
while indexMiniGap < gap1ndexCeiling:
|
|
47
|
+
gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
|
|
48
|
+
if countDimensionsGapped[gapsWhere[indexMiniGap]] == dimensionsUnconstrained:
|
|
49
|
+
gap1ndex += 1
|
|
50
|
+
countDimensionsGapped[gapsWhere[indexMiniGap]] = 0
|
|
51
|
+
indexMiniGap += 1
|
|
52
|
+
while leaf1ndex > 0 and gap1ndex == gapRangeStart[leaf1ndex - 1]:
|
|
53
|
+
leaf1ndex -= 1
|
|
54
|
+
leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
|
|
55
|
+
leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
|
|
56
|
+
if leaf1ndex > 0:
|
|
57
|
+
gap1ndex -= 1
|
|
58
|
+
leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
|
|
59
|
+
leafBelow[leaf1ndex] = leafBelow[leafAbove[leaf1ndex]]
|
|
60
|
+
leafBelow[leafAbove[leaf1ndex]] = leaf1ndex
|
|
61
|
+
leafAbove[leafBelow[leaf1ndex]] = leaf1ndex
|
|
62
|
+
gapRangeStart[leaf1ndex] = gap1ndex
|
|
63
|
+
leaf1ndex += 1
|
|
64
|
+
return groupsOfFolds
|
|
65
|
+
|
|
66
|
+
def flattenData(state: ComputationState) -> ComputationState:
|
|
67
|
+
|
|
68
|
+
if state.taskDivisions > 0:
|
|
69
|
+
return doTheNeedful(state)
|
|
70
|
+
|
|
71
|
+
state = countInitialize(state)
|
|
72
|
+
|
|
73
|
+
connectionGraph: Array3D = state.connectionGraph
|
|
74
|
+
countDimensionsGapped: Array1DLeavesTotal = state.countDimensionsGapped
|
|
75
|
+
dimensionsTotal: DatatypeLeavesTotal = state.dimensionsTotal
|
|
76
|
+
dimensionsUnconstrained: DatatypeLeavesTotal = state.dimensionsUnconstrained
|
|
77
|
+
gap1ndex: DatatypeLeavesTotal = state.gap1ndex
|
|
78
|
+
gap1ndexCeiling: DatatypeElephino = state.gap1ndexCeiling
|
|
79
|
+
gapRangeStart: Array1DElephino = state.gapRangeStart
|
|
80
|
+
gapsWhere: Array1DLeavesTotal = state.gapsWhere
|
|
81
|
+
groupsOfFolds: DatatypeFoldsTotal = state.groupsOfFolds
|
|
82
|
+
indexDimension: DatatypeLeavesTotal = state.indexDimension
|
|
83
|
+
indexMiniGap: DatatypeElephino = state.indexMiniGap
|
|
84
|
+
leaf1ndex: DatatypeElephino = state.leaf1ndex
|
|
85
|
+
leafAbove: Array1DLeavesTotal = state.leafAbove
|
|
86
|
+
leafBelow: Array1DLeavesTotal = state.leafBelow
|
|
87
|
+
leafConnectee: DatatypeElephino = state.leafConnectee
|
|
88
|
+
leavesTotal: DatatypeLeavesTotal = state.leavesTotal
|
|
89
|
+
|
|
90
|
+
groupsOfFolds = countSequential(
|
|
91
|
+
connectionGraph = connectionGraph,
|
|
92
|
+
countDimensionsGapped = countDimensionsGapped,
|
|
93
|
+
dimensionsTotal = dimensionsTotal,
|
|
94
|
+
dimensionsUnconstrained = dimensionsUnconstrained,
|
|
95
|
+
gap1ndex = gap1ndex,
|
|
96
|
+
gap1ndexCeiling = gap1ndexCeiling,
|
|
97
|
+
gapRangeStart = gapRangeStart,
|
|
98
|
+
gapsWhere = gapsWhere,
|
|
99
|
+
groupsOfFolds = groupsOfFolds,
|
|
100
|
+
indexDimension = indexDimension,
|
|
101
|
+
indexMiniGap = indexMiniGap,
|
|
102
|
+
leaf1ndex = leaf1ndex,
|
|
103
|
+
leafAbove = leafAbove,
|
|
104
|
+
leafBelow = leafBelow,
|
|
105
|
+
leafConnectee = leafConnectee,
|
|
106
|
+
leavesTotal = leavesTotal,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
state.groupsOfFolds = state.foldGroups[state.taskIndex] = groupsOfFolds
|
|
110
|
+
|
|
111
|
+
return state
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from mapFolding import indexMy
|
|
2
|
+
from mapFolding.syntheticModules.numbaCount import countInitialize, countSequential, countParallel
|
|
3
|
+
from numba import uint16, int64, jit
|
|
4
|
+
from numpy import ndarray, dtype, integer
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
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:
|
|
9
|
+
countInitialize(connectionGraph, gapsWhere, my, track)
|
|
10
|
+
if my[indexMy.taskDivisions] > 0:
|
|
11
|
+
countParallel(connectionGraph, foldGroups, gapsWhere, my, track)
|
|
12
|
+
else:
|
|
13
|
+
countSequential(connectionGraph, foldGroups, gapsWhere, my, track)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from import
|
|
2
|
+
from mapFolding.syntheticModules.numbaCount import countInitialize, countParallel, countSequential
|
|
3
|
+
from mapFolding.theSSOT import ComputationState
|
|
4
|
+
import copy
|
|
5
|
+
|
|
6
|
+
@(ComputationState(ComputationState), _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 doTheNeedful(computationStateInitialized: ComputationState) -> ComputationState:
|
|
8
|
+
computationStateInitialized = countInitialize(computationStateInitialized)
|
|
9
|
+
if computationStateInitialized.taskDivisions > 0:
|
|
10
|
+
return countParallel(computationStateInitialized)
|
|
11
|
+
else:
|
|
12
|
+
return countSequential(computationStateInitialized)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from mapFolding import indexMy
|
|
2
|
+
from mapFolding.syntheticModules.numbaCount import countInitialize, countSequential, countParallel
|
|
3
|
+
from numba import uint16, int64, jit
|
|
4
|
+
from numpy import ndarray, dtype, integer
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
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:
|
|
9
|
+
countInitialize(connectionGraph, gapsWhere, my, track)
|
|
10
|
+
if my[indexMy.taskDivisions] > 0:
|
|
11
|
+
countParallel(connectionGraph, foldGroups, gapsWhere, my, track)
|
|
12
|
+
else:
|
|
13
|
+
countSequential(connectionGraph, foldGroups, gapsWhere, my, track)
|