diff -r d8305c9b6fdf -r f7b87d84864d src/direct_product.rs --- a/src/direct_product.rs Sat Dec 21 23:32:20 2024 -0500 +++ b/src/direct_product.rs Sun Dec 22 14:54:46 2024 -0500 @@ -10,7 +10,7 @@ use serde::{Serialize, Deserialize}; use crate::types::{Num, Float}; use crate::{maybe_lifetime, maybe_ref}; -use crate::euclidean::{Dot, Euclidean}; +use crate::euclidean::Euclidean; use crate::instance::{Instance, InstanceMut, Decomposition, DecompositionMut, MyCow}; use crate::mapping::Space; use crate::linops::AXPY; @@ -237,18 +237,6 @@ impl_pair_vectorspace_ops!((f32, f32), f32); impl_pair_vectorspace_ops!((f64, f64), f64); -impl Dot, F> for Pair -where - A : Dot, - B : Dot, - F : Num -{ - - fn dot(&self, Pair(ref u, ref v) : &Pair) -> F { - self.0.dot(u) + self.1.dot(v) - } -} - type PairOutput = Pair<>::Output, >::Output>; impl Euclidean for Pair @@ -257,7 +245,7 @@ B : Euclidean, F : Float, PairOutput : Euclidean, - Self : Sized + Dot + Self : Sized + Mul> + MulAssign + Div> + DivAssign + Add> @@ -270,6 +258,15 @@ { type Output = PairOutput; + fn dot>(&self, other : I) -> F { + let Pair(u, v) = other.decompose(); + self.0.dot(u) + self.1.dot(v) + } + + fn norm2_squared(&self) -> F { + self.0.norm2_squared() + self.1.norm2_squared() + } + fn dist2_squared(&self, Pair(ref u, ref v) : &Self) -> F { self.0.dist2_squared(u) + self.1.dist2_squared(v) }