mapFolding 0.13.1__py3-none-any.whl → 0.14.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 (38) hide show
  1. mapFolding/_oeisFormulas/A000136.py +4 -0
  2. mapFolding/_oeisFormulas/A000560.py +4 -0
  3. mapFolding/_oeisFormulas/A000682.py +17 -0
  4. mapFolding/_oeisFormulas/A005315.py +4 -0
  5. mapFolding/_oeisFormulas/A005316.py +10 -0
  6. mapFolding/_oeisFormulas/A223094.py +7 -0
  7. mapFolding/_oeisFormulas/A259702.py +4 -0
  8. mapFolding/_oeisFormulas/A301620.py +6 -0
  9. mapFolding/_oeisFormulas/Z0Z_aOFn.py +19 -0
  10. mapFolding/_oeisFormulas/Z0Z_oeisMeanders.py +53 -0
  11. mapFolding/_oeisFormulas/__init__.py +1 -0
  12. mapFolding/_oeisFormulas/matrixMeanders.py +65 -0
  13. mapFolding/_oeisFormulas/matrixMeandersAnnex.py +84 -0
  14. mapFolding/_theSSOT.py +68 -26
  15. mapFolding/basecamp.py +2 -2
  16. mapFolding/beDRY.py +1 -1
  17. mapFolding/oeis.py +56 -167
  18. mapFolding/reference/A005316JavaPort.py +134 -0
  19. mapFolding/reference/A005316imperative.py +101 -0
  20. mapFolding/reference/A005316intOptimized.py +122 -0
  21. mapFolding/reference/A005316optimized128bit.py +79 -0
  22. mapFolding/reference/A005316primitiveOptimized.py +97 -0
  23. mapFolding/reference/A005316redis.py +118 -0
  24. mapFolding/reference/A005316write2disk.py +169 -0
  25. mapFolding/reference/irvineJavaPort.py +4 -8
  26. mapFolding/reference/matrixMeandersBaseline.py +65 -0
  27. mapFolding/reference/matrixMeandersBaselineAnnex.py +84 -0
  28. mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +45 -17
  29. mapFolding/tests/conftest.py +13 -13
  30. mapFolding/tests/test_computations.py +4 -4
  31. mapFolding/tests/test_oeis.py +7 -14
  32. mapfolding-0.14.0.dist-info/METADATA +78 -0
  33. {mapfolding-0.13.1.dist-info → mapfolding-0.14.0.dist-info}/RECORD +37 -15
  34. mapfolding-0.13.1.dist-info/METADATA +0 -154
  35. {mapfolding-0.13.1.dist-info → mapfolding-0.14.0.dist-info}/WHEEL +0 -0
  36. {mapfolding-0.13.1.dist-info → mapfolding-0.14.0.dist-info}/entry_points.txt +0 -0
  37. {mapfolding-0.13.1.dist-info → mapfolding-0.14.0.dist-info}/licenses/LICENSE +0 -0
  38. {mapfolding-0.13.1.dist-info → mapfolding-0.14.0.dist-info}/top_level.txt +0 -0
