Skip to content

perf!: optimize exact conversion and dense 4D determinants - #238

Merged
acgetchell merged 1 commit into
mainfrom
perf/234-solve-finalization
Sep 6, 2026
Merged

perf!: optimize exact conversion and dense 4D determinants#238
acgetchell merged 1 commit into
mainfrom
perf/234-solve-finalization

Conversation

@acgetchell

@acgetchell acgetchell commented Sep 6, 2026

Copy link
Copy Markdown
Owner
  • Avoid redundant fraction reduction in strict RationalVector conversion.
  • Share minors in dense exact 4×4 determinants while preserving the sparse fast path.
  • Add adversarial solve benchmarks across D=2,3,4,5,8,16,32,64 and exact-arithmetic diagnostics.
  • Include Gaussian reference working-copy costs in benchmark timings.
  • Document the decision to retain existing LU/LDLT solve finalization after finding no repeatable speedup.
  • Align tooling with Rust 1.98.1 and refresh dependency and tool pins.

BREAKING CHANGE: la-stack now requires Rust 1.98.1.

Closes #234

Summary by CodeRabbit

  • Compatibility

    • Updated the minimum supported Rust version and pinned toolchain to Rust 1.98.1.
  • Improvements

    • Improved exact rational-to-binary64 conversion support and documentation, including clearer handling of rounding and overflow.
    • Optimized dense 4×4 determinant calculations while preserving sparse-case behavior.
  • Benchmarks & Validation

    • Added diagnostic benchmark coverage for exact conversions, determinants, and LU solves across challenging numerical scenarios.
    • Expanded regression and allocation tests for conversion, determinant, and solve correctness.
  • Documentation & Maintenance

    • Added benchmarking guidance and solve-finalization decision documentation.
    • Updated contributor tooling versions.

- Avoid redundant fraction reduction in strict RationalVector conversion.
- Share minors in dense exact 4×4 determinants while preserving the sparse fast path.
- Add adversarial solve benchmarks across D=2,3,4,5,8,16,32,64 and exact-arithmetic diagnostics.
- Include Gaussian reference working-copy costs in benchmark timings.
- Document the decision to retain existing LU/LDLT solve finalization after finding no repeatable speedup.
- Align tooling with Rust 1.98.1 and refresh dependency and tool pins.

BREAKING CHANGE: la-stack now requires Rust 1.98.1.

Closes #234
@acgetchell acgetchell self-assigned this Sep 6, 2026
@acgetchell
acgetchell enabled auto-merge September 6, 2026 03:11
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: b55f5d80-7389-4e58-9756-26abe3d5253e

📥 Commits

Reviewing files that changed from the base of the PR and between 188c35b and 7fd6d8e.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (21)
  • AGENTS.md
  • CONTRIBUTING.md
  • Cargo.toml
  • README.md
  • benches/common/exact_diagnostics.rs
  • benches/common/vs_linalg.rs
  • benches/exact.rs
  • benches/vs_linalg.rs
  • clippy.toml
  • docs/BENCHMARKING.md
  • docs/performance/solve-finalization.md
  • justfile
  • rust-toolchain.toml
  • src/exact.rs
  • src/lu.rs
  • src/rational.rs
  • tests/canonical_conversion_allocations.rs
  • tests/exact_bench_config.rs
  • tests/exact_conversion_boundaries.rs
  • tests/solve_finalization.rs
  • tests/vs_linalg_inputs.rs

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


📝 Walkthrough

Walkthrough

The PR adds exact rational conversion and determinant diagnostics, validated LU benchmark scenarios, arithmetic and solve-finalization regression tests, benchmark documentation, and Rust/toolchain version updates.

Changes

Exact arithmetic and determinant diagnostics

Layer / File(s) Summary
Exact conversion and determinant diagnostics
benches/common/exact_diagnostics.rs, src/exact.rs, src/rational.rs, benches/exact.rs, tests/canonical_conversion_allocations.rs, tests/exact_bench_config.rs, tests/exact_conversion_boundaries.rs
Adds canonical rational conversion support for RationalVector, optimized dense 4×4 determinant evaluation, diagnostic fixtures, allocation checks, benchmark registration, and conversion and determinant validation.

Validated LU diagnostic benchmarks

Layer / File(s) Summary
Validated LU diagnostic benchmarks
benches/common/vs_linalg.rs, benches/vs_linalg.rs, tests/vs_linalg_inputs.rs, docs/BENCHMARKING.md
Adds pivoting and dense ill-conditioned LU scenarios. It validates la-stack, nalgebra, and faer solutions before benchmarking complete and reusable-factor solves.

Solve arithmetic and finalization regression coverage

Layer / File(s) Summary
Solve arithmetic and finalization regression coverage
src/lu.rs, tests/solve_finalization.rs, docs/performance/solve-finalization.md
Adds bit-exact LU arithmetic-order tests and LU/LDLT non-finite error tests for operation and index reporting across dimensions 2–64. Documents the retained solve finalization approach.

Toolchain and benchmark documentation

Layer / File(s) Summary
Toolchain and benchmark documentation
Cargo.toml, rust-toolchain.toml, clippy.toml, justfile, AGENTS.md, CONTRIBUTING.md, README.md, docs/BENCHMARKING.md
Updates the Rust version from 1.98.0 to 1.98.1, refreshes tool pins, and documents benchmark timing, diagnostic commands, allocation tests, and historical results.

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

Merge Risk: ⚪ Minimal · up to 7fd6d

No actionable merge-blocking risk remains in the reviewed changes.

Sequence Diagram(s)

sequenceDiagram
  participant FixtureBuilder
  participant LaStack
  participant Nalgebra
  participant Faer
  participant Criterion
  FixtureBuilder->>LaStack: build and validate LU scenarios
  FixtureBuilder->>Nalgebra: solve reference inputs
  FixtureBuilder->>Faer: solve reference inputs
  LaStack->>Criterion: benchmark complete and reusable-factor solves
  Nalgebra->>Criterion: benchmark reference solves
  Faer->>Criterion: benchmark reference solves
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The pull request includes substantial work unrelated to issue #234, including exact rational-to-f64 conversion changes, dense 4×4 determinant optimization, exact-arithmetic diagnostics, and Rust/tool … Remove the unrelated conversion, determinant, diagnostic, and tooling changes, or link them to separate issues that define those objectives.
✅ 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 identifies the two primary optimization changes: exact conversion and dense 4×4 determinant computation.
Linked Issues check ✅ Passed The changes satisfy issue #234. They add LU solve benchmarks for the required dimensions, preserve finite-value invariants, retain typed non-finite diagnostics, avoid unsafe code, and document retaini…
Full details: Out of Scope Changes check

Explanation

The pull request includes substantial work unrelated to issue #234, including exact rational-to-f64 conversion changes, dense 4×4 determinant optimization, exact-arithmetic diagnostics, and Rust/tool version updates.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/234-solve-finalization

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

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.04%. Comparing base (188c35b) to head (7fd6d8e).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   98.00%   98.04%   +0.03%     
==========================================
  Files          13       13              
  Lines        6579     6694     +115     
==========================================
+ Hits         6448     6563     +115     
  Misses        131      131              
Flag Coverage Δ
unittests 98.04% <100.00%> (+0.03%) ⬆️

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 bd80cc0 into main Sep 6, 2026
20 of 21 checks passed
@acgetchell
acgetchell deleted the perf/234-solve-finalization branch September 6, 2026 03:40
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.

perf: Measure proof-carrying LU and LDLT solve finalization

1 participant