-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
apienhancementNew feature or requestNew feature or requestrustPull requests that update rust codePull requests that update rust code
Description
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
BigRationalarithmetic - 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 callingdet_sign_exact()and then separately computing the value.
Implementation Notes
- Gate behind
#[cfg(feature = "exact")] BigRationalwould become part of the public API surface — consider re-exporting it or documenting thenum-rationaldependency- The fast f64 filter from
det_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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
apienhancementNew feature or requestNew feature or requestrustPull requests that update rust codePull requests that update rust code