diff -r c4e394a9c84c -r 402d717bb5c0 src/euclidean.rs --- a/src/euclidean.rs Mon Sep 01 13:51:03 2025 -0500 +++ b/src/euclidean.rs Mon Sep 01 20:55:34 2025 -0500 @@ -4,9 +4,8 @@ use crate::instance::Instance; use crate::linops::{VectorSpace, AXPY}; -use crate::norms::{HasDual, Reflexive}; +use crate::norms::Reflexive; use crate::types::*; -use std::ops::{Add, AddAssign, Sub, SubAssign}; pub mod wrap; @@ -17,17 +16,13 @@ /// The type should implement vector space operations (addition, subtraction, scalar /// multiplication and scalar division) along with their assignment versions, as well /// as an inner product. -// TODO: remove F parameter, use AXPY::Field +// TODO: remove F parameter, use VectorSpace::Field pub trait Euclidean: - HasDual - + VectorSpace - + Reflexive - // TODO: move the following to AXPY - + for<'b> Add<&'b Self, Output = ::Owned> - + for<'b> Sub<&'b Self, Output = ::Owned> - + for<'b> AddAssign<&'b Self> - + for<'b> SubAssign<&'b Self> + VectorSpace + + Reflexive { + type OwnedEuclidean: ClosedEuclidean; + // Inner product fn dot>(&self, other: I) -> F; @@ -71,10 +66,14 @@ } } +pub trait ClosedEuclidean: + Instance + Euclidean +{ +} +impl + Euclidean> ClosedEuclidean for X {} + // TODO: remove F parameter, use AXPY::Field -pub trait EuclideanMut: - Euclidean + AXPY + for<'b> AddAssign<&'b Self> + for<'b> SubAssign<&'b Self> -{ +pub trait EuclideanMut: Euclidean + AXPY { /// In-place projection to the 2-ball. #[inline] fn proj_ball2_mut(&mut self, ρ: F) { @@ -85,10 +84,7 @@ } } -impl EuclideanMut for X where - X: Euclidean + AXPY + for<'b> AddAssign<&'b Self> + for<'b> SubAssign<&'b Self> -{ -} +impl EuclideanMut for X where X: Euclidean + AXPY {} /// Trait for [`Euclidean`] spaces with dimensions known at compile time. pub trait StaticEuclidean: Euclidean {