--- a/src/loc.rs Wed Sep 03 19:55:05 2025 -0500 +++ b/src/loc.rs Wed Sep 03 20:19:41 2025 -0500 @@ -442,7 +442,7 @@ /// Use [`nalgebra`] for larger vectors. #[inline] fn dot<I: Instance<Self>>(&self, other: I) -> F { - other.eval_ref_decompose(|r| { + other.eval_ref(|r| { self.0 .iter() .zip(r.0.iter()) @@ -458,7 +458,7 @@ } fn dist2_squared<I: Instance<Self>>(&self, other: I) -> F { - other.eval_ref_decompose(|r| { + other.eval_ref(|r| { self.iter().zip(r.iter()).fold(F::ZERO, |m, (&v, &w)| { let d = v - w; m + d * d @@ -480,9 +480,7 @@ fn dist2<I: Instance<Self>>(&self, other: I) -> F { // Optimisation for N==1 that avoids squaring and square rooting. if N == 1 { - other.eval_ref_decompose(|r| { - unsafe { *self.0.get_unchecked(0) - *r.0.get_unchecked(0) }.abs() - }) + other.eval_ref(|r| unsafe { *self.0.get_unchecked(0) - *r.0.get_unchecked(0) }.abs()) } else { self.dist2_squared(other).sqrt() } @@ -643,7 +641,7 @@ impl<F: Float, const N: usize> Dist<L1, F> for Loc<N, F> { #[inline] fn dist<I: Instance<Self>>(&self, other: I, _: L1) -> F { - other.eval_ref_decompose(|r| { + other.eval_ref(|r| { self.iter() .zip(r.iter()) .fold(F::ZERO, |m, (&v, &w)| m + (v - w).abs()) @@ -679,7 +677,7 @@ impl<F: Float, const N: usize> Dist<Linfinity, F> for Loc<N, F> { #[inline] fn dist<I: Instance<Self>>(&self, other: I, _: Linfinity) -> F { - other.eval_ref_decompose(|r| { + other.eval_ref(|r| { self.iter() .zip(r.iter()) .fold(F::ZERO, |m, (&v, &w)| m.max((v - w).abs())) @@ -761,7 +759,7 @@ impl<F: Float, const N: usize> AXPY<Loc<N, F>> for Loc<N, F> { #[inline] fn axpy<I: Instance<Loc<N, F>>>(&mut self, α: F, x: I, β: F) { - x.eval(|x̃| { + x.eval_ref(|x̃| { if β == F::ZERO { map2_mut(self, x̃, |yi, xi| *yi = α * (*xi)) } else { @@ -772,7 +770,7 @@ #[inline] fn copy_from<I: Instance<Loc<N, F>>>(&mut self, x: I) { - x.eval(|x̃| map2_mut(self, x̃, |yi, xi| *yi = *xi)) + x.eval_ref(|x̃| map2_mut(self, x̃, |yi, xi| *yi = *xi)) } #[inline]