Skip to content

feat: add outward-rounded interval division and solve enclosures - #315

Merged
acgetchell merged 1 commit into
mainfrom
feat/307-interval-solve
Oct 27, 2026
Merged

acgetchell merged 1 commit into
mainfrom
feat/307-interval-solve

Conversation

@acgetchell

@acgetchell acgetchell commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Consumers assembling interval systems currently need their own reciprocal bounds and linear solver. This adds Interval::try_recip, Interval::try_div, and IntervalMatrix<D>::solve to the default-feature API.

Successful solves enclose the exact-real solution for every matrix and RHS admitted by the input intervals, and certify nonsingularity for every admitted matrix. Zero-containing divisors, inconclusive pivots, and finite-range exhaustion have distinct typed outcomes. Inconclusive elimination never claims singularity; consumers retain their robust fallback.

  • Direct quotient bounds use an exact integer comparison, preserving outward rounding through subnormal results without requiring a representable reciprocal intermediate.
  • Const, allocation-free Gaussian elimination chooses row pivots by separation from zero and propagates interval bounds through back substitution. The documentation states uncertainty, conditioning, dimension, and fallback contracts.
  • Independent rational oracles cover scalar extremes, uncertain systems, and D=1–6 circumsphere equations. Diagnostic benchmarks cover division and five 32-system solve corpora at D=1–6; the retained release acquisition catalog is unchanged.
  • Includes the staged rustix 1.1.6, uv 0.13.6, and cargo-nextest 0.9.150 updates.

Validation:

  • Implementation just check and full just ci passed: 1,113 Rust tests, 281 Python tests, default/exact doctests, documentation, static checks, benchmark compilation, and examples.
  • Refreshed just lint-config cargo-lock-check tools-check and just test-rust-ci on the final dependency/tool configuration; all 1,113 Rust tests passed.
  • Diagnostic benchmark measurements completed during implementation. Dense and uncertain-dense corpora certify 32/32 systems; near-singular corpora certify 28/32, with the remainder inconclusive. Singular and range-exhaustion corpora retain their expected fallback outcomes. Measurements describe current cost, not a speedup over a prior solve API.

Closes #307.

Summary by CodeRabbit

  • New Features

    • Added reciprocal and division operations for intervals that exclude zero, with clear errors for zero-containing divisors or results that exceed finite range.
    • Added interval linear-system solving with certified solution enclosures, pivoting, and clear fallback errors when a solution cannot be certified.
  • Documentation

    • Expanded API guidance with solver guarantees, interval arithmetic behavior, and benchmarking details.
  • Tests

    • Added coverage for division, reciprocals, solution enclosures, and challenging numerical cases.

- Add const reciprocal and direct division bounds for zero-free intervals,
  including subnormal quotients and typed finite-range failures.
- Enclose fixed-dimension linear solutions with row pivoting and explicit
  inconclusive outcomes that preserve the caller's robust fallback.
- Document the all-admitted-systems contract and add diagnostic solve corpora
  without changing the retained release benchmark catalog.
- Refresh rustix and the contributor uv and cargo-nextest pins.

Closes #307
@acgetchell
acgetchell enabled auto-merge (squash) October 27, 2026 21:02
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 979041e and 1ce5970.

Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 16
  • Cargo.toml
  • README.md
  • REFERENCES.md
  • benches/common/interval_solve.rs
  • benches/interval_solve.rs
  • docs/BENCHMARKING.md
  • docs/code_organization.md
  • docs/mathematical_basis.md
  • pyproject.toml
  • src/error.rs
  • src/interval.rs
  • src/lib.rs
  • src/rounding.rs
  • tests/common/interval_solve_oracle.rs
  • tests/interval_solve.rs
  • tests/proptest_interval.rs

Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.

Walkthrough

The PR adds outward-rounded interval reciprocal and division operations, plus a fixed-size interval linear solver that reports inconclusive pivots and range failures. It adds rational-oracle and property tests, deterministic solve benchmarks, and API, mathematical, and benchmark documentation.

Changes: Interval enclosures

Layer / File(s) Summary
Outward-rounded interval arithmetic
src/error.rs, src/rounding.rs, src/interval.rs, tests/interval_solve.rs, tests/proptest_interval.rs, docs/mathematical_basis.md
Reciprocal and division calculate outward bounds for zero-free divisors. Zero-containing divisors and unavailable finite bounds return typed errors. Tests cover endpoint enclosures, sign combinations, subnormal values, and extreme magnitudes.
Interval linear solve
src/interval.rs, src/lib.rs, README.md, REFERENCES.md, docs/mathematical_basis.md, tests/common/interval_solve_oracle.rs, tests/interval_solve.rs
IntervalMatrix::solve uses pivoted elimination and back substitution to return solution enclosures. It reports inconclusive pivots without asserting singularity and returns no partial bounds on range failure. Tests compare results with exact-rational solutions and check uncertain systems, dimensions, and failure cases.
Benchmark corpora and validation
Cargo.toml, benches/common/interval_solve.rs, benches/interval_solve.rs, tests/interval_solve.rs, docs/BENCHMARKING.md, docs/code_organization.md, pyproject.toml
Adds deterministic solve fixtures and division and solve benchmarks. Fixture outcomes are checked before timing. Documentation describes the benchmark cases and commands; the tool versions are updated.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant IntervalMatrixSolve as IntervalMatrix::solve
  participant Interval
  Caller->>IntervalMatrixSolve: Provide interval matrix and right-hand side
  IntervalMatrixSolve->>Interval: Perform outward-rounded elimination and back substitution operations
  Interval-->>IntervalMatrixSolve: Return interval arithmetic results or a range error
  IntervalMatrixSolve-->>Caller: Return solution enclosures or a typed solve error
