diff -r 2f1798c65fd6 -r c4e394a9c84c src/direct_product.rs
--- a/src/direct_product.rs Mon Sep 01 00:04:22 2025 -0500
+++ b/src/direct_product.rs Mon Sep 01 13:51:03 2025 -0500
@@ -6,8 +6,10 @@
*/
use crate::euclidean::Euclidean;
-use crate::instance::{Decomposition, DecompositionMut, Instance, InstanceMut, MyCow};
-use crate::linops::AXPY;
+use crate::instance::{
+ ClosedSpace, Decomposition, DecompositionMut, Instance, InstanceMut, MyCow, Ownable,
+};
+use crate::linops::{VectorSpace, AXPY};
use crate::loc::Loc;
use crate::mapping::Space;
use crate::norms::{HasDual, Norm, NormExponent, Normed, PairNorm, L2};
@@ -262,6 +264,25 @@
impl_scalar_mut!(MulAssign, mul_assign);
impl_scalar_mut!(DivAssign, div_assign);
+/// Trait for ownable-by-consumption objects
+impl Ownable for Pair
+where
+ A: Ownable,
+ B: Ownable,
+{
+ type OwnedVariant = Pair;
+
+ #[inline]
+ fn into_owned(self) -> Self::OwnedVariant {
+ Pair(self.0.into_owned(), self.1.into_owned())
+ }
+
+ /// Returns an owned instance of a reference.
+ fn clone_owned(&self) -> Self::OwnedVariant {
+ Pair(self.0.clone_owned(), self.1.clone_owned())
+ }
+}
+
/// We only support 'closed' `Euclidean` `Pair`s, as more general ones cause
/// compiler overflows.
impl Euclidean for Pair
@@ -270,19 +291,19 @@
B: Euclidean,
//Pair: Euclidean,
Self: Sized
- + Mul::Owned>
+ + Mul::Owned>
+ MulAssign
- + Div::Owned>
+ + Div::Owned>
+ DivAssign
- + Add::Owned>
- + Sub::Owned>
- + for<'b> Add<&'b Self, Output = ::Owned>
- + for<'b> Sub<&'b Self, Output = ::Owned>
+ + Add::Owned>
+ + Sub::Owned>
+ + for<'b> Add<&'b Self, Output = ::Owned>
+ + for<'b> Sub<&'b Self, Output = ::Owned>
+ AddAssign
+ for<'b> AddAssign<&'b Self>
+ SubAssign
+ for<'b> SubAssign<&'b Self>
- + Neg