diff -r 22fd33834ab7 -r d5dfcb6abcf5 src/direct_product.rs
--- a/src/direct_product.rs Mon May 12 21:56:42 2025 -0500
+++ b/src/direct_product.rs Mon May 12 22:48:16 2025 -0500
@@ -6,7 +6,9 @@
*/
use crate::euclidean::Euclidean;
-use crate::instance::{Decomposition, DecompositionMut, Instance, InstanceMut, MyCow};
+use crate::instance::{
+ Decomposition, DecompositionMut, Instance, InstanceMut, Instantiated, MyCow,
+};
use crate::linops::AXPY;
use crate::loc::Loc;
use crate::mapping::Space;
@@ -367,6 +369,25 @@
Pair: 'b;
}
+impl Instantiated, PairDecomposition> for Pair
+where
+ A: Space,
+ B: Space,
+ U: Instantiated,
+ V: Instantiated,
+ D: Decomposition,
+ Q: Decomposition,
+{
+ type RefInstance<'b>
+ = Pair, V::RefInstance<'b>>
+ where
+ Self: 'b;
+
+ fn ref_inst(&self) -> Self::RefInstance<'_> {
+ Pair(self.0.ref_inst(), self.1.ref_inst())
+ }
+}
+
impl Instance, PairDecomposition> for Pair
where
A: Space,
@@ -376,6 +397,12 @@
U: Instance,
V: Instance,
{
+ type Instantiated = Pair;
+
+ fn instantiate(self) -> Self::Instantiated {
+ Pair(self.0.instantiate(), self.1.instantiate())
+ }
+
fn eval_decompose<'b, R>(
self,
f: impl FnOnce(Pair, Q::Decomposition<'b>>) -> R,
@@ -425,6 +452,14 @@
&'a U: Instance,
&'a V: Instance,
{
+ type Instantiated =
+ Pair<<&'a U as Instance>::Instantiated, <&'a V as Instance>::Instantiated>;
+
+ fn instantiate(self) -> Self::Instantiated {
+ let &Pair(ref u, ref v) = self;
+ Pair(u.instantiate(), v.instantiate())
+ }
+
fn eval_decompose<'b, R>(
self,
f: impl FnOnce(Pair, Q::Decomposition<'b>>) -> R,