Skip to content

perf: improve LDLT factorization kernel #146

@acgetchell

Description

@acgetchell

Summary

Follow-up to #137: investigate LDLT factorization performance now that Matrix<D> and Vector<D> carry the finite-entry invariant directly and public solve APIs use the clean solve name.

Current State

The #137 finite-proof API cleanup improved la-stack rows versus the v0.4.2 Criterion baseline, including vector kernels and LU paths. The remaining consistent performance gap is LDLT factorization:

  • Ldlt::solve after factorization is often competitive, especially for repeated solves.
  • Ldlt factorization itself trails nalgebra/faer in the vs_linalg suite, with the gap becoming more visible as D grows.
  • LU factorization and LU solve paths look healthier, so this should remain focused on LDLT rather than revisiting the finite-proof API.

Proposed Changes

Investigate the LDLT factorization kernel for avoidable overhead while preserving the current correctness and API invariants:

  • Keep Matrix<D> / Vector<D> finite by construction.
  • Do not expose public unchecked constructors or public FiniteMatrix / FiniteVector types.
  • Do not reintroduce solve_vec; public factorization solves should remain solve.
  • Inspect the LDLT update loops, symmetry handling, and finite internal wrapper path for redundant work.
  • Prefer improvements that preserve stack allocation and const-generic fixed dimensions.

Benefits

Implementation Notes

  • Use benches/vs_linalg.rs as the primary performance signal.
  • Compare against the current post-Investigate checked vector kernel performance for v0.4.3 #137 baseline and optionally v0.4.2 for historical context.
  • Prioritize D=2 through D=16; D=32 and D=64 are informative but outside the crate's core performance target.
  • Keep error behavior unchanged: non-finite raw input is rejected at construction, while LDLT reports computed non-finite intermediates and singular/not-positive-semidefinite conditions as typed LaError variants.

Related: #137

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformancePerformance related issuesrustPull requests that update rust code

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions