algroots 0.1.0__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.
Files changed (102) hide show
  1. algroots-0.1.0/.github/workflows/benchmarks.yml +25 -0
  2. algroots-0.1.0/.github/workflows/mutation.yml +38 -0
  3. algroots-0.1.0/.github/workflows/python-package.yml +275 -0
  4. algroots-0.1.0/.gitignore +30 -0
  5. algroots-0.1.0/CITATION.cff +10 -0
  6. algroots-0.1.0/CONTRIBUTING.md +55 -0
  7. algroots-0.1.0/LICENSE +674 -0
  8. algroots-0.1.0/PKG-INFO +173 -0
  9. algroots-0.1.0/README.md +131 -0
  10. algroots-0.1.0/benchmarks/README.md +10 -0
  11. algroots-0.1.0/benchmarks/test_solver_benchmarks.py +98 -0
  12. algroots-0.1.0/docs/algorithms.md +146 -0
  13. algroots-0.1.0/docs/api.md +449 -0
  14. algroots-0.1.0/docs/branch-semantics.md +131 -0
  15. algroots-0.1.0/docs/choosing-a-backend.md +170 -0
  16. algroots-0.1.0/docs/completeness-versus-verification.md +126 -0
  17. algroots-0.1.0/docs/continuation-and-monodromy.md +337 -0
  18. algroots-0.1.0/docs/end-to-end-example.md +289 -0
  19. algroots-0.1.0/docs/exact-border-bases.md +63 -0
  20. algroots-0.1.0/docs/exact-recognition.md +80 -0
  21. algroots-0.1.0/docs/examples-gallery.md +191 -0
  22. algroots-0.1.0/docs/feature-support-matrix.md +42 -0
  23. algroots-0.1.0/docs/guarantees-and-result-semantics.md +160 -0
  24. algroots-0.1.0/docs/homotopy-continuation.md +111 -0
  25. algroots-0.1.0/docs/index.md +38 -0
  26. algroots-0.1.0/docs/limitations.md +50 -0
  27. algroots-0.1.0/docs/multiplicity-and-singular-roots.md +127 -0
  28. algroots-0.1.0/docs/numerical-reliability.md +49 -0
  29. algroots-0.1.0/docs/performance-model.md +132 -0
  30. algroots-0.1.0/docs/precision-and-conditioning.md +169 -0
  31. algroots-0.1.0/docs/quick-start.md +66 -0
  32. algroots-0.1.0/docs/rational-univariate-representation.md +79 -0
  33. algroots-0.1.0/docs/supported-problems.md +57 -0
  34. algroots-0.1.0/docs/troubleshooting.md +195 -0
  35. algroots-0.1.0/pyproject.toml +105 -0
  36. algroots-0.1.0/src/algroots/__init__.py +123 -0
  37. algroots-0.1.0/src/algroots/_validation.py +48 -0
  38. algroots-0.1.0/src/algroots/algebraic.py +329 -0
  39. algroots-0.1.0/src/algroots/algebraization.py +225 -0
  40. algroots-0.1.0/src/algroots/border_basis.py +939 -0
  41. algroots-0.1.0/src/algroots/continuation.py +527 -0
  42. algroots-0.1.0/src/algroots/errors.py +37 -0
  43. algroots-0.1.0/src/algroots/monodromy.py +845 -0
  44. algroots-0.1.0/src/algroots/monodromy_stopping.py +150 -0
  45. algroots-0.1.0/src/algroots/numerical.py +277 -0
  46. algroots-0.1.0/src/algroots/rational_univariate/__init__.py +23 -0
  47. algroots-0.1.0/src/algroots/rational_univariate/construction.py +122 -0
  48. algroots-0.1.0/src/algroots/rational_univariate/quotient.py +291 -0
  49. algroots-0.1.0/src/algroots/rational_univariate/representation.py +111 -0
  50. algroots-0.1.0/src/algroots/rational_univariate/solve.py +131 -0
  51. algroots-0.1.0/src/algroots/recognition.py +407 -0
  52. algroots-0.1.0/src/algroots/solver.py +1707 -0
  53. algroots-0.1.0/src/algroots/total_degree_homotopy.py +217 -0
  54. algroots-0.1.0/tests/conftest.py +27 -0
  55. algroots-0.1.0/tests/regressions/test_branch_filter_negative_two_thirds.py +12 -0
  56. algroots-0.1.0/tests/regressions/test_pole_component_saturation.py +19 -0
  57. algroots-0.1.0/tests/regressions/test_separator_collision_retry.py +23 -0
  58. algroots-0.1.0/tests/test_action_matrix.py +136 -0
  59. algroots-0.1.0/tests/test_action_matrix_math.py +64 -0
  60. algroots-0.1.0/tests/test_action_matrix_oracle_randomized.py +89 -0
  61. algroots-0.1.0/tests/test_action_matrix_structure.py +32 -0
  62. algroots-0.1.0/tests/test_algebraic_systems.py +183 -0
  63. algroots-0.1.0/tests/test_algebraization_equivalence.py +42 -0
  64. algroots-0.1.0/tests/test_backend_differential.py +136 -0
  65. algroots-0.1.0/tests/test_border_basis.py +118 -0
  66. algroots-0.1.0/tests/test_branch_and_pole_adversarial.py +50 -0
  67. algroots-0.1.0/tests/test_capability_matrix.py +51 -0
  68. algroots-0.1.0/tests/test_clustered_roots_and_precision.py +70 -0
  69. algroots-0.1.0/tests/test_coefficient_domain_stress.py +33 -0
  70. algroots-0.1.0/tests/test_complex_branch_semantics.py +42 -0
  71. algroots-0.1.0/tests/test_constructed_systems_hypothesis.py +74 -0
  72. algroots-0.1.0/tests/test_documentation_consistency.py +109 -0
  73. algroots-0.1.0/tests/test_documentation_examples.py +68 -0
  74. algroots-0.1.0/tests/test_exact_certification.py +202 -0
  75. algroots-0.1.0/tests/test_flint_backend_ci.py +48 -0
  76. algroots-0.1.0/tests/test_homotopy_differential_hypothesis.py +65 -0
  77. algroots-0.1.0/tests/test_known_point_sets_hypothesis.py +49 -0
  78. algroots-0.1.0/tests/test_metamorphic_invariance_hypothesis.py +145 -0
  79. algroots-0.1.0/tests/test_mixed_precision_conditioning.py +33 -0
  80. algroots-0.1.0/tests/test_monodromy_algebraic_systems.py +189 -0
  81. algroots-0.1.0/tests/test_monodromy_core_differential.py +46 -0
  82. algroots-0.1.0/tests/test_monodromy_loop.py +100 -0
  83. algroots-0.1.0/tests/test_monodromy_metadata_hypothesis.py +65 -0
  84. algroots-0.1.0/tests/test_monodromy_orbits.py +304 -0
  85. algroots-0.1.0/tests/test_monodromy_recognition_end_to_end.py +84 -0
  86. algroots-0.1.0/tests/test_monodromy_stopping.py +91 -0
  87. algroots-0.1.0/tests/test_multiplicity_and_singular_roots.py +46 -0
  88. algroots-0.1.0/tests/test_newton_refinement_adversarial.py +41 -0
  89. algroots-0.1.0/tests/test_numerical_pipeline.py +80 -0
  90. algroots-0.1.0/tests/test_path_tracking.py +364 -0
  91. algroots-0.1.0/tests/test_public_api.py +58 -0
  92. algroots-0.1.0/tests/test_rational_univariate.py +89 -0
  93. algroots-0.1.0/tests/test_recognition.py +424 -0
  94. algroots-0.1.0/tests/test_representation_invariance.py +41 -0
  95. algroots-0.1.0/tests/test_rur_backend.py +147 -0
  96. algroots-0.1.0/tests/test_separator_retry_and_completeness.py +60 -0
  97. algroots-0.1.0/tests/test_shape_position.py +92 -0
  98. algroots-0.1.0/tests/test_structural_performance_guards.py +77 -0
  99. algroots-0.1.0/tests/test_total_degree_homotopy.py +296 -0
  100. algroots-0.1.0/tests/test_triangular_and_validation.py +49 -0
  101. algroots-0.1.0/tests/test_validation_refinement.py +111 -0
  102. algroots-0.1.0/tools/release_artifact_smoke.py +90 -0
