helmer-strat 1.0.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 (55) hide show
  1. helmer_strat-1.0.0/.github/workflows/ci.yml +24 -0
  2. helmer_strat-1.0.0/.github/workflows/release.yml +49 -0
  3. helmer_strat-1.0.0/.github/workflows/wheels.yml +46 -0
  4. helmer_strat-1.0.0/.gitignore +7 -0
  5. helmer_strat-1.0.0/.zenodo.json +8 -0
  6. helmer_strat-1.0.0/CHANGELOG.md +20 -0
  7. helmer_strat-1.0.0/CITATION.cff +43 -0
  8. helmer_strat-1.0.0/CMakeLists.txt +50 -0
  9. helmer_strat-1.0.0/LICENSE +674 -0
  10. helmer_strat-1.0.0/PKG-INFO +324 -0
  11. helmer_strat-1.0.0/README.md +305 -0
  12. helmer_strat-1.0.0/RELEASING.md +30 -0
  13. helmer_strat-1.0.0/bench/certify_bench.py +36 -0
  14. helmer_strat-1.0.0/bench/compare.py +52 -0
  15. helmer_strat-1.0.0/bench/examples.py +21 -0
  16. helmer_strat-1.0.0/bench/m2_HM_X1_HM_X2.json +86 -0
  17. helmer_strat-1.0.0/bench/m2_HM_ex1.1.json +50 -0
  18. helmer_strat-1.0.0/bench/m2_cayley_P_kummer_like_swallowtail_disc_two_cones_space_curve_plane_line_D4_P_cross_cap_2.json +222 -0
  19. helmer_strat-1.0.0/bench/m2_umbrella_cusp_fig2_xyz_twisted_ws_umbrella_P_quartic_P.json +316 -0
  20. helmer_strat-1.0.0/bench/mp_battery.py +30 -0
  21. helmer_strat-1.0.0/bench/polar_bench.py +27 -0
  22. helmer_strat-1.0.0/bench/run_helmer.py +17 -0
  23. helmer_strat-1.0.0/bench/run_m2.py +29 -0
  24. helmer_strat-1.0.0/docs/API.md +93 -0
  25. helmer_strat-1.0.0/examples/01_first_stratification.py +40 -0
  26. helmer_strat-1.0.0/examples/02_maps.py +24 -0
  27. helmer_strat-1.0.0/examples/03_algebra.py +31 -0
  28. helmer_strat-1.0.0/examples/04_certified.py +27 -0
  29. helmer_strat-1.0.0/examples/05_linkages.py +33 -0
  30. helmer_strat-1.0.0/examples/06_conormal_or_polar.py +22 -0
  31. helmer_strat-1.0.0/examples/cpp/stratify.cpp +33 -0
  32. helmer_strat-1.0.0/examples/run_all.sh +13 -0
  33. helmer_strat-1.0.0/include/helmer/certify.hpp +69 -0
  34. helmer_strat-1.0.0/include/helmer/gb.hpp +40 -0
  35. helmer_strat-1.0.0/include/helmer/ideal.hpp +84 -0
  36. helmer_strat-1.0.0/include/helmer/poly.hpp +112 -0
  37. helmer_strat-1.0.0/include/helmer/primes.hpp +32 -0
  38. helmer_strat-1.0.0/include/helmer/whitney.hpp +73 -0
  39. helmer_strat-1.0.0/pyproject.toml +34 -0
  40. helmer_strat-1.0.0/python/helmer/__init__.py +15 -0
  41. helmer_strat-1.0.0/python/helmer/__main__.py +75 -0
  42. helmer_strat-1.0.0/src/certify.cpp +408 -0
  43. helmer_strat-1.0.0/src/gb.cpp +358 -0
  44. helmer_strat-1.0.0/src/ideal.cpp +428 -0
  45. helmer_strat-1.0.0/src/poly.cpp +263 -0
  46. helmer_strat-1.0.0/src/primes.cpp +266 -0
  47. helmer_strat-1.0.0/src/python_bindings.cpp +264 -0
  48. helmer_strat-1.0.0/src/whitney.cpp +690 -0
  49. helmer_strat-1.0.0/tests/m2_whitney_fixtures.json +565 -0
  50. helmer_strat-1.0.0/tests/t_gb.cpp +13 -0
  51. helmer_strat-1.0.0/tests/t_primes.cpp +16 -0
  52. helmer_strat-1.0.0/tests/test_certify.py +125 -0
  53. helmer_strat-1.0.0/tests/test_helmer.py +222 -0
  54. helmer_strat-1.0.0/tools/build_wheel_deps.sh +60 -0
  55. helmer_strat-1.0.0/web/index.html +208 -0
