src/euclidean.rs

branch
dev
changeset 164
fd9dba51afd3
parent 151
402d717bb5c0
child 186
afe04e6b4a5b
--- a/src/euclidean.rs	Wed Sep 03 09:52:30 2025 -0500
+++ b/src/euclidean.rs	Wed Sep 03 10:08:28 2025 -0500
@@ -18,10 +18,11 @@
 /// as an inner product.
 // TODO: remove F parameter, use VectorSpace::Field
 pub trait Euclidean<F: Float = f64>:
-    VectorSpace<Field = F, Owned = Self::OwnedEuclidean>
-    + Reflexive<F, DualSpace = Self::OwnedEuclidean>
+    VectorSpace<Field = F, PrincipalV = Self::PrincipalE> + Reflexive<F, DualSpace = Self::PrincipalE>
 {
-    type OwnedEuclidean: ClosedEuclidean<F>;
+    /// Principal form of the space; always equal to [`Space::Principal`] and
+    /// [`VectorSpace::PrincipalV`], but with more traits guaranteed.
+    type PrincipalE: ClosedEuclidean<F>;
 
     // Inner product
     fn dot<I: Instance<Self>>(&self, other: I) -> F;
@@ -56,7 +57,7 @@
 
     /// Projection to the 2-ball.
     #[inline]
-    fn proj_ball2(self, ρ: F) -> Self::Owned {
+    fn proj_ball2(self, ρ: F) -> Self::PrincipalV {
         let r = self.norm2();
         if r > ρ {
             self * (ρ / r)
@@ -67,10 +68,10 @@
 }
 
 pub trait ClosedEuclidean<F: Float = f64>:
-    Instance<Self> + Euclidean<F, OwnedEuclidean = Self>
+    Instance<Self> + Euclidean<F, PrincipalE = Self>
 {
 }
-impl<F: Float, X: Instance<X> + Euclidean<F, OwnedEuclidean = Self>> ClosedEuclidean<F> for X {}
+impl<F: Float, X: Instance<X> + Euclidean<F, PrincipalE = Self>> ClosedEuclidean<F> for X {}
 
 // TODO: remove F parameter, use AXPY::Field
 pub trait EuclideanMut<F: Float = f64>: Euclidean<F> + AXPY<Field = F> {
@@ -89,5 +90,5 @@
 /// Trait for [`Euclidean`] spaces with dimensions known at compile time.
 pub trait StaticEuclidean<F: Float = f64>: Euclidean<F> {
     /// Returns the origin
-    fn origin() -> <Self as VectorSpace>::Owned;
+    fn origin() -> <Self as VectorSpace>::PrincipalV;
 }

mercurial