Loading

Possibly related issues

  • acgetchell/la-stack#311 — The PR adds the interval solve and division capabilities listed in the release scope, but does not complete publication or release verification.
  • acgetchell/delaunay#656 — The new solve API provides the capability referenced by the planned consumer migration, but this PR does not change the consumer’s local solver or fallback policy.
Merge Risk: Minimal · up to 1ce59

The interval arithmetic and solve changes appear ready to merge after normal checks; no actionable merge-blocking risk was identified.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Out of Scope Changes check Warning Most changes map to #307: interval arithmetic, solver, error variants, rounding helper, exact-oracle tests, benchmarks, and documentation. Two changes do not implement any #307 objective. (a) pyprojec… Remove the uv 0.13.6 and cargo-nextest 0.9.150 version changes from pyproject.toml, and remove the rustix 1.1.6 lock update, from this PR. Deliver those updates in a separate dependency or tooling change. After removal, rerun the validation…
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the main changes: outward-rounded interval division and interval solve enclosures.
Linked Issues check Passed Directly linked issue #307 requires outward-rounded reciprocal and division, a small-system solve enclosure, explicit outcomes, rational-oracle tests, D=1 to D=6 coverage, and benchmarks. The supplied…
Full details: Linked Issues check

Explanation

Directly linked issue #307 requires outward-rounded reciprocal and division, a small-system solve enclosure, explicit outcomes, rational-oracle tests, D=1 to D=6 coverage, and benchmarks. The supplied summary shows: (1) Interval::try_recip and Interval::try_div in src/interval.rs, with compare_quotient_with_rounded in src/rounding.rs for exact-comparison outward endpoints, IntervalZeroDivisor for zero-containing divisors, and IntervalRangeExhausted for missing finite enclosures; subnormal and tiny-ratio cases appear in tests and benchmark checks. (2) IntervalMatrix::solve uses row pivoting by separation from zero, outward-rounded elimination and back substitution, O(D^2) inline storage, and documented shape, dimension, and uncertainty contracts in src/lib.rs, src/interval.rs, and docs/mathematical_basis.md. Inconclusive pivots return IntervalSolveInconclusive and do not claim singularity, which matches the issue. (3) tests/common/interval_solve_oracle.rs provides an exact BigRational oracle, and tests/interval_solve.rs and tests/proptest_interval.rs cover extreme scales, uncertain systems, pivot selection, inconclusive results, range exhaustion, and rational comparison under the exact feature. The summary does not name a cancellation case explicitly; this is a minor coverage gap in the description, not a missing implementation. (4) Benchmark fixtures in benches/common/interval_solve.rs and benches/interval_solve.rs cover five 32-system corpora at D=1 to D=6 and report enclosure counts, and Cargo.toml adds the target. Evidence comes from the summary and PR description; no source inspection was run in this assessment.

Full details: Out of Scope Changes check

Explanation

Most changes map to #307: interval arithmetic, solver, error variants, rounding helper, exact-oracle tests, benchmarks, and documentation. Two changes do not implement any #307 objective. (a) pyproject.toml raises the required uv version from 0.13.5 to 0.13.6 and the pinned cargo-nextest version from 0.9.149 to 0.9.150. The PR description lists these as included updates. (b) The PR description also lists a rustix 1.1.6 update. It likely lives in Cargo.lock, which is an ignored file (rule '!**/*.lock'). Its contents were not inspected, so this part is unverified. The tool and dependency updates are unrelated to interval division or solving, and the PR does not link them to any requirement in #307.

Resolution

Remove the uv 0.13.6 and cargo-nextest 0.9.150 version changes from pyproject.toml, and remove the rustix 1.1.6 lock update, from this PR. Deliver those updates in a separate dependency or tooling change. After removal, rerun the validation for the reduced configuration, including just ci, and update the PR description to remove the dependency and tool update claims.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.32%. Comparing base (979041e) to head (1ce5970).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/interval.rs 97.70% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #315      +/-   ##
==========================================
+ Coverage   98.19%   98.32%   +0.13%     
==========================================
  Files          15       15              
  Lines        7306     7462     +156     
==========================================
+ Hits         7174     7337     +163     
+ Misses        132      125       -7     
Flag Coverage Δ
unittests 98.32% <98.07%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@acgetchell
acgetchell merged commit 1328f9d into main Oct 27, 2026
24 checks passed
@acgetchell
acgetchell deleted the feat/307-interval-solve branch October 27, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add outward-rounded interval division and linear solve enclosures

1 participant