diff -r 402d717bb5c0 -r dab30b331f49 src/direct_product.rs
--- 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>
- where
- Self: 'b,
- {
- MyCow::Owned(Pair(self.0.own(), self.1.own()))
- }
-
- #[inline]
- fn own(self) -> Pair {
- Pair(self.0.own(), self.1.own())
- }
}
impl<'a, A, B, U, V, D, Q> Instance, PairDecomposition> for &'a Pair
@@ -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>
- where
- Self: 'b,
- {
- MyCow::Owned(self.own())
- }
-
- #[inline]
- fn own(self) -> Pair {
- let Pair(ref u, ref v) = self;
- Pair(u.own(), v.own())
- }
}
impl DecompositionMut> for PairDecomposition