diff -r 05089fbc0310 -r d8305c9b6fdf src/linops.rs --- a/src/linops.rs Tue Dec 31 08:30:43 2024 -0500 +++ b/src/linops.rs Sat Dec 21 23:32:20 2024 -0500 @@ -17,11 +17,13 @@ /// Efficient in-place summation. #[replace_float_literals(F::cast_from(literal))] -pub trait AXPY : Space +pub trait AXPY : Space + std::ops::MulAssign where F : Num, X : Space, { + type Owned : AXPY; + /// Computes `y = βy + αx`, where `y` is `Self`. fn axpy>(&mut self, α : F, x : I, β : F); @@ -34,6 +36,12 @@ fn scale_from>(&mut self, α : F, x : I) { self.axpy(α, x, 0.0) } + + /// Return a similar zero as `self`. + fn similar_origin(&self) -> Self::Owned; + + /// Set self to zero. + fn set_zero(&mut self); } /// Efficient in-place application for [`Linear`] operators.