Summary
Expose the internal bareiss_det() function as a public API that returns the exact determinant as a BigRational, not just its sign.
Current State
det_sign_exact() returns only the sign (i8) of the determinant. Internally, it calls bareiss_det() which computes the full exact BigRational determinant, but this value is discarded after extracting the sign.
Proposed Changes
Add a public method:
pub fn det_exact(&self) -> Result<BigRational, LaError>
This would:
- Validate entries are finite (same as
det_sign_exact)
- Run the Bareiss algorithm in
BigRational arithmetic
- Return the full exact determinant value
Optionally, also provide a convenience method that converts the result to f64:
pub fn det_exact_f64(&self) -> Result<f64, LaError>
Benefits
- Exact volume computation: Consumers like delaunay compute simplex volumes via
det(Gram matrix). An exact determinant value would let them distinguish truly-degenerate simplices from near-degenerate ones.
- Minimal implementation effort:
bareiss_det() already exists and is tested; this is primarily an API exposure change.
- Composable: Callers who need both the sign and value can use
det_exact() instead of calling det_sign_exact() and then separately computing the value.
Implementation Notes
- Gate behind
#[cfg(feature = "exact")]
BigRational would become part of the public API surface — consider re-exporting it or documenting the num-rational dependency
- The fast f64 filter from
det_sign_exact could optionally be used to return an exact f64 result when the error bound is small enough (i.e., det_direct() is already exact to full precision)
Co-Authored-By: Oz oz-agent@warp.dev
Summary
Expose the internal
bareiss_det()function as a public API that returns the exact determinant as aBigRational, not just its sign.Current State
det_sign_exact()returns only the sign (i8) of the determinant. Internally, it callsbareiss_det()which computes the full exactBigRationaldeterminant, but this value is discarded after extracting the sign.Proposed Changes
Add a public method:
This would:
det_sign_exact)BigRationalarithmeticOptionally, also provide a convenience method that converts the result to f64:
Benefits
det(Gram matrix). An exact determinant value would let them distinguish truly-degenerate simplices from near-degenerate ones.bareiss_det()already exists and is tested; this is primarily an API exposure change.det_exact()instead of callingdet_sign_exact()and then separately computing the value.Implementation Notes
#[cfg(feature = "exact")]BigRationalwould become part of the public API surface — consider re-exporting it or documenting thenum-rationaldependencydet_sign_exactcould optionally be used to return an exact f64 result when the error bound is small enough (i.e.,det_direct()is already exact to full precision)Co-Authored-By: Oz oz-agent@warp.dev