--- a/src/direct_product.rs Mon Sep 01 20:55:34 2025 -0500 +++ b/src/direct_product.rs Mon Sep 01 23:03:27 2025 -0500 @@ -6,7 +6,9 @@ */ use crate::euclidean::Euclidean; -use crate::instance::{Decomposition, DecompositionMut, Instance, InstanceMut, MyCow, Ownable}; +use crate::instance::{ + Decomposition, DecompositionMut, EitherDecomp, Instance, InstanceMut, MyCow, Ownable, +}; use crate::linops::{VectorSpace, AXPY}; use crate::loc::Loc; use crate::mapping::Space; @@ -279,6 +281,14 @@ fn clone_owned(&self) -> Self::OwnedVariant { Pair(self.0.clone_owned(), self.1.clone_owned()) } + + fn owned_cow<'b>(self) -> MyCow<'b, Self::OwnedVariant> { + EitherDecomp::Owned(self.into_owned()) + } + + fn ref_owned_cow<'b>(&self) -> MyCow<'b, Self::OwnedVariant> { + EitherDecomp::Owned(self.into_owned()) + } } /// We only support 'closed' `Euclidean` `Pair`s, as more general ones cause @@ -439,19 +449,6 @@ self.0 .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) } - - #[inline] - fn cow<'b>(self) -> MyCow<'b, Pair<A, B>> - where - Self: 'b, - { - MyCow::Owned(Pair(self.0.own(), self.1.own())) - } - - #[inline] - fn own(self) -> Pair<A, B> { - Pair(self.0.own(), self.1.own()) - } } impl<'a, A, B, U, V, D, Q> Instance<Pair<A, B>, PairDecomposition<D, Q>> for &'a Pair<U, V> @@ -490,20 +487,6 @@ self.0 .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) } - - #[inline] - fn cow<'b>(self) -> MyCow<'b, Pair<A, B>> - where - Self: 'b, - { - MyCow::Owned(self.own()) - } - - #[inline] - fn own(self) -> Pair<A, B> { - let Pair(ref u, ref v) = self; - Pair(u.own(), v.own()) - } } impl<A, B, D, Q> DecompositionMut<Pair<A, B>> for PairDecomposition<D, Q>