Removing the assprime.{cpp,hpp} file in the Macaulay2 engine
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
Mike made the comment of wanting to remove `assprime` because it had been replaced by newer/faster algorithms. I had Codex assist in finding the dependencies and usage across M2 and the engine, and it seems that (currently) it _is not immediately easy to remove_ and requires us to go in and update some algorithms with newer code. Codex response below.
-----
I traced `computations/assprime`. It is **not safely removable as-is**.
The important finding: despite the name, it is not the main modern `associatedPrimes` package machinery. Its live job is powering **maximal independent sets** for monomial ideals.
Direct dependencies:
- `assprime.hpp` defines `AssociatedPrimes`.
- `assprime.cpp` implements `AssociatedPrimes::associated_primes`.
- `interface/monomial-ideal.cpp` uses it in `rawMaximalIndependentSets`.
- `d/interface.dd` exports that raw function.
- `m2/monideal.m2` exposes it as:
```m2
independentSets MonomialIdeal := ... rawMaximalIndependentSets(...)
```
That `independentSets` method is used in real package code, notably `PrimaryDecomposition`, `MinimalPrimes`, `NoetherNormalization`, `QuillenSuslin`, and `WhitneyStratifications`.
There is also a second engine use in `matrices/matrix.cpp`, inside `Matrix::dimension1()`. That one looks dormant: I found the method definition and a header declaration, but no actual caller/binding.
The “newer/faster elsewhere” part seems to refer to `monomial/monideal-minprimes.cpp`, where `MinimalPrimes` now handles monomial codimension/minimal-prime paths. But it does **not** currently replace `rawMaximalIndependentSets`; `max_indep_sets` is declared in the header but not implemented in the `.cpp`.
So the removal path would be: first replace `rawMaximalIndependentSets` with a newer implementation, then remove/replace the dormant `Matrix::dimension1()` dependency, then drop `assprime` from `CMakeLists.txt` and `Makefile.files.in`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with computations/assprime.hpp and computations/assprime.cpp, then trace interface/monomial-ideal.cpp, d/interface.dd, m2/monideal.m2, and matrices/matrix.cpp. Identify replacements for rawMaximalIndependentSets and Matrix::dimension1(), verify affected package paths, then remove assprime from CMakeLists.txt and Makefile.files.in once the relevant tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- backend, build-system
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100