@@ -0,0 +1,25 @@
1
+ name: Benchmarks
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ benchmark:
8
+ runs-on: ubuntu-latest
9
+ env:
10
+ ALGROOTS_REQUIRE_FLINT: "1"
11
+ steps:
12
+ - uses: actions/checkout@v6
13
+ - uses: actions/setup-python@v6
14
+ with:
15
+ python-version: "3.12"
16
+ - name: Install benchmark dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ python -m pip install -e ".[benchmark]"
20
+ - name: Run benchmark suite
21
+ run: python -m pytest benchmarks --benchmark-only --benchmark-json=benchmark.json
22
+ - uses: actions/upload-artifact@v4
23
+ with:
24
+ name: algroots-benchmark
25
+ path: benchmark.json
@@ -0,0 +1,38 @@
1
+ name: Mutation testing
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "17 5 * * 1"
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ targeted-mutation:
10
+ name: Targeted non-blocking mutation audit
11
+ runs-on: ubuntu-latest
12
+ continue-on-error: true
13
+ env:
14
+ ALGROOTS_REQUIRE_FLINT: "1"
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - uses: actions/setup-python@v6
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Install package and mutation tools
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ python -m pip install -e ".[test,mutation]"
24
+ - name: Mutate recognition
25
+ run: mutmut run "algroots.recognition*"
26
+ continue-on-error: true
27
+ - name: Mutate monodromy stopping
28
+ run: mutmut run "algroots.monodromy_stopping*"
29
+ continue-on-error: true
30
+ - name: Mutate monodromy
31
+ run: mutmut run "algroots.monodromy*"
32
+ continue-on-error: true
33
+ - name: Mutate continuation
34
+ run: mutmut run "algroots.continuation*"
35
+ continue-on-error: true
36
+ - name: Show surviving mutants
37
+ if: always()
38
+ run: mutmut results || true
@@ -0,0 +1,275 @@
1
+ name: Test, Build, and Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - "v*"
9
+ pull_request:
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ test:
17
+ name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
18
+ runs-on: ${{ matrix.os }}
19
+
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ os:
24
+ - ubuntu-latest
25
+ - macos-latest
26
+ - windows-latest
27
+ python-version:
28
+ - "3.11"
29
+ - "3.12"
30
+ - "3.13"
31
+ - "3.14"
32
+ exclude:
33
+ # Keep macOS/Windows coverage useful without multiplying CI cost
34
+ # unnecessarily. Linux still exercises every supported Python.
35
+ - os: macos-latest
36
+ python-version: "3.11"
37
+ - os: macos-latest
38
+ python-version: "3.12"
39
+ - os: macos-latest
40
+ python-version: "3.13"
41
+ - os: windows-latest
42
+ python-version: "3.11"
43
+ - os: windows-latest
44
+ python-version: "3.12"
45
+ - os: windows-latest
46
+ python-version: "3.13"
47
+
48
+ steps:
49
+ - name: Check out repository
50
+ uses: actions/checkout@v6
51
+ with:
52
+ persist-credentials: false
53
+
54
+ - name: Set up Python
55
+ uses: actions/setup-python@v6
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+ cache: pip
59
+
60
+ - name: Upgrade packaging tools
61
+ run: python -m pip install --upgrade pip
62
+
63
+ - name: Install package and test dependencies
64
+ run: python -m pip install -e ".[test]"
65
+
66
+ - name: Run test suite
67
+ run: python -m pytest -ra
68
+
69
+ quality:
70
+ name: Lint, format, coverage, and docs
71
+ runs-on: ubuntu-latest
72
+
73
+ steps:
74
+ - name: Check out repository
75
+ uses: actions/checkout@v6
76
+ with:
77
+ persist-credentials: false
78
+
79
+ - name: Set up Python
80
+ uses: actions/setup-python@v6
81
+ with:
82
+ python-version: "3.13"
83
+ cache: pip
84
+
85
+ - name: Upgrade packaging tools
86
+ run: python -m pip install --upgrade pip
87
+
88
+ - name: Install development dependencies
89
+ run: python -m pip install -e ".[test,dev]"
90
+
91
+ - name: Ruff lint
92
+ run: ruff check .
93
+
94
+ - name: Ruff formatting
95
+ run: ruff format --check .
96
+
97
+ - name: Compile Python sources
98
+ run: python -m compileall -q src tests tools
99
+
100
+ - name: Run tests with branch coverage
101
+ run: >
102
+ python -m pytest
103
+ --cov=algroots
104
+ --cov-branch
105
+ --cov-report=term-missing
106
+ --cov-report=xml
107
+ --cov-fail-under=80
108
+
109
+ build:
110
+ name: Build and validate distributions
111
+ runs-on: ubuntu-latest
112
+ needs:
113
+ - test
114
+ - quality
115
+
116
+ steps:
117
+ - name: Check out repository
118
+ uses: actions/checkout@v6
119
+ with:
120
+ persist-credentials: false
121
+
122
+ - name: Set up Python
123
+ uses: actions/setup-python@v6
124
+ with:
125
+ python-version: "3.13"
126
+ cache: pip
127
+
128
+ - name: Install build tools
129
+ run: >
130
+ python -m pip install
131
+ --upgrade
132
+ build
133
+ twine
134
+
135
+ - name: Build wheel and sdist
136
+ run: python -m build
137
+
138
+ - name: Check package metadata
139
+ run: python -m twine check --strict dist/*
140
+
141
+ - name: Show distribution contents
142
+ shell: bash
143
+ run: |
144
+ python - <<'PY'
145
+ from pathlib import Path
146
+ import tarfile
147
+ import zipfile
148
+
149
+ for path in sorted(Path("dist").iterdir()):
150
+ print(f"\n=== {path.name} ===")
151
+
152
+ if path.suffix == ".whl":
153
+ with zipfile.ZipFile(path) as archive:
154
+ for name in archive.namelist():
155
+ print(name)
156
+
157
+ elif path.name.endswith(".tar.gz"):
158
+ with tarfile.open(path, "r:gz") as archive:
159
+ for member in archive.getnames():
160
+ print(member)
161
+ PY
162
+
163
+ - name: Reject generated/cache files in distributions
164
+ shell: bash
165
+ run: |
166
+ python - <<'PY'
167
+ from pathlib import Path
168
+ import tarfile
169
+ import zipfile
170
+
171
+ forbidden = (
172
+ "__pycache__/",
173
+ ".pytest_cache/",
174
+ ".coverage",
175
+ ".pyc",
176
+ )
177
+
178
+ failures = []
179
+
180
+ for path in Path("dist").iterdir():
181
+ if path.suffix == ".whl":
182
+ with zipfile.ZipFile(path) as archive:
183
+ names = archive.namelist()
184
+ elif path.name.endswith(".tar.gz"):
185
+ with tarfile.open(path, "r:gz") as archive:
186
+ names = archive.getnames()
187
+ else:
188
+ continue
189
+
190
+ for name in names:
191
+ if any(part in name for part in forbidden):
192
+ failures.append(f"{path.name}: {name}")
193
+
194
+ if failures:
195
+ raise SystemExit(
196
+ "Generated/cache files found in distributions:\n"
197
+ + "\n".join(failures)
198
+ )
199
+ PY
200
+
201
+ - name: Test installed wheel
202
+ shell: bash
203
+ run: |
204
+ python -m venv .venv-wheel
205
+ . .venv-wheel/bin/activate
206
+ python -m pip install --upgrade pip
207
+ python -m pip install dist/*.whl
208
+ python tools/release_artifact_smoke.py
209
+
210
+ - name: Test installed sdist
211
+ shell: bash
212
+ run: |
213
+ python -m venv .venv-sdist
214
+ . .venv-sdist/bin/activate
215
+ python -m pip install --upgrade pip
216
+ python -m pip install dist/*.tar.gz
217
+ python tools/release_artifact_smoke.py
218
+
219
+ - name: Upload distributions
220
+ uses: actions/upload-artifact@v5
221
+ with:
222
+ name: python-package-distributions
223
+ path: dist/
224
+ if-no-files-found: error
225
+ retention-days: 14
226
+
227
+ publish-testpypi:
228
+ name: Publish to TestPyPI
229
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
230
+ needs:
231
+ - build
232
+ runs-on: ubuntu-latest
233
+
234
+ environment:
235
+ name: testpypi
236
+ url: https://test.pypi.org/p/algroots
237
+
238
+ permissions:
239
+ id-token: write
240
+
241
+ steps:
242
+ - name: Download distributions
243
+ uses: actions/download-artifact@v6
244
+ with:
245
+ name: python-package-distributions
246
+ path: dist/
247
+
248
+ - name: Publish to TestPyPI
249
+ uses: pypa/gh-action-pypi-publish@release/v1
250
+ with:
251
+ repository-url: https://test.pypi.org/legacy/
252
+
253
+ publish-pypi:
254
+ name: Publish to PyPI
255
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
256
+ needs:
257
+ - build
258
+ runs-on: ubuntu-latest
259
+
260
+ environment:
261
+ name: pypi
262
+ url: https://pypi.org/p/algroots
263
+
264
+ permissions:
265
+ id-token: write
266
+
267
+ steps:
268
+ - name: Download distributions
269
+ uses: actions/download-artifact@v6
270
+ with:
271
+ name: python-package-distributions
272
+ path: dist/
273
+
274
+ - name: Publish to PyPI
275
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,30 @@
1
+ # Python bytecode and caches
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .pytest_cache/
6
+ .hypothesis/
7
+ .ruff_cache/
8
+ .mypy_cache/
9
+
10
+ # Coverage
11
+ .coverage
12
+ .coverage.*
13
+ htmlcov/
14
+ coverage.xml
15
+
16
+ # Build and packaging
17
+ build/
18
+ dist/
19
+ *.egg-info/
20
+ .eggs/
21
+
22
+ # Virtual environments
23
+ .venv/
24
+ venv/
25
+ env/
26
+
27
+ # Editors / OS
28
+ .DS_Store
29
+ .idea/
30
+ .vscode/
@@ -0,0 +1,10 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use algroots in research, please cite the software."
3
+ title: "algroots"
4
+ type: software
5
+ authors:
6
+ - family-names: "Bhatt"
7
+ given-names: "Bhuvanesh"
8
+ version: "0.1.0"
9
+ license: "GPL-3.0-only"
10
+ url: "https://pypi.org/project/algroots/"
@@ -0,0 +1,55 @@
1
+ # Contributing to algroots
2
+
3
+ Contributions welcome, especially reproducible bugs, difficult algebraic systems, numerical-conditioning regressions, documentation corrections, and tests that expose backend disagreement.
4
+
5
+ ## Development setup
6
+
7
+ Use Python 3.11 or newer and install the package with its test and development dependencies:
8
+
9
+ ```bash
10
+ python -m pip install -e ".[test,dev]"
11
+ ```
12
+
13
+ Run the full test suite with:
14
+
15
+ ```bash
16
+ python -m pytest
17
+ ```
18
+
19
+ Run the release-quality static checks with:
20
+
21
+ ```bash
22
+ python -m ruff check .
23
+ python -m ruff format --check .
24
+ ```
25
+
26
+ Coverage can be inspected with:
27
+
28
+ ```bash
29
+ python -m pytest --cov=algroots --cov-branch --cov-report=term-missing
30
+ ```
31
+
32
+ ## Tests
33
+
34
+ Every bugfix should include a focused regression test. New public behavior should include tests for normal inputs, boundary cases, invalid inputs, and interactions with relevant alternative backends. For mathematically equivalent representations, prefer differential or metamorphic tests that compare the resulting root sets rather than relying only on one hand-written expected ordering.
35
+
36
+ The order in which roots are returned is not guaranteed. Tests should compare root sets with a precision-appropriate tolerance unless exact ordering is itself the behavior under test.
37
+
38
+ ## Documentation
39
+
40
+ Public API changes must be reflected in `docs/api.md`. New capabilities or limitations should update `docs/feature-support-matrix.md` and, where appropriate, `docs/limitations.md`. Executable examples in the README and selected documentation pages are exercised by the test suite.
41
+
42
+ ## Pull requests
43
+
44
+ Before submitting a pull request, run the full tests, do Ruff linting/ formatting checks, and the coverage command above. Keep changes focused and explain any new mathematical assumptions or guarantee boundaries explicitly.
45
+
46
+ ## Benchmarks
47
+
48
+ Performance checks are intentionally opt-in so routine test CI is not tied to noisy wall-clock thresholds:
49
+
50
+ ```bash
51
+ python -m pip install -e ".[benchmark]"
52
+ python -m pytest benchmarks --benchmark-only
53
+ ```
54
+
55
+ Use `pytest-benchmark` JSON output or saved baselines when evaluating structural changes to numerical hot paths.