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
tests/test_other.py CHANGED
@@ -43,7 +43,11 @@ import sys
43
43
  (range(3, 7), [3, 4, 5, 6], [3, 4, 5, 6], [3, 4, 5, 6], 360), # range sequence type
44
44
  (tuple([3, 5, 7]), [3, 5, 7], [3, 5, 7], [3, 5, 7], 105), # tuple sequence type
45
45
  ])
46
- def test_listDimensionsAsParameter(listDimensions: None | List[str] | List[int] | List[float] | List[None] | List[bool] | List[List[int]] | List[complex] | range | tuple[int, ...], expected_intInnit: type[ValueError] | List[int] | type[TypeError], expected_parseListDimensions: type[ValueError] | List[int] | type[TypeError], expected_validateListDimensions: type[ValueError] | type[NotImplementedError] | List[int] | type[TypeError], expected_getLeavesTotal: type[ValueError] | int | type[TypeError] | type[OverflowError]) -> None:
46
+ def test_listDimensionsAsParameter(listDimensions: None | list[str] | list[int] | list[float] | list[None] | list[bool] | list[list[int]] | list[complex] | range | tuple[int, ...],
47
+ expected_intInnit: type[ValueError] | list[int] | type[TypeError],
48
+ expected_parseListDimensions: type[ValueError] | list[int] | type[TypeError],
49
+ expected_validateListDimensions: type[ValueError] | type[NotImplementedError] | list[int] | type[TypeError],
50
+ expected_getLeavesTotal: type[ValueError] | int | type[TypeError] | type[OverflowError]) -> None:
47
51
  """Test both validateListDimensions and getLeavesTotal with the same inputs."""
48
52
  standardizedEqualTo(expected_intInnit, intInnit, listDimensions)
49
53
  standardizedEqualTo(expected_parseListDimensions, parseDimensions, listDimensions)
@@ -82,14 +86,14 @@ def testOopsieKwargsie(nameOfTest: str, callablePytest: Callable[[], None]) -> N
82
86
  def test_setCPUlimit(CPUlimit: None | float | bool | Literal[4] | Literal[-2] | Literal[0] | Literal[1], expectedLimit: Any | int) -> None:
83
87
  standardizedEqualTo(expectedLimit, setCPUlimit, CPUlimit)
84
88
 
85
- def test_makeConnectionGraph_nonNegative(listDimensionsTestFunctionality: List[int]) -> None:
89
+ def test_makeConnectionGraph_nonNegative(listDimensionsTestFunctionality: list[int]) -> None:
86
90
  connectionGraph = makeConnectionGraph(listDimensionsTestFunctionality)
87
91
  assert numpy.all(connectionGraph >= 0), "All values in the connection graph should be non-negative."
88
92
 
89
93
  @pytest.fixture
90
- def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None, None]]:
94
+ def parameterIterator() -> Callable[[list[int]], Generator[dict[str, Any], None, None]]:
91
95
  """Generate random combinations of parameters for outfitCountFolds testing."""