@@ -1,154 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mapFolding
3
- Version: 0.13.1
4
- Summary: Map folding algorithm with code transformation framework for optimizing numerical computations.
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,A001415,A001416,A001417,A001418,A195646,AST manipulation,Numba optimization,OEIS,algorithmic optimization,code generation,code transformation,codon optimization,combinatorics,computational geometry,dataclass transformation,folding pattern enumeration,just-in-time compilation,map folding,performance optimization,source code analysis,stamp folding
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 :: 3 :: Only
22
- Classifier: Programming Language :: Python :: 3.12
23
- Classifier: Programming Language :: Python :: 3.13
24
- Classifier: Programming Language :: Python :: 3
25
- Classifier: Programming Language :: Python :: Implementation :: CPython
26
- Classifier: Programming Language :: Python
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: hunterMakesPy
39
- Requires-Dist: numpy
40
- Requires-Dist: platformdirs
41
- Provides-Extra: development
42
- Requires-Dist: mypy; extra == "development"
43
- Requires-Dist: pyupgrade; extra == "development"
44
- Requires-Dist: setuptools-scm; extra == "development"
45
- Provides-Extra: numba
46
- Requires-Dist: numba; extra == "numba"
47
- Requires-Dist: numba_progress; extra == "numba"
48
- Provides-Extra: testing
49
- Requires-Dist: numba; extra == "testing"
50
- Requires-Dist: pytest-cov; extra == "testing"
51
- Requires-Dist: pytest-env; extra == "testing"
52
- Requires-Dist: pytest-xdist; extra == "testing"
53
- Requires-Dist: pytest; extra == "testing"
54
- Dynamic: license-file
55
-
56
- # mapFolding
57
-
58
- [![pip install mapFolding](https://img.shields.io/badge/pip%20install-mapFolding-gray.svg?colorB=3b434b)](https://pypi.org/project/mapFolding/)
59
- [![Python Tests](https://github.com/hunterhogan/mapFolding/actions/workflows/pythonTests.yml/badge.svg)](https://github.com/hunterhogan/mapFolding/actions/workflows/pythonTests.yml)
60
- [![License: CC-BY-NC-4.0](https://img.shields.io/badge/License-CC_BY--NC_4.0-3b434b)](https://creativecommons.org/licenses/by-nc/4.0/)
61
-
62
- A computational framework that starts with Lunnon's 1971 algorithm for counting distinct ways to fold maps and improves it. Plus there is a comprehensive AST transformation system for transforming algorithms for optimization and research.
63
-
64
- (Yo, the rest is AI generated and I don't have the energy to proofread it. This package helped me compute two previously unknown values: I'm sure others can improve it.)
65
-
66
- ## The Mathematical Problem
67
-
68
- Map folding is a combinatorial problem: given a rectangular grid of unit squares, how many distinct ways can you fold it? "Distinct" means that foldings producing identical final shapes are counted as one. This problem connects to combinatorial geometry, integer sequences, and computational complexity theory.
69
-
70
- The calculations extend the Online Encyclopedia of Integer Sequences (OEIS):
71
-
72
- - **A001415**: 2×n strips (computed through n=20 for the first time)
73
- - **A001418**: n×n squares
74
- - **A001416**: 3×n strips
75
- - **A001417**: n-dimensional hypercubes
76
- - **A195646**: 3×3×...×3 hypercubes
77
-
78
- ```python
79
- from mapFolding import oeisIDfor_n
80
-
81
- # How many ways can you fold a 2×4 strip?
82
- foldsTotal = oeisIDfor_n('A001415', 4)
83
- ```
84
-
85
- ## The Computational Challenge
86
-
87
- For larger maps, these calculations require hours or days to complete. A 2×20 strip requires processing leaves through billions of recursive operations. The package addresses this through systematic algorithm transformation: converting readable Python implementations into specialized, Numba-optimized modules that achieve order-of-magnitude performance improvements.
88
-
89
- ## What This Package Provides
90
-
91
- ### Core Functionality
92
-
93
- - **Complete implementation** of Lunnon's recursive algorithm
94
- - **Mathematical validation** through OEIS integration and caching
95
- - **Type-safe computational state** management with automatic initialization
96
- - **Result persistence** for long-running calculations
97
-
98
- ### Algorithm Transformation System
99
-
100
- - **AST manipulation framework** for converting dataclass-based algorithms to optimized implementations
101
- - **Automatic code generation** that produces standalone, highly optimized computation modules
102
- - **Dataclass decomposition** to enable Numba compatibility while preserving readable source code
103
- - **Comprehensive optimization** including dead code elimination, static value embedding, and aggressive compilation settings
104
- - **codon code generation**: compile map folding computation modules using [Codon](https://docs.exaloop.io/start/install/), enabling high-performance native binaries from Python source code.
105
-
106
- ### Educational Resources
107
-
108
- - **Historical implementations** showing algorithm evolution from 1971 to present
109
- - **Performance comparison** studies demonstrating optimization techniques
110
- - **Complete test suite** with patterns for validating custom implementations
111
- - **Reference documentation** for extending the transformation framework
112
-
113
- ## Use Cases
114
-
115
- **Mathematical Research**: Explore folding pattern properties, extend known sequences, or validate theoretical results against computed values.
116
-
117
- **Algorithm Optimization Learning**: Study a complete transformation assembly line that converts high-level algorithms into production-ready optimized code.
118
-
119
- **Performance Computing Education**: Examine techniques for achieving maximum Python performance through Numba integration, AST manipulation, and specialized code generation.
120
-
121
- **Combinatorial Problem Solving**: Use the framework as a template for optimizing other recursive combinatorial algorithms.
122
-
123
- ## Repository Structure
124
-
125
- - `mapFolding/`: Core implementation with modular architecture
126
- - `reference/`: Historical algorithm implementations and performance studies
127
- - `someAssemblyRequired/`: AST transformation framework
128
- - `mapFolding/tests/`: Comprehensive validation suite
129
- - `jobs/`: Generated optimized modules for specific calculations
130
-
131
- ## Performance Characteristics
132
-
133
- - **Pure Python baseline**: Educational implementations for understanding
134
- - **NumPy optimization**: ~10× improvement through vectorized operations
135
- - **Numba compilation**: ~100× improvement through native code generation
136
- - **Specialized modules**: ~1000× improvement through static optimization and embedded constants
137
-
138
- Actual performance varies by map dimensions and available hardware.
139
-
140
- ## My recovery
141
-
142
- [![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
143
- [![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UC3Gx7kz61009NbhpRtPP7tw)](https://www.youtube.com/@HunterHogan)
144
-
145
- ## How to code
146
-
147
- Coding One Step at a Time:
148
-
149
- 0. WRITE CODE.
150
- 1. Don't write stupid code that's hard to revise.
151
- 2. Write good code.
152
- 3. When revising, write better code.
153
-
154
- [![CC-BY-NC-4.0](https://github.com/hunterhogan/mapFolding/blob/main/CC-BY-NC-4.0.svg)](https://creativecommons.org/licenses/by-nc/4.0/)