Repository navigation
Closed
Labels
Milestone
Description
Dependencies
- chore: bump MSRV to Rust 1.95 and adopt new stable features #67
- bug: inf_norm silently returns 0.0 for matrices containing NaN #85
Summary
Several public methods that are pure computation over [f64; D] / [[f64; D]; D] arrays could be const fn today but aren't. This would enable compile-time evaluation and is consistent with the existing const fn pattern established by det_direct, Vector::dot, etc.
Depends on: #67 (MSRV bump to 1.95, which stabilizes additional const-compatible float intrinsics) and #85 (fix inf_norm before const-ifying it)
Candidates
Easy (no trait methods, just loops and float ops)
Lu::det— loop over diagonal with multiply-accumulate. Straightforward.Ldlt::det— same pattern asLu::det.Matrix::inf_norm— needs manual loop replacing.iter().map().sum()(iterators aren't const-stable). Also depends onf64::abs()being const — check availability at MSRV 1.95.Matrix::det_errbound— usesf64::abs()andmul_add. Sameabs()dependency.
Moderate (manual loops replacing iterator chains)
Lu::solve_vec— the forward/back substitution loops are already manual; the iterator-based inner loops (enumerate().take(i),enumerate().skip(i+1)) would need conversion towhileloops. Theis_finite()check needs to be const-compatible.Ldlt::solve_vec— same pattern asLu::solve_vec.
Blocked (needs generic_const_exprs or other unstable features)
gauss_solveand exact methods — useBigInt/BigRationalheap types, not const-eligible- Augmented matrix types (
[T; D+1]) — needsgeneric_const_exprs(v0.5.0 territory)
Approach
- After chore: bump MSRV to Rust 1.95 and adopt new stable features #67 lands, audit which
f64methods (abs,is_finite,is_nan) are const-stable at MSRV 1.95 - Convert eligible methods, replacing iterator chains with
whileloops where needed - Add
constevaluation tests (similar to the existingdet_direct_is_const_evaluable_*tests)
Benefits
- Compile-time evaluation of determinants, norms, and solves for known inputs
- Consistent API: if
det_directandVector::dotare const, their peers should be too - Foundation for v0.5.0's deeper const-generics work
Activity
acgetchell commentedon Apr 14, 2026
Blocked by #67 (needs MSRV 1.95 for const float intrinsics) and #85 (inf_norm fix should land before const-ifying it).
Changed: finalize documentation, benchmarks, and error handling
Changed: consolidate and expand const-evaluability tests via macros