@@ -0,0 +1,24 @@
1
+ # Build and test on every push and pull request.
2
+ name: ci
3
+ on: [push, pull_request]
4
+ jobs:
5
+ ubuntu:
6
+ runs-on: ubuntu-24.04
7
+ steps:
8
+ - uses: actions/checkout@v4
9
+ - uses: actions/setup-python@v5
10
+ with: { python-version: "3.12" }
11
+ - name: Dependencies (FLINT, msolve)
12
+ run: sudo apt-get update && sudo apt-get install -y libflint-dev libmsolve-dev
13
+ - name: Build and install
14
+ run: python -m pip install scikit-build-core pybind11 pytest && python -m pip install --no-build-isolation .
15
+ - name: Tests
16
+ run: python -m pytest -q tests/
17
+ - name: Examples and the command line
18
+ run: sh examples/run_all.sh
19
+ - name: C++ library, test drivers and example
20
+ run: |
21
+ cmake -S . -B build -DHELMER_PYTHON=OFF -DHELMER_TESTS=ON -DHELMER_EXAMPLES=ON
22
+ cmake --build build -j2
23
+ ./build/stratify "x,y,z" "y^2*z - x^2" | grep -q "dim 0"
24
+ ./build/t_primes "x,y,z" "x*y*z" "x+y+z" | grep -q "3 primes"
@@ -0,0 +1,49 @@
1
+ # On a version tag (e.g. v1.0.0): build the binary wheels (wheels.yml) and the source distribution, test
2
+ # them, attach them to a GitHub release and publish them to PyPI (trusted publishing; see RELEASING.md).
3
+ name: release
4
+ on:
5
+ push:
6
+ tags: ["v*"]
7
+ permissions:
8
+ contents: write
9
+ jobs:
10
+ wheels:
11
+ uses: ./.github/workflows/wheels.yml
12
+ sdist:
13
+ runs-on: ubuntu-24.04
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - name: The tag names the version being built
17
+ run: |
18
+ v=$(sed -n 's/^version = "\(.*\)".*/\1/p' pyproject.toml)
19
+ p=$(sed -n 's/^__version__ = "\(.*\)".*/\1/p' python/helmer/__init__.py)
20
+ echo "tag $GITHUB_REF_NAME, pyproject.toml $v, __init__.py $p"
21
+ test "$GITHUB_REF_NAME" = "v$v" && test "$p" = "$v"
22
+ - uses: actions/setup-python@v5
23
+ with: { python-version: "3.12" }
24
+ - run: sudo apt-get update && sudo apt-get install -y libflint-dev libmsolve-dev
25
+ - name: Build the sdist
26
+ run: python -m pip install build && python -m build --sdist
27
+ - name: Install the sdist and test it
28
+ run: |
29
+ python -m pip install pytest dist/*.tar.gz
30
+ cd /tmp && python -m pytest -q $GITHUB_WORKSPACE/tests/ && helmer "y^2*z - x^2"
31
+ - uses: actions/upload-artifact@v4
32
+ with: { name: sdist, path: dist/*.tar.gz }
33
+ github-release:
34
+ needs: [sdist, wheels]
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - uses: actions/download-artifact@v4
38
+ with: { path: dist, merge-multiple: true }
39
+ - uses: softprops/action-gh-release@v2
40
+ with: { files: "dist/*" }
41
+ pypi:
42
+ needs: [sdist, wheels]
43
+ runs-on: ubuntu-latest
44
+ environment: pypi
45
+ permissions: { id-token: write }
46
+ steps:
47
+ - uses: actions/download-artifact@v4
48
+ with: { path: dist, merge-multiple: true }
49
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,46 @@
1
+ # Binary wheels: Linux (manylinux_2_28, x86-64) and macOS (Apple silicon, Intel), CPython 3.9-3.13.
2
+ # GMP and MPFR (Linux), FLINT and msolve are built from source (tools/build_wheel_deps.sh) and bundled into each wheel by
3
+ # auditwheel / delocate, so `pip install helmer-strat` needs nothing else. Each wheel is installed in a
4
+ # clean environment and runs the test suite.
5
+ # Runs on pushes to the `wheels` branch, by hand, and from release.yml (workflow_call).
6
+ name: wheels
7
+ on:
8
+ push:
9
+ branches: [wheels]
10
+ workflow_dispatch:
11
+ workflow_call:
12
+ inputs:
13
+ ref: { type: string, required: false, default: "" }
14
+ jobs:
15
+ wheels:
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, macos-15, macos-15-intel]
20
+ runs-on: ${{ matrix.os }}
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with: { ref: "${{ inputs.ref }}" }
24
+ - name: macOS dependencies (GMP and MPFR from Homebrew; FLINT and msolve from source)
25
+ if: runner.os == 'macOS'
26
+ run: |
27
+ brew install gmp mpfr autoconf automake libtool
28
+ # Homebrew's libraries are built for the runner's macOS, so everything else, wheels included, targets it too.
29
+ export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d. -f1).0
30
+ echo "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET" >> "$GITHUB_ENV"
31
+ echo "CMAKE_PREFIX_PATH=$(brew --prefix)" >> "$GITHUB_ENV"
32
+ PREFIX="$(brew --prefix)" MSOLVE_CONFIGURE_EXTRA=--disable-openmp sh tools/build_wheel_deps.sh
33
+ - uses: pypa/cibuildwheel@v2.21
34
+ env:
35
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
36
+ CIBW_SKIP: "*musllinux* *i686*"
37
+ CIBW_ARCHS_LINUX: x86_64
38
+ CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
39
+ CIBW_BEFORE_ALL_LINUX: >-
40
+ dnf install -y autoconf automake libtool git xz m4 &&
41
+ BUILD_GMP=1 sh tools/build_wheel_deps.sh
42
+ CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
43
+ CIBW_TEST_REQUIRES: pytest
44
+ CIBW_TEST_COMMAND: python -m pytest -q {project}/tests && helmer "y^2*z - x^2"
45
+ - uses: actions/upload-artifact@v4
46
+ with: { name: "wheels-${{ matrix.os }}", path: wheelhouse/*.whl }
@@ -0,0 +1,7 @@
1
+ build/
2
+ _skbuild/
3
+ dist/
4
+ *.so
5
+ *.egg-info/
6
+ __pycache__/
7
+ .pytest_cache/
@@ -0,0 +1,8 @@
1
+ {
2
+ "title": "Helmer: Whitney stratifications of algebraic varieties and maps",
3
+ "upload_type": "software",
4
+ "creators": [{"name": "Nanda, Vidit", "affiliation": "University of Oxford"}],
5
+ "license": "GPL-3.0-or-later",
6
+ "description": "A C++ library with Python bindings for Whitney stratifications of complex and real algebraic varieties and of polynomial maps, reimplementing Martin Helmer's Macaulay2 package WhitneyStratifications and named in his memory.",
7
+ "keywords": ["Whitney stratification", "conormal variety", "algebraic geometry", "singularities", "Groebner bases"]
8
+ }
@@ -0,0 +1,20 @@
1
+ # Changes
2
+
3
+ ## 1.0.0 (2026-11-25)
4
+
5
+ First release.
6
+
7
+ * `whitney_stratify` (conormal and polar routes), `map_stratify`, `non_proper_set`, `conormal`,
8
+ `polar_varieties`: the Whitney-stratification functions of Martin Helmer's Macaulay2 package
9
+ `WhitneyStratifications` 2.23 (with `AssocPrimes=>false`), checked against it on its documentation
10
+ examples and the benchmarks of Helmer–Mohr.
11
+ * The algebra they rest on, without Macaulay2: Gröbner bases over ℚ (msolve's F4, multi-modular), dimension,
12
+ elimination, saturation, intersection, and minimal primes certified prime.
13
+ * Speed: hyperplane charts and single-minor saturation for conormal varieties, squarefree saturation, the
14
+ reduced variety for singular loci, free translation directions split off before stratifying. On the
15
+ Helmer–Mohr benchmarks, 38× to 5000× faster than the Macaulay2 package.
16
+ * Certified ideal membership and elimination (`certify_membership`, `verify_membership`,
17
+ `eliminate_certified`): cofactor identities checked exactly over ℚ.
18
+ * The `helmer` command, a C++ example, six Python examples, and `docs/API.md`.
19
+ * Binary wheels for Linux (x86-64) and macOS (arm64, x86-64), CPython 3.9–3.13, with GMP, MPFR, FLINT and
20
+ msolve bundled and built without CPU-specific instructions.
@@ -0,0 +1,43 @@
1
+ cff-version: 1.2.0
2
+ message: "If Helmer helps your research, please cite the software as below, and the papers behind its algorithms."
3
+ title: "Helmer: Whitney stratifications of algebraic varieties and maps"
4
+ version: 1.0.0
5
+ doi: 10.5281/zenodo.24531435
6
+ date-released: 2026-11-25
7
+ license: GPL-3.0-or-later
8
+ authors:
9
+ - family-names: Nanda
10
+ given-names: Vidit
11
+ repository-code: "https://github.com/viditnanda/Helmer"
12
+ url: "https://people.maths.ox.ac.uk/nanda/helmer/"
13
+ keywords: ["Whitney stratification", "conormal variety", "algebraic geometry", "singularities"]
14
+ references:
15
+ - type: article
16
+ title: "Conormal spaces and Whitney stratifications"
17
+ authors:
18
+ - family-names: Helmer
19
+ given-names: Martin
20
+ - family-names: Nanda
21
+ given-names: Vidit
22
+ journal: "Foundations of Computational Mathematics"
23
+ year: 2022
24
+ - type: article
25
+ title: "Effective Whitney stratification of real algebraic varieties"
26
+ authors:
27
+ - family-names: Helmer
28
+ given-names: Martin
29
+ - family-names: Leykin
30
+ given-names: Anton
31
+ - family-names: Nanda
32
+ given-names: Vidit
33
+ journal: "Mathematics of Computation"
34
+ year: 2025
35
+ - type: article
36
+ title: "Faster computation of Whitney stratifications and their minimization"
37
+ authors:
38
+ - family-names: Helmer
39
+ given-names: Martin
40
+ - family-names: Mohr
41
+ given-names: Rafael
42
+ notes: "arXiv:2406.17122"
43
+ year: 2024
@@ -0,0 +1,50 @@
1
+ cmake_minimum_required(VERSION 3.18)
2
+ project(helmer LANGUAGES C CXX)
3
+
4
+ set(CMAKE_CXX_STANDARD 20)
5
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
6
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7
+ if(NOT CMAKE_BUILD_TYPE)
8
+ set(CMAKE_BUILD_TYPE Release)
9
+ endif()
10
+
11
+ # Dependencies: FLINT (>= 3.0), GMP, msolve's libneogb (>= 0.6).
12
+ find_library(FLINT_LIB flint REQUIRED)
13
+ find_library(GMP_LIB gmp REQUIRED)
14
+ find_library(NEOGB_LIB neogb REQUIRED)
15
+ find_path(FLINT_INCLUDE_DIR flint/flint.h REQUIRED) # outside the compiler's default paths on Homebrew
16
+ find_path(GMP_INCLUDE_DIR gmp.h REQUIRED)
17
+ find_package(OpenMP)
18
+
19
+ add_library(helmer_core STATIC
20
+ src/poly.cpp src/gb.cpp src/ideal.cpp src/primes.cpp src/whitney.cpp src/certify.cpp)
21
+ target_include_directories(helmer_core PUBLIC include ${FLINT_INCLUDE_DIR} ${GMP_INCLUDE_DIR})
22
+ target_link_libraries(helmer_core PUBLIC ${NEOGB_LIB} ${FLINT_LIB} ${GMP_LIB} m)
23
+ if(OpenMP_C_FOUND)
24
+ target_link_libraries(helmer_core PUBLIC OpenMP::OpenMP_C)
25
+ endif()
26
+
27
+ option(HELMER_PYTHON "Build the Python extension" ON)
28
+ if(HELMER_PYTHON)
29
+ find_package(Python 3.9 COMPONENTS Interpreter Development.Module REQUIRED)
30
+ execute_process(COMMAND ${Python_EXECUTABLE} -m pybind11 --cmakedir
31
+ OUTPUT_VARIABLE pybind11_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
32
+ find_package(pybind11 CONFIG REQUIRED)
33
+ pybind11_add_module(_helmer src/python_bindings.cpp)
34
+ target_link_libraries(_helmer PRIVATE helmer_core)
35
+ install(TARGETS _helmer DESTINATION helmer)
36
+ endif()
37
+
38
+ option(HELMER_TESTS "Build C++ test drivers" ON)
39
+ if(HELMER_TESTS)
40
+ foreach(t t_gb t_primes)
41
+ add_executable(${t} tests/${t}.cpp)
42
+ target_link_libraries(${t} PRIVATE helmer_core)
43
+ endforeach()
44
+ endif()
45
+
46
+ option(HELMER_EXAMPLES "Build the C++ example (examples/cpp)" OFF)
47
+ if(HELMER_EXAMPLES)
48
+ add_executable(stratify examples/cpp/stratify.cpp)
49
+ target_link_libraries(stratify PRIVATE helmer_core)
50
+ endif()