Skip to content

Commit 66abe16

Browse files
committed
fix(lda): raise PartialEq tolerance from 1e-10 to 1e-6 for f32 safety
1e-10 rounds to 0.0 in f32 (min positive normal ~1.2e-7), making (a - b).abs() > 0.0 almost always true for distinct values. The 1e-6 floor works correctly for both f32 and f64. Addresses review feedback on #457.
1 parent b26f009 commit 66abe16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/decomposition/lda.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub struct LDA<T: Number + RealNumber, X: Array2<T> + EVDDecomposable<T>> {
7171

7272
impl<T: Number + RealNumber, X: Array2<T> + EVDDecomposable<T>> PartialEq for LDA<T, X> {
7373
fn eq(&self, other: &Self) -> bool {
74-
let tol = T::from(1e-10).unwrap();
74+
let tol = T::from(1e-6).unwrap();
7575
if self.n_features != other.n_features
7676
|| self.eigenvalues.len() != other.eigenvalues.len()
7777
|| self

0 commit comments

Comments
 (0)