FLINT rational kernel: fast exact core for rational generating functions below the Distribution logic
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- performance
Research direction
This is a design proposal: the first PR is a new RationalGF kernel module wrapping python-flint polynomials over ℚ, with add/multiply/substitute/cancel/coefficient-extraction and SymPy conversion. Start by reading the Distribution logic and the engine code paths it hooks into, then look at the benchmark set in #348 and the conformance suite in #361, which the kernel must pass. Done means the kernel module, its unit and property tests, and a benchmark comparison against the three engines, with the continue/stop decision recorded.
Written by the indexing model from the issue text.
Description
Use python-flint (bindings of FLINT, LGPL, wheels for Linux/macOS/Windows, CPython 3.11–3.14, typed) as a shared rational kernel below the Distribution logic, not as a fourth engine. SymPy stays the general engine (parser, printing, exp/log/sqrt, algebraic results); the kernel takes over the hot paths for rational generating functions.
Why
- The slow parts today are polynomial arithmetic: normalising after every operation (#404), cancellation (#366), the benchmark times in #348. FLINT does multivariate polynomial arithmetic, GCD and factorisation over ℤ/ℚ in C (
fmpz_mpoly,fmpq_mpoly). - Arb/acb ball arithmetic is part of FLINT 3: rigorous root bounds for the convergence proofs (#393, #398), dominant-root checks and the outward-rounded intervals of the streaming view (#406).
- Long run: with SymEngine deprecated (#416), the kernel is the remaining fast path for SymPy, and if it is fast enough, GiNaC becomes optional — which would retire the bindings repository and its wheels.
Weaknesses to design around
- No expression CAS:
exp,log,sqrtstay in SymPy. Structured forms (exp_polynomial,log_polynomial: rational · exp(polynomial)) could later be pairs of kernel objects. - Power series only in one variable (
fmpq_series); multivariate truncation is done on polynomials. - To check: whether python-flint exposes
fmpz_mpoly_q(multivariate rational functions; FLINT has it). Otherwise store numerator and denominator and cancel by GCD. - Parameters become ring variables; non-polynomial parameter expressions fall back to SymPy.
- Conversions SymPy ↔ kernel are a new error source: the conformance suite (#361) must run on the kernel.
Steps (one PR each)
- Kernel module and measurement (first PR, kept, not a throwaway spike):
RationalGFas a pair of FLINT polynomials over ℚ with multiplication, addition, substitution, cancellation, coefficient extraction (linear recurrence) and conversion to/from SymPy; unit and property tests; benchmark against the three engines on the #348 set (unrolling, cancellation, 100 coefficients). Decision point: continue only if the gain is clear. - Use the kernel in the SymPy engine for rational GFs, operation by operation (case analysis stays in
Distribution, the kernel is a hook), each PR behaviour-preserving and covered by #361. - Arb-based root bounds for the convergence and positivity checks.
- Re-evaluate GiNaC.
Related: #348, #361, #404, #416. Watch SymPy's own plan of FLINT-based multivariate PolyRing, which may give part of the gain for free.
- Dominant language
- Python
- Stars
- 6
- Forks
- 2
- Avg merge
- 1h 52m
- Merged PRs (30d)
- 187
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from LKlinke/Prodigy
-
area: engines bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: gui bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: gui bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
area: engines bug priority: medium
Maintainers usually reply within 1 day
-
area: maintenance priority: low
Maintainers usually reply within 1 day
Similar issues
-
docs(contributing): the two things that silently block a PRPossibly taken A pull request linked to this issue is open or already merged. Openavailable documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Nixitov/Riptide-Native#944 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
JTHCode/secretguard#24 ·
Maintainers usually reply within 1 day
-
area: middleware documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainers usually reply within 1 day