pub fn entropy_unchecked(p: &[f64]) -> f64Expand description
Fast Shannon entropy calculation without simplex validation.
Used in performance-critical loops like Sinkhorn iteration for Optimal Transport.
§Invariant
Assumes p is non-negative and normalized.
§Examples
// Fair coin: H = ln(2).
let h = entropy_unchecked(&[0.5, 0.5]);
assert!((h - core::f64::consts::LN_2).abs() < 1e-12);
// Agrees with the checked version on valid input.
let p = [0.3, 0.7];
let h_checked = logp::entropy_nats(&p, 1e-9).unwrap();
assert!((entropy_unchecked(&p) - h_checked).abs() < 1e-15);