--- a/src/nalgebra_support.rs Wed Sep 03 19:55:05 2025 -0500 +++ b/src/nalgebra_support.rs Wed Sep 03 20:19:41 2025 -0500 @@ -159,15 +159,7 @@ } #[inline] - fn eval_decompose<'b, R>(self, f: impl FnOnce(OMatrix<E, M, K>) -> R) -> R - where - Self: 'b, - { - f(self.into_owned()) - } - - #[inline] - fn eval_ref_decompose<'b, R>( + fn eval_ref<'b, R>( &'b self, f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R, ) -> R @@ -190,6 +182,14 @@ { self.cow_owned() } + + #[inline] + fn decompose<'b>(self) -> OMatrix<E, M, K> + where + Self: 'b, + { + self.into_owned() + } } impl<'a, S1, S2, M, K, E> Instance<Matrix<E, M, K, S1>, MatrixDecomposition> @@ -215,14 +215,7 @@ g(self.as_view()) } - fn eval_decompose<'b, R>(self, f: impl FnOnce(OMatrix<E, M, K>) -> R) -> R - where - Self: 'b, - { - f(self.into_owned()) - } - - fn eval_ref_decompose<'b, R>( + fn eval_ref<'b, R>( &'b self, f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R, ) -> R @@ -245,6 +238,14 @@ { self.cow_owned() } + + #[inline] + fn decompose<'b>(self) -> OMatrix<E, M, K> + where + Self: 'b, + { + self.into_owned() + } } impl<SM, N, M, K, E> Mapping<OMatrix<E, M, K>> for Matrix<E, N, M, SM> @@ -344,7 +345,7 @@ #[inline] fn copy_from<I: Instance<Matrix<E, M, N, SV1>>>(&mut self, y: I) { - y.eval(|ỹ| Matrix::copy_from(self, ỹ)) + y.eval_ref(|ỹ| Matrix::copy_from(self, &ỹ)) } #[inline] @@ -458,7 +459,7 @@ #[inline] fn dot<I: Instance<Self>>(&self, other: I) -> E { - other.eval_ref_decompose(|ref r| Vector::<E, M, S>::dot(self, r)) + other.eval_ref(|ref r| Vector::<E, M, S>::dot(self, r)) } #[inline] @@ -468,7 +469,7 @@ #[inline] fn dist2_squared<I: Instance<Self>>(&self, other: I) -> E { - other.eval_ref_decompose(|ref r| metric_distance_squared(self, r)) + other.eval_ref(|ref r| metric_distance_squared(self, r)) } } @@ -547,7 +548,7 @@ { #[inline] fn dist<I: Instance<Self>>(&self, other: I, _: L1) -> E { - other.eval_ref_decompose(|ref r| nalgebra::Norm::metric_distance(&LpNorm(1), self, r)) + other.eval_ref(|ref r| nalgebra::Norm::metric_distance(&LpNorm(1), self, r)) } } @@ -575,7 +576,7 @@ { #[inline] fn dist<I: Instance<Self>>(&self, other: I, _: L2) -> E { - other.eval_ref_decompose(|ref r| nalgebra::Norm::metric_distance(&LpNorm(2), self, r)) + other.eval_ref(|ref r| nalgebra::Norm::metric_distance(&LpNorm(2), self, r)) } } @@ -603,7 +604,7 @@ { #[inline] fn dist<I: Instance<Self>>(&self, other: I, _: Linfinity) -> E { - other.eval_ref_decompose(|ref r| nalgebra::Norm::metric_distance(&UniformNorm, self, r)) + other.eval_ref(|ref r| nalgebra::Norm::metric_distance(&UniformNorm, self, r)) } }