Skip to content

Simplify redundant tolerance tests and vector finiteness scanning #139

Description

@acgetchell

Summary

Follow up on the whole-repo Rust simplification review with two conservative cleanup targets that preserve the parse/proof invariant model.

Current State

  • LU and LDLT each carry local invalid_tolerance_rejected tests even though those tests now only exercise Tolerance::new; factorization APIs accept a proven Tolerance, not raw f64.
  • Vector::try_new and FiniteVector::new each implement their own entry-by-entry finiteness scan.
  • Matrix code already uses a shared helper pattern for locating the first non-finite stored cell.

Proposed Changes

  • Remove redundant LU/LDLT tolerance-constructor tests if central Tolerance coverage remains complete.
  • Add a small private vector helper such as first_non_finite_entry_in(&[f64; D]) -> Option<usize> and use it from both public raw parsing and crate-internal proof wrapping.
  • Keep public APIs and unchecked constructors unchanged.

Benefits

  • Reduces duplicated tests that no longer cover factorization-specific behavior.
  • Reduces drift risk between public vector construction and internal proof-bearing vector validation.
  • Keeps the parse-don't-validate / proven DTO model intact.

Implementation Notes

  • Do not collapse set/set_checked, get/get_checked, Tolerance::new/LaError::validate_tolerance, or factor wrapper types; those preserve API ergonomics, typed diagnostics, compatibility, or invariant naming.
  • Validate with just check and cargo test --all-features.

Related: #137, #138

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions