diff -r afe04e6b4a5b -r 76c77e49581a src/direct_product.rs --- a/src/direct_product.rs Sun Sep 07 10:00:14 2025 -0500 +++ b/src/direct_product.rs Mon Sep 08 19:22:13 2025 -0500 @@ -10,7 +10,7 @@ use crate::linops::{VectorSpace, AXPY}; use crate::loc::Loc; use crate::mapping::Space; -use crate::norms::{HasDual, Norm, NormExponent, Normed, PairNorm, L2}; +use crate::norms::{Dist, HasDual, Norm, NormExponent, Normed, PairNorm, L2}; use crate::types::{Float, Num}; use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; use serde::{Deserialize, Serialize}; @@ -568,6 +568,51 @@ } } +impl Dist, F> for Pair +where + F: Num, + ExpA: NormExponent, + ExpB: NormExponent, + ExpJ: NormExponent, + A: Dist, + B: Dist, + Loc<2, F>: Norm, +{ + fn dist>( + &self, + x: I, + PairNorm(expa, expb, expj): PairNorm, + ) -> F { + x.eval_decompose(|Pair(x1, x2)| { + Loc([self.0.dist(x1, expa), self.1.dist(x2, expb)]).norm(expj) + }) + } +} + +impl Norm for Pair +where + F: Num, + A: Norm, + B: Norm, + Loc<2, F>: Norm, +{ + fn norm(&self, _: L2) -> F { + Loc([self.0.norm(L2), self.1.norm(L2)]).norm(L2) + } +} + +impl Dist for Pair +where + F: Num, + A: Dist, + B: Dist, + Loc<2, F>: Norm, +{ + fn dist>(&self, x: I, _: L2) -> F { + x.eval_decompose(|Pair(x1, x2)| Loc([self.0.dist(x1, L2), self.1.dist(x2, L2)]).norm(L2)) + } +} + impl Normed for Pair where A: Normed,