mapFolding 0.16.0__tar.gz → 0.16.1__tar.gz
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-0.16.1/PKG-INFO +99 -0
- mapfolding-0.16.1/README.md +34 -0
- mapfolding-0.16.1/easyRun/A000682.py +25 -0
- mapfolding-0.16.1/easyRun/A005316.py +21 -0
- mapfolding-0.16.1/easyRun/NOTcountingFolds.py +36 -0
- mapfolding-0.16.1/easyRun/countFolds.py +41 -0
- mapfolding-0.16.1/easyRun/meanders.py +71 -0
- mapfolding-0.16.1/mapFolding/__init__.py +48 -0
- mapfolding-0.16.1/mapFolding/_dataPacking.py +68 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/_theSSOT.py +33 -37
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/_theTypes.py +21 -4
- mapfolding-0.16.1/mapFolding/algorithms/matrixMeanders.py +101 -0
- mapfolding-0.16.1/mapFolding/algorithms/matrixMeandersBeDry.py +264 -0
- mapfolding-0.16.1/mapFolding/algorithms/matrixMeandersNumPy.py +286 -0
- mapfolding-0.16.1/mapFolding/algorithms/matrixMeandersPandas.py +351 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/algorithms/oeisIDbyFormula.py +34 -24
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +32 -24
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/basecamp.py +225 -162
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/beDRY.py +2 -30
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/dataBaskets.py +91 -49
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/oeis.py +11 -32
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/A000682facts.py +617 -3
- mapfolding-0.16.1/mapFolding/reference/A005316facts.py +985 -0
- mapfolding-0.16.1/mapFolding/reference/matrixMeandersAnalysis/prefixNotationNotes.py +15 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316JavaPort.py +1 -1
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316imperative.py +1 -1
- mapfolding-0.16.1/mapFolding/reference/meandersDumpingGround/matrixMeandersNumPyV1finalForm.py +424 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +1 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +23 -11
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +5 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/RecipeJob.py +2 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +5 -4
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +3 -4
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/makingModules_count.py +4 -11
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +1 -4
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/mapFolding/__init__.py +0 -0
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/meanders/__init__.py +0 -0
- mapfolding-0.16.1/mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +64 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/toolkitMakeModules.py +30 -30
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/algorithm.py +2 -3
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/algorithmNumba.py +1 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/asynchronousAnnex.py +4 -6
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +85 -0
- mapfolding-0.16.1/mapFolding/syntheticModules/A007822/asynchronousNumba.py +52 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/initializeState.py +1 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/theorem2.py +1 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/theorem2Numba.py +6 -4
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/theorem2Trimmed.py +1 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/countParallelNumba.py +5 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/daoOfMapFoldingNumba.py +4 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/dataPacking.py +4 -2
- mapfolding-0.16.1/mapFolding/syntheticModules/dataPackingA007822.py +92 -0
- mapfolding-0.16.1/mapFolding/syntheticModules/meanders/__init__.py +1 -0
- mapfolding-0.16.1/mapFolding/syntheticModules/meanders/bigInt.py +62 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/theorem2Numba.py +3 -2
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/conftest.py +28 -13
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/test_computations.py +68 -61
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/test_oeis.py +6 -6
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/zCuzDocStoopid/__init__.py +4 -1
- mapfolding-0.16.1/mapFolding/zCuzDocStoopid/makeDocstrings.py +68 -0
- mapfolding-0.16.1/mapFolding.egg-info/PKG-INFO +99 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding.egg-info/SOURCES.txt +18 -4
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding.egg-info/requires.txt +1 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding.egg-info/top_level.txt +1 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/pyproject.toml +4 -3
- mapfolding-0.16.0/PKG-INFO +0 -85
- mapfolding-0.16.0/README.md +0 -21
- mapfolding-0.16.0/mapFolding/__init__.py +0 -91
- mapfolding-0.16.0/mapFolding/algorithms/getBucketsTotal.py +0 -137
- mapfolding-0.16.0/mapFolding/algorithms/matrixMeanders.py +0 -519
- mapfolding-0.16.0/mapFolding/reference/A005316facts.py +0 -62
- mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/evenEven.py +0 -144
- mapfolding-0.16.0/mapFolding/reference/matrixMeandersAnalysis/oddEven.py +0 -54
- mapfolding-0.16.0/mapFolding/syntheticModules/dataPackingA007822.py +0 -26
- mapfolding-0.16.0/mapFolding/trim_memory.py +0 -62
- mapfolding-0.16.0/mapFolding/zCuzDocStoopid/makeDocstrings.py +0 -63
- mapfolding-0.16.0/mapFolding.egg-info/PKG-INFO +0 -85
- {mapfolding-0.16.0 → mapfolding-0.16.1}/LICENSE +0 -0
- {mapfolding-0.16.0/mapFolding/someAssemblyRequired/A007822 → mapfolding-0.16.1/easyRun}/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/algorithms/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/algorithms/daoOfMapFolding.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/filesystemToolkit.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/py.typed +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/flattened.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/hunterNumba.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/irvineJavaPort.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/jaxCount.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/jobsCompleted/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/jobsCompleted/p2x19/p2x19.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/lunnonNumpy.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/lunnonWhile.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/matrixMeandersAnalysis/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316primitiveOptimized.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316redis.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/A005316write2disk.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/matrixMeanders64retired.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineV2.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/meandersDumpingGround/matrixMeandersSlicePop.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/rotatedEntryPoint.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
- {mapfolding-0.16.0/mapFolding/someAssemblyRequired/mapFolding → mapfolding-0.16.1/mapFolding/someAssemblyRequired/A007822}/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/_toolIfThis.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/_toolkitContainers.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/infoBooth.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/mapFolding/makeMapFoldingModules.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/toolkitNumba.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/someAssemblyRequired/transformationTools.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/asynchronous.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/initializeState.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/theorem2.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/syntheticModules/theorem2Trimmed.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/__init__.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/test_filesystem.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/test_other.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding/tests/test_tasks.py +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding.egg-info/dependency_links.txt +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/mapFolding.egg-info/entry_points.txt +0 -0
- {mapfolding-0.16.0 → mapfolding-0.16.1}/setup.cfg +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mapFolding
|
|
3
|
+
Version: 0.16.1
|
|
4
|
+
Summary: Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations, and analyze computational states.
|
|
5
|
+
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
|
+
License: CC-BY-NC-4.0
|
|
7
|
+
Project-URL: Donate, https://www.patreon.com/integrated
|
|
8
|
+
Project-URL: Homepage, https://github.com/hunterhogan/mapFolding
|
|
9
|
+
Project-URL: Issues, https://github.com/hunterhogan/mapFolding/issues
|
|
10
|
+
Project-URL: Repository, https://github.com/hunterhogan/mapFolding.git
|
|
11
|
+
Keywords: A000136,A000560,A000682,A001010,A001011,A001415,A001416,A001417,A001418,A005315,A005316,A007822,A178961,A195646,A223094,A259702,A301620,AST manipulation,JIT compilation,Numba optimization,OEIS,Python optimization,abstract syntax tree,algorithmic combinatorics,algorithmic optimization,arch configurations,automated code generation,bit-packed arrays,bitwise state machines,cache-efficient algorithms,closed meandric numbers,code generation,code optimization,code synthesis,code transformation,codon optimization,combinatorial computing,combinatorial enumeration,combinatorial geometry,combinatorial mathematics,combinatorial problem solver,combinatorics,computational combinatorics,computational geometry,crossing patterns,curve crossings,dataclass transformation,discrete mathematics,dynamic compilation,enumerative combinatorics,folding pattern enumeration,folding problems,high-performance computing,integer sequences,just-in-time compilation,kernel optimization,labeled stamp folding,low-level computation,map folding,mapFolding,mathematical algorithms,mathematical modeling,mathematical optimization,mathematical patterns,mathematical software,mathematical tool,mathematical visualization,meander enumeration,meanders,meandric systems,memory-efficient enumeration,metaprogramming,numerical algorithms,numerical computation,open meandric systems,paper folding mathematics,parallel computing,pattern recognition,performance optimization,permutation patterns,permutations,post-setup optimization,pyproject,scientific computing,semi-meanders,sequence analysis,sequence calculator,sequence enumeration,sequence explorer,sequence generation,source code analysis,stamp folding,symbolic computation,symmetric foldings,topological combinatorics,topological patterns,typed Python
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Classifier: Programming Language :: Python
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
29
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
30
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
32
|
+
Classifier: Topic :: Software Development :: Pre-processors
|
|
33
|
+
Classifier: Typing :: Typed
|
|
34
|
+
Requires-Python: >=3.12
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Requires-Dist: astToolkit
|
|
38
|
+
Requires-Dist: autoflake
|
|
39
|
+
Requires-Dist: hunterMakesPy
|
|
40
|
+
Requires-Dist: isort
|
|
41
|
+
Requires-Dist: numpy
|
|
42
|
+
Requires-Dist: platformdirs
|
|
43
|
+
Provides-Extra: development
|
|
44
|
+
Requires-Dist: memray; sys_platform == "linux" and extra == "development"
|
|
45
|
+
Requires-Dist: mypy; extra == "development"
|
|
46
|
+
Requires-Dist: pyupgrade; extra == "development"
|
|
47
|
+
Requires-Dist: py-spy; extra == "development"
|
|
48
|
+
Requires-Dist: setuptools-scm; extra == "development"
|
|
49
|
+
Provides-Extra: numba
|
|
50
|
+
Requires-Dist: numba; extra == "numba"
|
|
51
|
+
Requires-Dist: numba_progress; extra == "numba"
|
|
52
|
+
Provides-Extra: pandas
|
|
53
|
+
Requires-Dist: pandas; extra == "pandas"
|
|
54
|
+
Requires-Dist: pyarrow; extra == "pandas"
|
|
55
|
+
Requires-Dist: pyarrow-stubs; extra == "pandas"
|
|
56
|
+
Provides-Extra: testing
|
|
57
|
+
Requires-Dist: numba; extra == "testing"
|
|
58
|
+
Requires-Dist: pandas; extra == "testing"
|
|
59
|
+
Requires-Dist: pyarrow; extra == "testing"
|
|
60
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
|
61
|
+
Requires-Dist: pytest-env; extra == "testing"
|
|
62
|
+
Requires-Dist: pytest-xdist; extra == "testing"
|
|
63
|
+
Requires-Dist: pytest; extra == "testing"
|
|
64
|
+
Dynamic: license-file
|
|
65
|
+
|
|
66
|
+
# mapFolding
|
|
67
|
+
|
|
68
|
+
[](https://pypi.org/project/mapFolding/)
|
|
69
|
+
|
|
70
|
+
Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations and code optimization.
|
|
71
|
+
|
|
72
|
+
I don't know how to write a README.md. Furthermore, the package used to be focused on multidimensional map folding and tools for transforming the algorithm to experiment with optimizations or to explore the algorithm.
|
|
73
|
+
|
|
74
|
+
First, the tools for transforming algorithms became far more sophisticated and powerful than this package. So I moved them to [astToolkit](https://github.com/hunterhogan/astToolkit). But those got so sophisticated, that I create more than half of that package through another layer of meta-programming: [astToolFactory](https://github.com/hunterhogan/astToolFactory).
|
|
75
|
+
|
|
76
|
+
Second, when I finally understood the connections between map folding and meanders, I added meanders to this package, and applied my transformation tools to that algorithm.
|
|
77
|
+
|
|
78
|
+
I used a weaker form of this package to [compute new terms for OEIS A001415](https://oeis.org/A001415), "Number of ways of folding a 2 X n strip of stamps."
|
|
79
|
+
There are cool and powerful tools in here, but as of 2025 September 17, I am dissatisfied with the organization and documentation. It's annoying.
|
|
80
|
+
|
|
81
|
+
## Finding stuff
|
|
82
|
+
|
|
83
|
+
1. At the moment, almost every algorithm version eventually runs through "mapFolding/basecamp.py", so it's sort of an overview and you can work backwards to find more details.
|
|
84
|
+
2. The directory "mapFolding/algorithms" only has "handmade" algorithms. Therefore, most logic for most computations is based on something in that directory.
|
|
85
|
+
3. The directory "mapFolding/syntheticModules" has code that is generated by the transformation tools.
|
|
86
|
+
4. Transformation functions are in "mapFolding/someAssemblyRequired."
|
|
87
|
+
5. The directory "mapFolding/reference" has "reference" materials.
|
|
88
|
+
6. "mapFolding/tests" has the tests, and I have tried to make it easy for you to add _your_ versions of the algorithms to the tests. Is it actually easy? I'll say it this way: if you were to create your own subclass of `ast.AST` it would be impossible for you to add your subclass to all of the `ast` module tests with just a few lines of code. In contrast, it is possible to fully test your algorithm with in my tests by adding between three and 25 lines of code. So, yeah, it's easy.
|
|
89
|
+
|
|
90
|
+
## Math and programming
|
|
91
|
+
|
|
92
|
+
I'm not a mathematician. I don't have training in or professional experience as a programmer. I'm not stupid: I'm ignorant.
|
|
93
|
+
|
|
94
|
+
## My recovery
|
|
95
|
+
|
|
96
|
+
[](https://HunterThinks.com/support)
|
|
97
|
+
[](https://www.youtube.com/@HunterHogan)
|
|
98
|
+
|
|
99
|
+
[](https://creativecommons.org/licenses/by-nc/4.0/)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# mapFolding
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/mapFolding/)
|
|
4
|
+
|
|
5
|
+
Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations and code optimization.
|
|
6
|
+
|
|
7
|
+
I don't know how to write a README.md. Furthermore, the package used to be focused on multidimensional map folding and tools for transforming the algorithm to experiment with optimizations or to explore the algorithm.
|
|
8
|
+
|
|
9
|
+
First, the tools for transforming algorithms became far more sophisticated and powerful than this package. So I moved them to [astToolkit](https://github.com/hunterhogan/astToolkit). But those got so sophisticated, that I create more than half of that package through another layer of meta-programming: [astToolFactory](https://github.com/hunterhogan/astToolFactory).
|
|
10
|
+
|
|
11
|
+
Second, when I finally understood the connections between map folding and meanders, I added meanders to this package, and applied my transformation tools to that algorithm.
|
|
12
|
+
|
|
13
|
+
I used a weaker form of this package to [compute new terms for OEIS A001415](https://oeis.org/A001415), "Number of ways of folding a 2 X n strip of stamps."
|
|
14
|
+
There are cool and powerful tools in here, but as of 2025 September 17, I am dissatisfied with the organization and documentation. It's annoying.
|
|
15
|
+
|
|
16
|
+
## Finding stuff
|
|
17
|
+
|
|
18
|
+
1. At the moment, almost every algorithm version eventually runs through "mapFolding/basecamp.py", so it's sort of an overview and you can work backwards to find more details.
|
|
19
|
+
2. The directory "mapFolding/algorithms" only has "handmade" algorithms. Therefore, most logic for most computations is based on something in that directory.
|
|
20
|
+
3. The directory "mapFolding/syntheticModules" has code that is generated by the transformation tools.
|
|
21
|
+
4. Transformation functions are in "mapFolding/someAssemblyRequired."
|
|
22
|
+
5. The directory "mapFolding/reference" has "reference" materials.
|
|
23
|
+
6. "mapFolding/tests" has the tests, and I have tried to make it easy for you to add _your_ versions of the algorithms to the tests. Is it actually easy? I'll say it this way: if you were to create your own subclass of `ast.AST` it would be impossible for you to add your subclass to all of the `ast` module tests with just a few lines of code. In contrast, it is possible to fully test your algorithm with in my tests by adding between three and 25 lines of code. So, yeah, it's easy.
|
|
24
|
+
|
|
25
|
+
## Math and programming
|
|
26
|
+
|
|
27
|
+
I'm not a mathematician. I don't have training in or professional experience as a programmer. I'm not stupid: I'm ignorant.
|
|
28
|
+
|
|
29
|
+
## My recovery
|
|
30
|
+
|
|
31
|
+
[](https://HunterThinks.com/support)
|
|
32
|
+
[](https://www.youtube.com/@HunterHogan)
|
|
33
|
+
|
|
34
|
+
[](https://creativecommons.org/licenses/by-nc/4.0/)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ruff: noqa
|
|
2
|
+
# pyright: basic
|
|
3
|
+
from mapFolding.basecamp import NOTcountingFolds
|
|
4
|
+
import sys
|
|
5
|
+
import warnings
|
|
6
|
+
|
|
7
|
+
if sys.version_info >= (3, 14):
|
|
8
|
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
9
|
+
|
|
10
|
+
def main():
|
|
11
|
+
oeisID = 'A000682'
|
|
12
|
+
n=45
|
|
13
|
+
print(NOTcountingFolds(oeisID, n, 'matrixNumPy'))
|
|
14
|
+
|
|
15
|
+
from mapFolding import dictionaryOEIS
|
|
16
|
+
if n < dictionaryOEIS[oeisID]['valueUnknown']:
|
|
17
|
+
print(dictionaryOEIS[oeisID]['valuesKnown'][n])
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
main()
|
|
21
|
+
|
|
22
|
+
r"""
|
|
23
|
+
deactivate && C:\apps\mapFolding\.vtail\Scripts\activate.bat && title good && cls
|
|
24
|
+
title running && py Z0Z_A000682.py && title I'm done || title Error
|
|
25
|
+
"""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ruff: noqa
|
|
2
|
+
# pyright: basic
|
|
3
|
+
from mapFolding.basecamp import A005316
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
7
|
+
|
|
8
|
+
n=25
|
|
9
|
+
print(A005316(n))
|
|
10
|
+
|
|
11
|
+
from mapFolding import dictionaryOEIS
|
|
12
|
+
|
|
13
|
+
if n < dictionaryOEIS['A005316']['valueUnknown']:
|
|
14
|
+
print(dictionaryOEIS['A005316']['valuesKnown'][n])
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
r"""
|
|
18
|
+
deactivate && C:\apps\mapFolding\.vtail\Scripts\activate.bat && title good && cls
|
|
19
|
+
title running && py Z0Z_A005316.py && title I'm done || title Error
|
|
20
|
+
|
|
21
|
+
"""
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ruff: noqa
|
|
2
|
+
from mapFolding import dictionaryOEIS
|
|
3
|
+
from mapFolding.basecamp import NOTcountingFolds
|
|
4
|
+
import sys
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
if __name__ == '__main__':
|
|
8
|
+
def _write() -> None:
|
|
9
|
+
sys.stdout.write(
|
|
10
|
+
f"{(match:=countTotal == dictionaryOEIS[oeisID]['valuesKnown'][n])}\t"
|
|
11
|
+
f"\033[{(not match)*91}m"
|
|
12
|
+
f"{n}\t"
|
|
13
|
+
f"{countTotal}\t"
|
|
14
|
+
f"{time.perf_counter() - timeStart:.2f}\t"
|
|
15
|
+
"\033[0m\n"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
CPUlimit: bool | float | int | None = -2
|
|
19
|
+
# oeisID: str | None = None
|
|
20
|
+
oeis_n: int | None = None
|
|
21
|
+
flow: str | None = None
|
|
22
|
+
|
|
23
|
+
oeisID = 'A007822'
|
|
24
|
+
|
|
25
|
+
flow = 'asynchronousTrimmed'
|
|
26
|
+
flow = 'asynchronous'
|
|
27
|
+
flow = 'asynchronousNumba'
|
|
28
|
+
flow = 'algorithm'
|
|
29
|
+
flow = 'theorem2Numba'
|
|
30
|
+
|
|
31
|
+
for n in range(5,11):
|
|
32
|
+
|
|
33
|
+
timeStart = time.perf_counter()
|
|
34
|
+
countTotal = NOTcountingFolds(oeisID, n, flow, CPUlimit)
|
|
35
|
+
|
|
36
|
+
_write()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ruff: noqa
|
|
2
|
+
# pyright: basic
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from mapFolding import countFolds, dictionaryOEISMapFolding
|
|
5
|
+
from os import PathLike
|
|
6
|
+
from pathlib import PurePath
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
|
|
10
|
+
if __name__ == '__main__':
|
|
11
|
+
def _write() -> None:
|
|
12
|
+
sys.stdout.write(
|
|
13
|
+
f"{(match:=foldsTotal == dictionaryOEISMapFolding[oeisID]['valuesKnown'][n])}\t"
|
|
14
|
+
f"\033[{(not match)*91}m"
|
|
15
|
+
f"{n}\t"
|
|
16
|
+
f"{foldsTotal}\t"
|
|
17
|
+
f"{time.perf_counter() - timeStart:.2f}\t"
|
|
18
|
+
"\033[0m\n"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
listDimensions: Sequence[int] | None = None
|
|
22
|
+
pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None
|
|
23
|
+
computationDivisions: int | str | None = None
|
|
24
|
+
CPUlimit: bool | float | int | None = None
|
|
25
|
+
# mapShape: tuple[int, ...] | None = None
|
|
26
|
+
flow: str | None = 'theorem2Numba'
|
|
27
|
+
|
|
28
|
+
oeisID: str = 'A001415'
|
|
29
|
+
for n in range(3,8):
|
|
30
|
+
|
|
31
|
+
mapShape: tuple[int, ...] = dictionaryOEISMapFolding[oeisID]['getMapShape'](n)
|
|
32
|
+
|
|
33
|
+
timeStart = time.perf_counter()
|
|
34
|
+
foldsTotal: int = countFolds(listDimensions=listDimensions
|
|
35
|
+
, pathLikeWriteFoldsTotal=pathLikeWriteFoldsTotal
|
|
36
|
+
, computationDivisions=computationDivisions
|
|
37
|
+
, CPUlimit=CPUlimit
|
|
38
|
+
, mapShape=mapShape
|
|
39
|
+
, flow=flow)
|
|
40
|
+
|
|
41
|
+
_write()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# ruff: noqa
|
|
2
|
+
# pyright: basic
|
|
3
|
+
from mapFolding import dictionaryOEIS
|
|
4
|
+
from mapFolding.basecamp import NOTcountingFolds
|
|
5
|
+
import gc
|
|
6
|
+
import multiprocessing
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
import warnings
|
|
10
|
+
|
|
11
|
+
def write() -> None:
|
|
12
|
+
sys.stdout.write(
|
|
13
|
+
f"{(booleanColor:=(countTotal == dictionaryOEIS[oeisID]['valuesKnown'][n]))}\t"
|
|
14
|
+
f"\033[{(not booleanColor)*91}m"
|
|
15
|
+
f"{n}\t"
|
|
16
|
+
# f"{countTotal}\t"
|
|
17
|
+
# f"{dictionaryOEISMeanders[oeisID]['valuesKnown'][n]}\t"
|
|
18
|
+
f"{time.perf_counter() - timeStart:.2f}\t"
|
|
19
|
+
"\033[0m\n"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
multiprocessing.set_start_method('spawn')
|
|
24
|
+
if sys.version_info >= (3, 14):
|
|
25
|
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
26
|
+
|
|
27
|
+
flow = 'matrixPandas'
|
|
28
|
+
flow = 'matrixMeanders'
|
|
29
|
+
flow = 'matrixNumPy'
|
|
30
|
+
|
|
31
|
+
for oeisID in [
|
|
32
|
+
'A005316',
|
|
33
|
+
'A000682',
|
|
34
|
+
]:
|
|
35
|
+
sys.stdout.write(f"\n{oeisID}\n")
|
|
36
|
+
|
|
37
|
+
"""TODO Identifiers. improve
|
|
38
|
+
kOfMatrix: I don't think the paper uses 'k'. step?
|
|
39
|
+
|
|
40
|
+
ReidemeisterMove?
|
|
41
|
+
flipTheExtra_0b1AsUfunc: what is extra?
|
|
42
|
+
|
|
43
|
+
"strand" is an interesting word.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
# for n in range(44,45):
|
|
47
|
+
|
|
48
|
+
# for n in range(43,56):
|
|
49
|
+
# for n in range(46,47):
|
|
50
|
+
# for n in range(43,47):
|
|
51
|
+
# for n in range(38,43):
|
|
52
|
+
# for n in range(28,38):
|
|
53
|
+
# for n in [*range(2, 10), *range(28,33)]:
|
|
54
|
+
# for n in range(28,33):
|
|
55
|
+
# for n in range(2, 28):
|
|
56
|
+
# for n in range(2, 10):
|
|
57
|
+
for n in range(1, 6):
|
|
58
|
+
|
|
59
|
+
gc.collect()
|
|
60
|
+
timeStart = time.perf_counter()
|
|
61
|
+
countTotal = NOTcountingFolds(oeisID, n, flow)
|
|
62
|
+
if n < dictionaryOEIS[oeisID]['valueUnknown']:
|
|
63
|
+
write()
|
|
64
|
+
else:
|
|
65
|
+
sys.stdout.write(f"{n} {countTotal} {time.perf_counter() - timeStart:.2f}\n")
|
|
66
|
+
|
|
67
|
+
r"""
|
|
68
|
+
deactivate && C:\apps\mapFolding\.vtail\Scripts\activate.bat && title good && cls
|
|
69
|
+
title running && py Z0Z_aOFn.py && title I'm done || title Error
|
|
70
|
+
|
|
71
|
+
"""
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Map folding, meanders, stamp folding, semi-meanders. Experiment with algorithm transformations, and analyze computational states."""
|
|
2
|
+
|
|
3
|
+
from mapFolding._theTypes import (
|
|
4
|
+
Array1DElephino as Array1DElephino,
|
|
5
|
+
Array1DFoldsTotal as Array1DFoldsTotal,
|
|
6
|
+
Array1DLeavesTotal as Array1DLeavesTotal,
|
|
7
|
+
Array3DLeavesTotal as Array3DLeavesTotal,
|
|
8
|
+
axisOfLength as axisOfLength,
|
|
9
|
+
DatatypeElephino as DatatypeElephino,
|
|
10
|
+
DatatypeFoldsTotal as DatatypeFoldsTotal,
|
|
11
|
+
DatatypeLeavesTotal as DatatypeLeavesTotal,
|
|
12
|
+
MetadataOEISid as MetadataOEISid,
|
|
13
|
+
MetadataOEISidManuallySet as MetadataOEISidManuallySet,
|
|
14
|
+
MetadataOEISidMapFolding as MetadataOEISidMapFolding,
|
|
15
|
+
MetadataOEISidMapFoldingManuallySet as MetadataOEISidMapFoldingManuallySet,
|
|
16
|
+
NumPyElephino as NumPyElephino,
|
|
17
|
+
NumPyFoldsTotal as NumPyFoldsTotal,
|
|
18
|
+
NumPyIntegerType as NumPyIntegerType,
|
|
19
|
+
NumPyLeavesTotal as NumPyLeavesTotal,
|
|
20
|
+
ShapeArray as ShapeArray,
|
|
21
|
+
ShapeSlicer as ShapeSlicer)
|
|
22
|
+
|
|
23
|
+
from mapFolding._theSSOT import packageSettings as packageSettings
|
|
24
|
+
|
|
25
|
+
from mapFolding.beDRY import (
|
|
26
|
+
getConnectionGraph as getConnectionGraph,
|
|
27
|
+
getLeavesTotal as getLeavesTotal,
|
|
28
|
+
getTaskDivisions as getTaskDivisions,
|
|
29
|
+
makeDataContainer as makeDataContainer,
|
|
30
|
+
setProcessorLimit as setProcessorLimit,
|
|
31
|
+
validateListDimensions as validateListDimensions)
|
|
32
|
+
|
|
33
|
+
from mapFolding.filesystemToolkit import (
|
|
34
|
+
getFilenameFoldsTotal as getFilenameFoldsTotal,
|
|
35
|
+
getPathFilenameFoldsTotal as getPathFilenameFoldsTotal,
|
|
36
|
+
getPathRootJobDEFAULT as getPathRootJobDEFAULT,
|
|
37
|
+
saveFoldsTotal as saveFoldsTotal,
|
|
38
|
+
saveFoldsTotalFAILearly as saveFoldsTotalFAILearly)
|
|
39
|
+
|
|
40
|
+
from mapFolding.basecamp import countFolds as countFolds
|
|
41
|
+
|
|
42
|
+
from mapFolding.oeis import (
|
|
43
|
+
dictionaryOEIS as dictionaryOEIS,
|
|
44
|
+
dictionaryOEISMapFolding as dictionaryOEISMapFolding,
|
|
45
|
+
getFoldsTotalKnown as getFoldsTotalKnown,
|
|
46
|
+
getOEISids as getOEISids,
|
|
47
|
+
OEIS_for_n as OEIS_for_n,
|
|
48
|
+
oeisIDfor_n as oeisIDfor_n)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from mapFolding.dataBaskets import MapFoldingState
|
|
3
|
+
from typing import Any
|
|
4
|
+
import astToolkit
|
|
5
|
+
import dataclasses
|
|
6
|
+
import functools
|
|
7
|
+
import inspect
|
|
8
|
+
|
|
9
|
+
r"""Notes
|
|
10
|
+
Goal: create a decorator, `unRePackMapFoldingState`, that will unpack `MapFoldingState`, pass only the parameters in the decorated function, receive the
|
|
11
|
+
values returned by the function, and repack `MapFoldingState`.
|
|
12
|
+
|
|
13
|
+
You must use dynamic programming. If the datatype or the field name changes, for example, that should not affect the decorator.
|
|
14
|
+
|
|
15
|
+
To use in, for example, C:\apps\mapFolding\mapFolding\syntheticModules\A007822\theorem2Numba.py. Analogous to
|
|
16
|
+
`Z0Z_tools.waveformSpectrogramWaveform`, see
|
|
17
|
+
https://github.com/hunterhogan/Z0Z_tools/blob/2c393c2831382dfe6f3e742cf56db39e71126cbc/Z0Z_tools/ioAudio.py
|
|
18
|
+
|
|
19
|
+
For examples of manipulating `dataclasses`, see also:
|
|
20
|
+
C:\apps\mapFolding\mapFolding\someAssemblyRequired\_toolkitContainers.py and
|
|
21
|
+
C:\apps\mapFolding\mapFolding\someAssemblyRequired\transformationTools.py
|
|
22
|
+
|
|
23
|
+
- `TypeVar` may be useful.
|
|
24
|
+
|
|
25
|
+
- `dataclasses` has inspection tools.
|
|
26
|
+
|
|
27
|
+
- `return MapFoldingState(...` Check if the field is init=True
|
|
28
|
+
|
|
29
|
+
Prototype. Eventual home will probably be "beDry.py".
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def unRePackMapFoldingState[CallableTargetType: Callable[..., Any]](callableTarget: CallableTargetType) -> Callable[[MapFoldingState], MapFoldingState]:
|
|
33
|
+
signatureTargetFunction: inspect.Signature = inspect.signature(callableTarget)
|
|
34
|
+
parametersTargetFunction: list[str] = list(signatureTargetFunction.parameters.keys())
|
|
35
|
+
|
|
36
|
+
fieldsMapFoldingState: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(MapFoldingState)
|
|
37
|
+
|
|
38
|
+
fieldsInitializable: dict[str, dataclasses.Field[Any]] = {field.name: field for field in fieldsMapFoldingState if field.init}
|
|
39
|
+
|
|
40
|
+
@functools.wraps(callableTarget)
|
|
41
|
+
def decoratedFunction(mapFoldingStateInstance: MapFoldingState, **additionalKeywordArguments: Any) -> MapFoldingState:
|
|
42
|
+
dataclassAsDict: dict[str, Any] = dataclasses.asdict(mapFoldingStateInstance)
|
|
43
|
+
|
|
44
|
+
argumentsForTargetFunction: list[Any] = []
|
|
45
|
+
for parameterName in parametersTargetFunction:
|
|
46
|
+
if parameterName in dataclassAsDict:
|
|
47
|
+
argumentsForTargetFunction.append(dataclassAsDict[parameterName])
|
|
48
|
+
elif parameterName in additionalKeywordArguments:
|
|
49
|
+
argumentsForTargetFunction.append(additionalKeywordArguments[parameterName])
|
|
50
|
+
else:
|
|
51
|
+
errorMessage = f"Parameter '{parameterName}' not found in MapFoldingState or additional arguments"
|
|
52
|
+
raise ValueError(errorMessage)
|
|
53
|
+
|
|
54
|
+
returnedFromTargetFunction: Any = callableTarget(*argumentsForTargetFunction)
|
|
55
|
+
|
|
56
|
+
argumentsForMapFoldingStateConstructor: dict[str, Any] = {fieldName: dataclassAsDict[fieldName] for fieldName in fieldsInitializable}
|
|
57
|
+
|
|
58
|
+
if len(parametersTargetFunction) == 1:
|
|
59
|
+
singleParameterName: str = parametersTargetFunction[0]
|
|
60
|
+
if singleParameterName in fieldsInitializable:
|
|
61
|
+
argumentsForMapFoldingStateConstructor[singleParameterName] = returnedFromTargetFunction
|
|
62
|
+
elif isinstance(returnedFromTargetFunction, tuple) and len(returnedFromTargetFunction) == len(parametersTargetFunction):
|
|
63
|
+
updatedFieldsFromReturn: dict[str, Any] = {parameterName: returnedValue for parameterName, returnedValue in zip(parametersTargetFunction, returnedFromTargetFunction, strict=True) if parameterName in fieldsInitializable}
|
|
64
|
+
argumentsForMapFoldingStateConstructor.update(updatedFieldsFromReturn)
|
|
65
|
+
|
|
66
|
+
return MapFoldingState(**argumentsForMapFoldingStateConstructor)
|
|
67
|
+
|
|
68
|
+
return decoratedFunction
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Access and configure package settings and metadata."""
|
|
2
2
|
|
|
3
3
|
from hunterMakesPy import PackageSettings
|
|
4
|
-
from mapFolding._theTypes import
|
|
4
|
+
from mapFolding._theTypes import MetadataOEISidManuallySet, MetadataOEISidMapFoldingManuallySet
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
import dataclasses
|
|
7
7
|
import random
|
|
@@ -27,14 +27,14 @@ class mapFoldingPackageSettings(PackageSettings):
|
|
|
27
27
|
Package identifier for concurrent execution operations.
|
|
28
28
|
OEISidMapFoldingManuallySet : dict[str, MetadataOEISidMapFoldingManuallySet]
|
|
29
29
|
Settings that are best selected by a human instead of algorithmically.
|
|
30
|
-
|
|
30
|
+
OEISidManuallySet : dict[str, MetadataOEISidMeandersManuallySet]
|
|
31
31
|
Settings that are best selected by a human instead of algorithmically for meander sequences.
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
34
|
OEISidMapFoldingManuallySet: dict[str, MetadataOEISidMapFoldingManuallySet] = dataclasses.field(default_factory=dict[str, MetadataOEISidMapFoldingManuallySet])
|
|
35
35
|
"""Settings that are best selected by a human instead of algorithmically."""
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
OEISidManuallySet: dict[str, MetadataOEISidManuallySet] = dataclasses.field(default_factory=dict[str, MetadataOEISidManuallySet])
|
|
38
38
|
"""Settings that are best selected by a human instead of algorithmically for meander sequences."""
|
|
39
39
|
|
|
40
40
|
cacheDays: int = 30
|
|
@@ -42,50 +42,44 @@ class mapFoldingPackageSettings(PackageSettings):
|
|
|
42
42
|
|
|
43
43
|
concurrencyPackage: str = 'multiprocessing'
|
|
44
44
|
"""Package identifier for concurrent execution operations."""
|
|
45
|
-
|
|
45
|
+
# ruff: noqa: S311
|
|
46
46
|
# TODO I made a `TypedDict` before I knew how to make dataclasses and classes. Think about other data structures.
|
|
47
47
|
OEISidMapFoldingManuallySet: dict[str, MetadataOEISidMapFoldingManuallySet] = {
|
|
48
48
|
'A000136': {
|
|
49
49
|
'getMapShape': lambda n: (1, n),
|
|
50
50
|
'valuesBenchmark': [14],
|
|
51
|
-
'valuesTestParallelization': [
|
|
52
|
-
'valuesTestValidation': [random.randint(2, 9)],
|
|
51
|
+
'valuesTestParallelization': [random.randint(3, 7)],
|
|
52
|
+
'valuesTestValidation': [random.randint(2, 9)],
|
|
53
53
|
},
|
|
54
54
|
'A001415': {
|
|
55
55
|
'getMapShape': lambda n: (2, n),
|
|
56
56
|
'valuesBenchmark': [14],
|
|
57
|
-
'valuesTestParallelization': [
|
|
58
|
-
'valuesTestValidation': [random.randint(2, 9)],
|
|
57
|
+
'valuesTestParallelization': [random.randint(3, 7)],
|
|
58
|
+
'valuesTestValidation': [random.randint(2, 9)],
|
|
59
59
|
},
|
|
60
60
|
'A001416': {
|
|
61
61
|
'getMapShape': lambda n: (3, n),
|
|
62
62
|
'valuesBenchmark': [9],
|
|
63
|
-
'valuesTestParallelization': [
|
|
64
|
-
'valuesTestValidation': [random.randint(2, 6)],
|
|
63
|
+
'valuesTestParallelization': [random.randint(3, 5)],
|
|
64
|
+
'valuesTestValidation': [random.randint(2, 6)],
|
|
65
65
|
},
|
|
66
66
|
'A001417': {
|
|
67
67
|
'getMapShape': lambda n: tuple(2 for _dimension in range(n)),
|
|
68
68
|
'valuesBenchmark': [6],
|
|
69
|
-
'valuesTestParallelization': [
|
|
70
|
-
'valuesTestValidation': [random.randint(2, 4)],
|
|
69
|
+
'valuesTestParallelization': [random.randint(2, 4)],
|
|
70
|
+
'valuesTestValidation': [random.randint(2, 4)],
|
|
71
71
|
},
|
|
72
72
|
'A195646': {
|
|
73
73
|
'getMapShape': lambda n: tuple(3 for _dimension in range(n)),
|
|
74
74
|
'valuesBenchmark': [3],
|
|
75
|
-
'valuesTestParallelization': [
|
|
75
|
+
'valuesTestParallelization': [2],
|
|
76
76
|
'valuesTestValidation': [2],
|
|
77
77
|
},
|
|
78
78
|
'A001418': {
|
|
79
79
|
'getMapShape': lambda n: (n, n),
|
|
80
80
|
'valuesBenchmark': [5],
|
|
81
81
|
'valuesTestParallelization': [*range(2, 4)],
|
|
82
|
-
'valuesTestValidation': [random.randint(2, 4)],
|
|
83
|
-
},
|
|
84
|
-
'A007822': {
|
|
85
|
-
'getMapShape': lambda n: (1, 2 * n),
|
|
86
|
-
'valuesBenchmark': [7],
|
|
87
|
-
'valuesTestParallelization': [*range(2, 4)],
|
|
88
|
-
'valuesTestValidation': [random.randint(2, 8)], # noqa: S311
|
|
82
|
+
'valuesTestValidation': [random.randint(2, 4)],
|
|
89
83
|
},
|
|
90
84
|
}
|
|
91
85
|
|
|
@@ -95,29 +89,31 @@ identifierPackageFALLBACK = "mapFolding"
|
|
|
95
89
|
packageSettings = mapFoldingPackageSettings(identifierPackageFALLBACK=identifierPackageFALLBACK, OEISidMapFoldingManuallySet=OEISidMapFoldingManuallySet)
|
|
96
90
|
"""Global package settings."""
|
|
97
91
|
|
|
98
|
-
# TODO integrate into packageSettings
|
|
99
|
-
pathCache: Path = packageSettings.pathPackage / ".cache"
|
|
100
92
|
"""Local directory path for storing cached OEIS sequence data and metadata."""
|
|
101
|
-
|
|
102
|
-
'A000560': {'valuesTestValidation': [
|
|
103
|
-
'A000682': {'valuesTestValidation': [
|
|
104
|
-
'A001010': {'valuesTestValidation': [
|
|
105
|
-
'A001011': {'valuesTestValidation': [
|
|
106
|
-
'A005315': {'valuesTestValidation': [
|
|
107
|
-
'A005316': {'valuesTestValidation': [
|
|
108
|
-
'
|
|
109
|
-
'
|
|
110
|
-
'
|
|
111
|
-
'
|
|
112
|
-
'
|
|
113
|
-
'
|
|
114
|
-
'
|
|
93
|
+
OEISidManuallySet: dict[str, MetadataOEISidManuallySet] = {
|
|
94
|
+
'A000560': {'valuesTestValidation': [random.randint(3, 12)]},
|
|
95
|
+
'A000682': {'valuesTestValidation': [random.randint(3, 12), 32]},
|
|
96
|
+
'A001010': {'valuesTestValidation': [3, 4, random.randint(5, 11)]},
|
|
97
|
+
'A001011': {'valuesTestValidation': [3, 4, random.randint(5, 7)]},
|
|
98
|
+
'A005315': {'valuesTestValidation': [random.randint(3, 9)]},
|
|
99
|
+
'A005316': {'valuesTestValidation': [random.randint(3, 13)]},
|
|
100
|
+
'A007822': {'valuesTestValidation': [random.randint(2, 8)]}, #, 'valuesBenchmark': [7], 'valuesTestParallelization': [*range(2, 4)]},
|
|
101
|
+
'A060206': {'valuesTestValidation': [random.randint(3, 9)]},
|
|
102
|
+
'A077460': {'valuesTestValidation': [3, 4, random.randint(5, 8)]},
|
|
103
|
+
'A078591': {'valuesTestValidation': [random.randint(3, 10)]},
|
|
104
|
+
'A178961': {'valuesTestValidation': [random.randint(3, 11)]},
|
|
105
|
+
'A223094': {'valuesTestValidation': [random.randint(3, 11)]},
|
|
106
|
+
'A259702': {'valuesTestValidation': [random.randint(3, 13)]},
|
|
107
|
+
'A301620': {'valuesTestValidation': [random.randint(3, 11)]},
|
|
115
108
|
}
|
|
116
109
|
|
|
117
110
|
# Recreate packageSettings with meanders settings included
|
|
118
111
|
packageSettings = mapFoldingPackageSettings(
|
|
119
112
|
identifierPackageFALLBACK=identifierPackageFALLBACK,
|
|
120
113
|
OEISidMapFoldingManuallySet=OEISidMapFoldingManuallySet,
|
|
121
|
-
|
|
114
|
+
OEISidManuallySet=OEISidManuallySet,
|
|
122
115
|
)
|
|
123
116
|
"""Global package settings."""
|
|
117
|
+
|
|
118
|
+
# TODO integrate into packageSettings
|
|
119
|
+
pathCache: Path = packageSettings.pathPackage / ".cache"
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from collections.abc import Callable
|
|
4
4
|
from numpy import dtype, int_ as numpy_int, integer, ndarray, uint64 as numpy_uint64
|
|
5
|
-
from
|
|
5
|
+
from types import EllipsisType
|
|
6
|
+
from typing import Any, Final, NamedTuple, TypeAlias, TypedDict, TypeVar
|
|
6
7
|
|
|
7
8
|
NumPyIntegerType = TypeVar('NumPyIntegerType', bound=integer[Any], covariant=True)
|
|
8
9
|
"""Any NumPy integer type, which is usually between 8-bit signed and 64-bit unsigned."""
|
|
@@ -65,7 +66,7 @@ class MetadataOEISidMapFoldingManuallySet(TypedDict):
|
|
|
65
66
|
"""List of index values, 'n', to use when testing validation performance."""
|
|
66
67
|
|
|
67
68
|
class MetadataOEISidMapFolding(TypedDict):
|
|
68
|
-
"""Settings for an
|
|
69
|
+
"""Settings for an OEIS ID that may be computed by a multidimensional map folding algorithm."""
|
|
69
70
|
|
|
70
71
|
description: str
|
|
71
72
|
"""The OEIS.org description of the integer sequence."""
|
|
@@ -85,7 +86,7 @@ class MetadataOEISidMapFolding(TypedDict):
|
|
|
85
86
|
"""The smallest value of 'n' for for which `foldsTotal` is unknown."""
|
|
86
87
|
|
|
87
88
|
# ruff: noqa: ERA001
|
|
88
|
-
class
|
|
89
|
+
class MetadataOEISidManuallySet(TypedDict):
|
|
89
90
|
"""Settings that are best selected by a human instead of algorithmically."""
|
|
90
91
|
|
|
91
92
|
# valuesBenchmark: list[int]
|
|
@@ -95,7 +96,7 @@ class MetadataOEISidMeandersManuallySet(TypedDict):
|
|
|
95
96
|
valuesTestValidation: list[int]
|
|
96
97
|
"""List of index values, 'n', to use when testing validation performance."""
|
|
97
98
|
|
|
98
|
-
class
|
|
99
|
+
class MetadataOEISid(TypedDict):
|
|
99
100
|
"""Settings for an implemented OEIS sequence."""
|
|
100
101
|
|
|
101
102
|
description: str
|
|
@@ -112,3 +113,19 @@ class MetadataOEISidMeanders(TypedDict):
|
|
|
112
113
|
"""List of index values, 'n', to use when testing validation performance."""
|
|
113
114
|
valueUnknown: int
|
|
114
115
|
"""The smallest value of 'n' for for which `foldsTotal` is unknown."""
|
|
116
|
+
|
|
117
|
+
# TODO Figure out how to have a SSOT for the axis order.
|
|
118
|
+
axisOfLength: Final[int] = 0
|
|
119
|
+
|
|
120
|
+
class ShapeArray(NamedTuple):
|
|
121
|
+
"""Always use this to construct arrays, so you can reorder the axes merely by reordering this class."""
|
|
122
|
+
|
|
123
|
+
length: int
|
|
124
|
+
indices: int
|
|
125
|
+
|
|
126
|
+
class ShapeSlicer(NamedTuple):
|
|
127
|
+
"""Always use this to construct slicers, so you can reorder the axes merely by reordering this class."""
|
|
128
|
+
|
|
129
|
+
length: EllipsisType | slice
|
|
130
|
+
indices: int
|
|
131
|
+
|