48 #[replace_float_literals(F::cast_from(literal))] |
48 #[replace_float_literals(F::cast_from(literal))] |
49 pub trait GEMV<F : Num, X : Space, Y = <Self as Mapping<X>>::Codomain> : Linear<X> { |
49 pub trait GEMV<F : Num, X : Space, Y = <Self as Mapping<X>>::Codomain> : Linear<X> { |
50 /// Computes `y = αAx + βy`, where `A` is `Self`. |
50 /// Computes `y = αAx + βy`, where `A` is `Self`. |
51 fn gemv<I : Instance<X>>(&self, y : &mut Y, α : F, x : I, β : F); |
51 fn gemv<I : Instance<X>>(&self, y : &mut Y, α : F, x : I, β : F); |
52 |
52 |
|
53 #[inline] |
53 /// Computes `y = Ax`, where `A` is `Self` |
54 /// Computes `y = Ax`, where `A` is `Self` |
54 fn apply_mut<I : Instance<X>>(&self, y : &mut Y, x : I){ |
55 fn apply_mut<I : Instance<X>>(&self, y : &mut Y, x : I){ |
55 self.gemv(y, 1.0, x, 0.0) |
56 self.gemv(y, 1.0, x, 0.0) |
56 } |
57 } |
57 |
58 |
|
59 #[inline] |
58 /// Computes `y += Ax`, where `A` is `Self` |
60 /// Computes `y += Ax`, where `A` is `Self` |
59 fn apply_add<I : Instance<X>>(&self, y : &mut Y, x : I){ |
61 fn apply_add<I : Instance<X>>(&self, y : &mut Y, x : I){ |
60 self.gemv(y, 1.0, x, 1.0) |
62 self.gemv(y, 1.0, x, 1.0) |
61 } |
63 } |
62 } |
64 } |