diff -r 102421d462d1 -r 53ab61a41d70 src/euclidean/wrap.rs --- 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 @@ -153,6 +155,8 @@ // + for<'b> std::ops::SubAssign<&'b Self> // + std::ops::Neg::Owned>, { + type PrincipalE = Self; + fn dot>(&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, + // Self::Unwrapped : $crate::linops::AXPY, + // Self: std::ops::MulAssign + std::ops::DivAssign, + // Self::Unwrapped: std::ops::MulAssign + std::ops::DivAssign, + { + 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, @@ -173,10 +193,7 @@ // Self: std::ops::MulAssign + std::ops::DivAssign, // Self::Unwrapped: std::ops::MulAssign + std::ops::DivAssign, { - type Field = $F; - type Owned = Self; - - fn axpy>(&mut self, α: $F, x: I, β: $F) { + fn axpy>(&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 = <::Unwrapped as $crate::instance::Space>::Decomp; + type Principal = Self; } }; }