--- a/src/euclidean/wrap.rs Wed Sep 03 21:03:47 2025 -0500 +++ b/src/euclidean/wrap.rs Wed Sep 03 21:31:13 2025 -0500 @@ -135,6 +135,8 @@ $crate::wrap!(impl_scalar_mut $F, $type, std::ops::MulAssign, mul_assign where $($qual)*); $crate::wrap!(impl_scalar_mut $F, $type, std::ops::DivAssign, div_assign where $($qual)*); + $crate::self_ownable!($type where $($qual)*); + impl<$($qual)*> $crate::euclidean::Euclidean<$F> for $type // where // Self: $crate::euclidean::wrap::Wrapped<WrappedField = $F> @@ -153,6 +155,8 @@ // + for<'b> std::ops::SubAssign<&'b Self> // + std::ops::Neg<Output = <Self as $crate::linops::AXPY>::Owned>, { + type PrincipalE = Self; + fn dot<I: $crate::instance::Instance<Self>>(&self, other: I) -> $F { other.eval_decompose(|x| self.get_view().dot(&x.get_view())) } @@ -166,6 +170,22 @@ } } + impl<$($qual)*> $crate::linops::VectorSpace for $type + // where + // Self : $crate::euclidean::wrap::Wrapped<WrappedField = $F>, + // Self::Unwrapped : $crate::linops::AXPY<Field = F>, + // Self: std::ops::MulAssign<F> + std::ops::DivAssign<F>, + // Self::Unwrapped: std::ops::MulAssign<F> + std::ops::DivAssign<F>, + { + type Field = $F; + type PrincipalV = Self; + + /// Return a similar zero as `self`. + fn similar_origin(&self) -> Self::PrincipalV { + Self::wrap(self.get_view().similar_origin()) + } + } + impl<$($qual)*> $crate::linops::AXPY for $type // where // Self : $crate::euclidean::wrap::Wrapped<WrappedField = $F>, @@ -173,10 +193,7 @@ // Self: std::ops::MulAssign<F> + std::ops::DivAssign<F>, // Self::Unwrapped: std::ops::MulAssign<F> + std::ops::DivAssign<F>, { - type Field = $F; - type Owned = Self; - - fn axpy<I: $crate::instance::Instance<Self>>(&mut self, α: $F, x: I, β: $F) { + fn axpy<I: $crate::instance::Instance<Self>>(&mut self, α: $F, x: I, β: $F) { x.eval_decompose(|v| { self.get_view_mut().axpy(α, v.get_view(), β) }) @@ -194,11 +211,6 @@ }) } - /// Return a similar zero as `self`. - fn similar_origin(&self) -> Self::Owned { - Self::wrap(self.get_view().similar_origin()) - } - /// Set self to zero. fn set_zero(&mut self) { self.get_mut_view().set_zero() @@ -207,6 +219,7 @@ impl<$($qual)*> $crate::instance::Space for $type { type Decomp = <<Self as $crate::euclidean::wrap::Wrapped>::Unwrapped as $crate::instance::Space>::Decomp; + type Principal = Self; } }; }