92
- parameterSets: Dict[str, List[Any]] = {
96
+ parameterSets: dict[str, list[Any]] = {
93
97
  'computationDivisions': [
94
98
  None,
95
99
  'maximum',
@@ -112,7 +116,7 @@ def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None,
112
116
  ]
113
117
  }
114
118
 
115
- def makeParametersDynamic(listDimensions: List[int]) -> Dict[str, List[Any]]:
119
+ def makeParametersDynamic(listDimensions: list[int]) -> dict[str, list[Any]]:
116
120
  """Add context-dependent parameter values."""
117
121
  parametersDynamic = parameterSets.copy()
118
122
  leavesTotal = getLeavesTotal(listDimensions)
@@ -137,7 +141,7 @@ def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None,
137
141
 
138
142
  return parametersDynamic
139
143
 
140
- def generateCombinations(listDimensions: List[int]) -> Generator[Dict[str, Any], None, None]:
144
+ def generateCombinations(listDimensions: list[int]) -> Generator[dict[str, Any], None, None]:
141
145
  parametersDynamic = makeParametersDynamic(listDimensions)
142
146
  parameterKeys = list(parametersDynamic.keys())
143
147
  parameterValues = [parametersDynamic[key] for key in parameterKeys]
@@ -152,7 +156,7 @@ def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None,
152
156
 
153
157
  return generateCombinations
154
158
 
155
- def test_saveFoldsTotal_fallback(pathTmpTesting: pathlib.Path) -> None:
159
+ def test_saveFoldsTotal_fallback(pathTmpTesting: Path) -> None:
156
160
  foldsTotal = 123
157
161
  pathFilename = pathTmpTesting / "foldsTotal.txt"
158
162
  with unittest.mock.patch("pathlib.Path.write_text", side_effect=OSError("Simulated write failure")):
tests/test_tasks.py CHANGED
@@ -4,10 +4,10 @@ import pytest
4
4
  # TODO add a test. `C` = number of logical cores available. `n = C + 1`. Ensure that `[2,n]` is computed correctly.
5
5
  # Or, probably smarter: limit the number of cores, then run a test with C+1.
6
6
 
7
- def test_countFoldsComputationDivisionsInvalid(listDimensionsTestFunctionality: List[int]) -> None:
7
+ def test_countFoldsComputationDivisionsInvalid(listDimensionsTestFunctionality: list[int]) -> None:
8
8
  standardizedEqualTo(ValueError, countFolds, listDimensionsTestFunctionality, None, {"wrong": "value"})
9
9
 
10
- def test_countFoldsComputationDivisionsMaximum(listDimensionsTestParallelization: List[int], foldsTotalKnown: Dict[Tuple[int, ...], int]) -> None:
10
+ def test_countFoldsComputationDivisionsMaximum(listDimensionsTestParallelization: list[int], foldsTotalKnown: dict[tuple[int, ...], int]) -> None:
11
11
  standardizedEqualTo(foldsTotalKnown[tuple(listDimensionsTestParallelization)], countFolds, listDimensionsTestParallelization, None, 'maximum')
12
12
 
13
13
  @pytest.mark.parametrize("nameOfTest,callablePytest", PytestFor_defineConcurrencyLimit())
@@ -15,7 +15,7 @@ def test_defineConcurrencyLimit(nameOfTest: str, callablePytest: Callable[[], No
15
15
  callablePytest()
16
16
 
17
17
  @pytest.mark.parametrize("CPUlimitParameter", [{"invalid": True}, ["weird"]])
18
- def test_countFolds_cpuLimitOopsie(listDimensionsTestFunctionality: List[int], CPUlimitParameter: Dict[str, bool] | List[str]) -> None:
18
+ def test_countFolds_cpuLimitOopsie(listDimensionsTestFunctionality: list[int], CPUlimitParameter: dict[str, bool] | list[str]) -> None:
19
19
  standardizedEqualTo(ValueError, countFolds, listDimensionsTestFunctionality, None, 'cpu', CPUlimitParameter)
20
20
 
21
21
  @pytest.mark.parametrize("computationDivisions, concurrencyLimit, listDimensions, expectedTaskDivisions", [
@@ -25,7 +25,7 @@ def test_countFolds_cpuLimitOopsie(listDimensionsTestFunctionality: List[int], C
25
25
  (["invalid"], 4, [19, 23], ValueError),
26
26
  (20, 4, [3,5], ValueError)
27
27
  ])
28
- def test_getTaskDivisions(computationDivisions: None | List[str] | Literal['maximum'] | Literal['cpu'] | Literal[20], concurrencyLimit: Literal[4], listDimensions: List[int], expectedTaskDivisions: type[ValueError] | Literal[0] | Literal[77] | Literal[4]) -> None:
28
+ def test_getTaskDivisions(computationDivisions: None | list[str] | Literal['maximum'] | Literal['cpu'] | Literal[20], concurrencyLimit: Literal[4], listDimensions: list[int], expectedTaskDivisions: type[ValueError] | Literal[0] | Literal[77] | Literal[4]) -> None:
29
29
  standardizedEqualTo(expectedTaskDivisions, getTaskDivisions, computationDivisions, concurrencyLimit, None, listDimensions)
30
30
 
31
31
  @pytest.mark.parametrize("expected,parameter", [
@@ -35,6 +35,6 @@ def test_getTaskDivisions(computationDivisions: None | List[str] | Literal['maxi
35
35
  (ValueError, {2}), # set
36
36
  (ValueError, {"cores": 2}), # dict
37
37
  ])
38
- def test_setCPUlimitMalformedParameter(expected: type[ValueError] | Literal[2], parameter: List[int] | Tuple[int] | set[int] | Dict[str, int] | Literal['2']) -> None:
38
+ def test_setCPUlimitMalformedParameter(expected: type[ValueError] | Literal[2], parameter: list[int] | tuple[int] | set[int] | dict[str, int] | Literal['2']) -> None:
39
39
  """Test that invalid CPUlimit types are properly handled."""
40
40
  standardizedEqualTo(expected, setCPUlimit, parameter)
@@ -1,52 +0,0 @@
1
- from mapFolding import indexMy
2
- from mapFolding import indexTrack
3
- from numba import jit
4
- from numba import uint8
5
- from numpy import dtype
6
- from numpy import ndarray
7
- from numpy import integer
8
- from typing import Tuple
9
- from typing import Any
10
-
11
- @jit((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)
12
- 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:
13
- while my[indexMy.leaf1ndex.value]:
14
- if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
15
- my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
16
- my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
17
- my[indexMy.indexDimension.value] = 0
18
- while my[indexMy.indexDimension.value] < my[indexMy.dimensionsTotal.value]:
19
- if connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]] == my[indexMy.leaf1ndex.value]:
20
- my[indexMy.dimensionsUnconstrained.value] -= 1
21
- else:
22
- my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]]
23
- while my[indexMy.leafConnectee.value] != my[indexMy.leaf1ndex.value]:
24
- gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.leafConnectee.value]
25
- if track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] == 0:
26
- my[indexMy.gap1ndexCeiling.value] += 1
27
- track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] += 1
28
- my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], track[indexTrack.leafBelow.value, my[indexMy.leafConnectee.value]]]
29
- my[indexMy.indexDimension.value] += 1
30
- if not my[indexMy.dimensionsUnconstrained.value]:
31
- my[indexMy.indexLeaf.value] = 0
32
- while my[indexMy.indexLeaf.value] < my[indexMy.leaf1ndex.value]:
33
- gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.indexLeaf.value]
34
- my[indexMy.gap1ndexCeiling.value] += 1
35
- my[indexMy.indexLeaf.value] += 1
36
- my[indexMy.indexMiniGap.value] = my[indexMy.gap1ndex.value]
37
- while my[indexMy.indexMiniGap.value] < my[indexMy.gap1ndexCeiling.value]:
38
- gapsWhere[my[indexMy.gap1ndex.value]] = gapsWhere[my[indexMy.indexMiniGap.value]]
39
- if track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] == my[indexMy.dimensionsUnconstrained.value]:
40
- my[indexMy.gap1ndex.value] += 1
41
- track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
42
- my[indexMy.indexMiniGap.value] += 1
43
- if my[indexMy.leaf1ndex.value]:
44
- my[indexMy.gap1ndex.value] -= 1
45
- track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
46
- track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
47
- track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
48
- track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
49
- track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value]] = my[indexMy.gap1ndex.value]
50
- my[indexMy.leaf1ndex.value] += 1
51
- if my[indexMy.gap1ndex.value] > 0:
52
- return
@@ -1,65 +0,0 @@
1
- from mapFolding import indexMy
2
- from mapFolding import indexTrack
3
- from numba import prange
4
- from numba import int64
5
- from numba import jit
6
- from numba import uint8
7
- from numpy import dtype
8
- from numpy import ndarray
9
- from numpy import integer
10
- from typing import Tuple
11
- from typing import Any
12
-
13
- @jit((uint8[:, :, ::1], int64[::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=True, no_cpython_wrapper=True, nopython=True, parallel=True)
14
- 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:
15
- gapsWherePARALLEL = gapsWhere.copy()
16
- myPARALLEL = my.copy()
17
- trackPARALLEL = track.copy()
18
- taskDivisionsPrange = myPARALLEL[indexMy.taskDivisions.value]
19
- for indexSherpa in prange(taskDivisionsPrange):
20
- groupsOfFolds: int = 0
21
- gapsWhere = gapsWherePARALLEL.copy()
22
- my = myPARALLEL.copy()
23
- track = trackPARALLEL.copy()
24
- my[indexMy.taskIndex.value] = indexSherpa
25
- while my[indexMy.leaf1ndex.value]:
26
- if my[indexMy.leaf1ndex.value] <= 1 or track[indexTrack.leafBelow.value, 0] == 1:
27
- if my[indexMy.leaf1ndex.value] > foldGroups[-1]:
28
- groupsOfFolds += 1
29
- else:
30
- my[indexMy.dimensionsUnconstrained.value] = my[indexMy.dimensionsTotal.value]
31
- my[indexMy.gap1ndexCeiling.value] = track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]
32
- my[indexMy.indexDimension.value] = 0
33
- while my[indexMy.indexDimension.value] < my[indexMy.dimensionsTotal.value]:
34
- if connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]] == my[indexMy.leaf1ndex.value]:
35
- my[indexMy.dimensionsUnconstrained.value] -= 1
36
- else:
37
- my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], my[indexMy.leaf1ndex.value]]
38
- while my[indexMy.leafConnectee.value] != my[indexMy.leaf1ndex.value]:
39
- if my[indexMy.leaf1ndex.value] != my[indexMy.taskDivisions.value] or my[indexMy.leafConnectee.value] % my[indexMy.taskDivisions.value] == my[indexMy.taskIndex.value]:
40
- gapsWhere[my[indexMy.gap1ndexCeiling.value]] = my[indexMy.leafConnectee.value]
41
- if track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] == 0:
42
- my[indexMy.gap1ndexCeiling.value] += 1
43
- track[indexTrack.countDimensionsGapped.value, my[indexMy.leafConnectee.value]] += 1
44
- my[indexMy.leafConnectee.value] = connectionGraph[my[indexMy.indexDimension.value], my[indexMy.leaf1ndex.value], track[indexTrack.leafBelow.value, my[indexMy.leafConnectee.value]]]
45
- my[indexMy.indexDimension.value] += 1
46
- my[indexMy.indexMiniGap.value] = my[indexMy.gap1ndex.value]
47
- while my[indexMy.indexMiniGap.value] < my[indexMy.gap1ndexCeiling.value]:
48
- gapsWhere[my[indexMy.gap1ndex.value]] = gapsWhere[my[indexMy.indexMiniGap.value]]
49
- if track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] == my[indexMy.dimensionsUnconstrained.value]:
50
- my[indexMy.gap1ndex.value] += 1
51
- track[indexTrack.countDimensionsGapped.value, gapsWhere[my[indexMy.indexMiniGap.value]]] = 0
52
- my[indexMy.indexMiniGap.value] += 1
53
- while my[indexMy.leaf1ndex.value] and my[indexMy.gap1ndex.value] == track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value] - 1]:
54
- my[indexMy.leaf1ndex.value] -= 1
55
- track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]
56
- track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]
57
- if my[indexMy.leaf1ndex.value]:
58
- my[indexMy.gap1ndex.value] -= 1
59
- track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]] = gapsWhere[my[indexMy.gap1ndex.value]]
60
- track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]] = track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]]
61
- track[indexTrack.leafBelow.value, track[indexTrack.leafAbove.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
62
- track[indexTrack.leafAbove.value, track[indexTrack.leafBelow.value, my[indexMy.leaf1ndex.value]]] = my[indexMy.leaf1ndex.value]
63
- track[indexTrack.gapRangeStart.value, my[indexMy.leaf1ndex.value]] = my[indexMy.gap1ndex.value]
64
- my[indexMy.leaf1ndex.value] += 1
65
- foldGroups[my[indexMy.taskIndex.value]] = groupsOfFolds
@@ -1,67 +0,0 @@
1
- from mapFolding import indexMy
2
- from mapFolding import indexTrack
3
- from numba import int64
4
- from numba import jit
5
- from numba import uint8
6
- from numpy import dtype
7
- from numpy import ndarray
8
- from numpy import integer
9
- from typing import Tuple
10
- from typing import Any
11
-
12
- @jit((uint8[:, :, ::1], int64[::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=True, no_cpython_wrapper=True, nopython=True, parallel=False)
13
- 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:
14
- leafBelow = track[indexTrack.leafBelow.value]
15
- gapRangeStart = track[indexTrack.gapRangeStart.value]
16
- countDimensionsGapped = track[indexTrack.countDimensionsGapped.value]
17
- leafAbove = track[indexTrack.leafAbove.value]
18
- leaf1ndex = my[indexMy.leaf1ndex.value]
19
- dimensionsUnconstrained = my[indexMy.dimensionsUnconstrained.value]
20
- dimensionsTotal = my[indexMy.dimensionsTotal.value]
21
- gap1ndexCeiling = my[indexMy.gap1ndexCeiling.value]
22
- indexDimension = my[indexMy.indexDimension.value]
23
- leafConnectee = my[indexMy.leafConnectee.value]
24
- indexMiniGap = my[indexMy.indexMiniGap.value]
25
- gap1ndex = my[indexMy.gap1ndex.value]
26
- taskIndex = my[indexMy.taskIndex.value]
27
- groupsOfFolds: int = 0
28
- while leaf1ndex:
29
- if leaf1ndex <= 1 or leafBelow[0] == 1:
30
- if leaf1ndex > foldGroups[-1]:
31
- groupsOfFolds += 1
32
- else:
33
- dimensionsUnconstrained = dimensionsTotal
34
- gap1ndexCeiling = gapRangeStart[leaf1ndex - 1]
35
- indexDimension = 0
36
- while indexDimension < dimensionsTotal:
37
- leafConnectee = connectionGraph[indexDimension, leaf1ndex, leaf1ndex]
38
- if leafConnectee == leaf1ndex:
39
- dimensionsUnconstrained -= 1
40
- else:
41
- while leafConnectee != leaf1ndex:
42
- gapsWhere[gap1ndexCeiling] = leafConnectee
43
- if countDimensionsGapped[leafConnectee] == 0:
44
- gap1ndexCeiling += 1
45
- countDimensionsGapped[leafConnectee] += 1
46
- leafConnectee = connectionGraph[indexDimension, leaf1ndex, leafBelow[leafConnectee]]
47
- indexDimension += 1
48
- indexMiniGap = gap1ndex
49
- while indexMiniGap < gap1ndexCeiling:
50
- gapsWhere[gap1ndex] = gapsWhere[indexMiniGap]
51
- if countDimensionsGapped[gapsWhere[indexMiniGap]] == dimensionsUnconstrained:
52
- gap1ndex += 1
53
- countDimensionsGapped[gapsWhere[indexMiniGap]] = 0
54
- indexMiniGap += 1
55
- while leaf1ndex and gap1ndex == gapRangeStart[leaf1ndex - 1]:
56
- leaf1ndex -= 1
57
- leafBelow[leafAbove[leaf1ndex]] = leafBelow[leaf1ndex]
58
- leafAbove[leafBelow[leaf1ndex]] = leafAbove[leaf1ndex]
59
- if leaf1ndex:
60
- gap1ndex -= 1
61
- leafAbove[leaf1ndex] = gapsWhere[gap1ndex]
62
- leafBelow[leaf1ndex] = leafBelow[leafAbove[leaf1ndex]]
63
- leafBelow[leafAbove[leaf1ndex]] = leaf1ndex
64
- leafAbove[leafBelow[leaf1ndex]] = leaf1ndex
65
- gapRangeStart[leaf1ndex] = gap1ndex
66
- leaf1ndex += 1
67
- foldGroups[taskIndex] = groupsOfFolds
@@ -1,125 +0,0 @@
1
- """I have so much truth, I need two files to contain it all!"""
2
- """TODO learn how to use this efficiently and effectively to solve problems, be DRY, and have SSOT."""
3
- from typing import Final, TYPE_CHECKING, Dict, Any, Union, Callable, Tuple, Any
4
- import numba
5
- import numba.core.compiler
6
- try:
7
- from typing import NotRequired
8
- except ImportError:
9
- from typing_extensions import NotRequired
10
-
11
- if TYPE_CHECKING:
12
- from typing import TypedDict
13
- else:
14
- TypedDict = dict
15
-
16
- """
17
- Old notes that are not entirely accurate.
18
-
19
- | **Option** | **Description** | **Why** | **Size** | **But** |
20
- | ----------------------- | --------------------------------------------------- | --------------------- | --------------- | ------------------------ |
21
- | `no_rewrites` | Disable AST rewrites optimization | Debugging | | |
22
- | `error_model` | Divide by zero: kill or chill? | Error checking | ? | |
23
- | `_nrt` | Enable No Runtime type checking | Startup speed | Smaller | No type protection |
24
- | `forceinline` | Force function inlining | Reduce function calls | Likely larger | |
25
- | `inline` | Algorithmically choose inlining | Speed | Slightly larger | |
26
- | `looplift` | Enable loop lifting optimization | Speed (if applicable) | Larger | Exclusionary |
27
- | `no_cfunc_wrapper` | Disable C function wrapper generation | Size | Smaller | Exclusionary |
28
- | `no_cpython_wrapper` | Disable Python C-API wrapper generation | Size | Smallest | Exclusionary |
29
-
30
- """
31
- # TODO try to implement all possible parameters, but use `NotRequired` for the more esoteric ones
32
- class ParametersNumba(TypedDict):
33
- _dbg_extend_lifetimes: NotRequired[bool]
34
- _dbg_optnone: NotRequired[bool]
35
- _nrt: NotRequired[bool]
36
- boundscheck: NotRequired[bool]
37
- cache: bool
38
- debug: NotRequired[bool]
39
- error_model: str
40
- fastmath: bool
41
- forceinline: bool
42
- forceobj: NotRequired[bool]
43
- inline: str
44
- locals: NotRequired[Dict[str, Any]]
45
- looplift: bool
46
- no_cfunc_wrapper: bool
47
- no_cpython_wrapper: bool
48
- no_rewrites: NotRequired[bool]
49
- nogil: NotRequired[bool]
50
- nopython: bool
51
- parallel: bool
52
- pipeline_class: NotRequired[numba.core.compiler.CompilerBase]
53
- signature_or_function: NotRequired[Union[Any, Callable, str, Tuple]]
54
- target: NotRequired[str]
55
-
56
- parametersNumbaFailEarly: Final[ParametersNumba] = {
57
- '_nrt': True,
58
- 'boundscheck': True,
59
- 'cache': True,
60
- 'error_model': 'python',
61
- 'fastmath': False,
62
- 'forceinline': True,
63
- 'inline': 'always',
64
- 'looplift': False,
65
- 'no_cfunc_wrapper': False,
66
- 'no_cpython_wrapper': False,
67
- 'nopython': True,
68
- 'parallel': False,
69
- }
70
- """For a production function: speed is irrelevant, error discovery is paramount, must be compatible with anything downstream."""
71
-
72
- parametersNumbaDEFAULT: Final[ParametersNumba] = {
73
- '_nrt': True,
74
- 'boundscheck': False,
75
- 'cache': True,
76
- 'error_model': 'numpy',
77
- 'fastmath': True,
78
- 'forceinline': True,
79
- 'inline': 'always',
80
- 'looplift': False,
81
- 'no_cfunc_wrapper': False,
82
- 'no_cpython_wrapper': False,
83
- 'nopython': True,
84
- 'parallel': False,
85
- }
86
- """Middle of the road: fast, lean, but will talk to non-jitted functions."""
87
-
88
- parametersNumbaParallelDEFAULT: Final[ParametersNumba] = {
89
- **parametersNumbaDEFAULT,
90
- '_nrt': True,
91
- 'parallel': True,
92
- }
93
- """Middle of the road: fast, lean, but will talk to non-jitted functions."""
94
-
95
- parametersNumbaSuperJit: Final[ParametersNumba] = {
96
- **parametersNumbaDEFAULT,
97
- 'no_cfunc_wrapper': True,
98
- 'no_cpython_wrapper': True,
99
- }
100
- """Speed, no helmet, no talking to non-jitted functions."""
101
-
102
- parametersNumbaSuperJitParallel: Final[ParametersNumba] = {
103
- **parametersNumbaSuperJit,
104
- '_nrt': True,
105
- 'parallel': True,
106
- }
107
- """Speed, no helmet, concurrency, no talking to non-jitted functions.
108
- Claude says, "The NRT is Numba's memory management system that handles memory allocation and deallocation for array operations. Because of array copying, you need to have NRT enabled." IDK which AI assistant autocompleted this, but, "The NRT is a bit slower than the default memory management system, but it's necessary for certain operations."
109
- """
110
-
111
- parametersNumbaMinimum: Final[ParametersNumba] = {
112
- '_nrt': True,
113
- 'boundscheck': True,
114
- 'cache': True,
115
- 'error_model': 'numpy',
116
- 'fastmath': True,
117
- 'forceinline': False,
118
- 'inline': 'always',
119
- 'looplift': False,
120
- 'no_cfunc_wrapper': False,
121
- 'no_cpython_wrapper': False,
122
- 'nopython': False,
123
- 'forceobj': True,
124
- 'parallel': False,
125
- }
@@ -1,42 +0,0 @@
1
- mapFolding/__init__.py,sha256=_YjoypHXmWLmEWwhFVgKO83Uf28ksesT9F73oJoAIPE,1323
2
- mapFolding/basecamp.py,sha256=v0VCF_Zgm_XBHcz4bqblsxfHwAxZKgenW6um77quWLk,3751
3
- mapFolding/beDRY.py,sha256=ejl-eIZTqAHCBNIND0pP_F9BxkPEWIlVXbCTk2Ki8x8,15751
4
- mapFolding/oeis.py,sha256=3hv71o8bhckjY0nsSY5JTJ2LrpJcuhZ9j3mP6LWLIQc,11124
5
- mapFolding/theDao.py,sha256=vyln6gXdRp87Xhtuy31bjCpMv_8vL4KH6s1fH40V9oA,12832
6
- mapFolding/theSSOT.py,sha256=QrEMPREjEbt1H8HcrM2Nm_hv7JsFWRG3lHdUU0Jrv-w,10238
7
- mapFolding/theSSOTnumba.py,sha256=5jTbJyu9XASYC4eIoUj98eVKWdWyjZw-XF3V2GK8cLg,4445
8
- mapFolding/reference/flattened.py,sha256=S6D9wiFTlbeoetEqaMLOcA-R22BHOzjqPRujffNxxUM,14875
9
- mapFolding/reference/hunterNumba.py,sha256=jDS0ORHkIhcJ1rzA5hT49sZHKf3rgJOoGesUCcbKFFY,6054
10
- mapFolding/reference/irvineJavaPort.py,sha256=7GvBU0tnS6wpFgkYad3465do9jBQW-2bYvbCYyABPHM,3341
11
- mapFolding/reference/jax.py,sha256=7ji9YWia6Kof0cjcNdiS1GG1rMbC5SBjcyVr_07AeUk,13845
12
- mapFolding/reference/lunnan.py,sha256=iAbJELfW6RKNMdPcBY9b6rGQ-z1zoRf-1XCurCRMOo8,3951
13
- mapFolding/reference/lunnanNumpy.py,sha256=rwVP3WIDXimpAuaxhRIuBYU56nVDTKlfGiclw_FkgUU,3765
14
- mapFolding/reference/lunnanWhile.py,sha256=uRrMT23jTJvoQDlD_FzeIQe_pfMXJG6_bRvs7uhC8z0,3271
15
- mapFolding/reference/rotatedEntryPoint.py,sha256=USZY3n3zwhSE68ATscUuN66t1qShuEbMI790Gz9JFTw,9352
16
- mapFolding/reference/total_countPlus1vsPlusN.py,sha256=wpgay-uqPOBd64Z4Pg6tg40j7-4pzWHGMM6v0bnmjhE,6288
17
- mapFolding/someAssemblyRequired/__init__.py,sha256=wtec_hIz-AKz0_hGdXsWnCKTcCxdMV9-WK6SiIriAeU,396
18
- mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=nX8tghZClYt7zJd6RpZBXhE_h-CGRHOS17biqiEdf-o,855
19
- mapFolding/someAssemblyRequired/makeJob.py,sha256=c9sTRUK90snTCcXCvs86VKBH6z_nt3OVFjNs_WgCoIg,2422
20
- mapFolding/someAssemblyRequired/synthesizeModuleJAX.py,sha256=jatvtYhK5ZJK-YmCKATt7w3icFXXO79cZDAYVrU9bgA,1258
21
- mapFolding/someAssemblyRequired/synthesizeNumba.py,sha256=3JF1FZwSB-dhLUM_pMy11dI4x1dnWOFQSfJytZHYl0M,17351
22
- mapFolding/someAssemblyRequired/synthesizeNumbaGeneralized.py,sha256=k8IaCT74ZPhHyra0MbCRdt_5k0Ov3vJgXlN5tbLVnf4,13998
23
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py,sha256=2sKZgc5kyyz2KaoApcazj_37UgBqAkxORFeROWWU5tk,9038
24
- mapFolding/someAssemblyRequired/synthesizeNumbaModules.py,sha256=_iRXjMASB_BnYJeH8Rt7FlC-GE7lkZ1Hy292XTaUCu4,3785
25
- mapFolding/syntheticModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- mapFolding/syntheticModules/numba_countInitialize.py,sha256=9u-Skda9ntDxo_CiD5T4lUU1-Ts5GDZ33zs_Ybf77-Q,4274
27
- mapFolding/syntheticModules/numba_countParallel.py,sha256=96-TDwLJgZhR9tFm2bqVDpk8TuWPx_2qFH7oNV78yUI,5517
28
- mapFolding/syntheticModules/numba_countSequential.py,sha256=WCcPYnkyNpZS7SRMvx1A-IMIAFP5iHL9u9sj9gR8Yhw,3688
29
- mapFolding/syntheticModules/numba_doTheNeedful.py,sha256=zBXDEN4DJTpCu_ho314-MWdS_08kP_vAgV-8sJDVgvo,1368
30
- tests/__init__.py,sha256=eg9smg-6VblOr0kisM40CpGnuDtU2JgEEWGDTFVOlW8,57
31
- tests/conftest.py,sha256=vH1BSOs8G6nIPWKFkSQFmX031IZqNFC4oiEia74mkHU,10554
32
- tests/test_computations.py,sha256=qBha4IggMfr6ZH06W3M66enTA6PWsx8vkDp5eqYFM9M,4765
33
- tests/test_oeis.py,sha256=31kdO1vnu2Lon43vM-YJVS4g40Ic03DWNER-cJcpxX4,4916
34
- tests/test_other.py,sha256=u0vINT5EyVsXTNTR2DZIMpWCg4FH471jjHLRzC2JX7U,8351
35
- tests/test_tasks.py,sha256=iq6_dh43JQkC2vAWXua0Xe915BKFGbvRJAkmbco854A,2389
36
- tests/test_types.py,sha256=58tmPG9WOeGGAQbdQK_h_7t4SnENnZugH4WXlI8-L-M,171
37
- mapFolding-0.4.2.dist-info/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
38
- mapFolding-0.4.2.dist-info/METADATA,sha256=EPivaT4-_Ygz9_DobQKBIigNnDkWtUq7vm6hJtYiDeQ,7633
39
- mapFolding-0.4.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
40
- mapFolding-0.4.2.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
41
- mapFolding-0.4.2.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
42
- mapFolding-0.4.2.dist-info/RECORD,,
tests/test_types.py DELETED
@@ -1,5 +0,0 @@
1
- """Type checking tests for mapFolding package."""
2
-
3
- def test_static_typing() -> None:
4
- """This is a placeholder. pytest-mypy will run type checking automatically."""
5
- pass