| 87 |
87 |
| 88 impl<SM,SV1,M,E> AXPY<E, Vector<E,M,SV1>> for Vector<E,M,SM> |
88 impl<SM,SV1,M,E> AXPY<E, Vector<E,M,SV1>> for Vector<E,M,SM> |
| 89 where SM: StorageMut<E,M> + Clone, SV1: Storage<E,M> + Clone, |
89 where SM: StorageMut<E,M> + Clone, SV1: Storage<E,M> + Clone, |
| 90 M : Dim, E : Scalar + Zero + One + Float, |
90 M : Dim, E : Scalar + Zero + One + Float, |
| 91 DefaultAllocator : Allocator<M> { |
91 DefaultAllocator : Allocator<M> { |
| |
92 type Owned = OVector<E, M>; |
| 92 |
93 |
| 93 #[inline] |
94 #[inline] |
| 94 fn axpy<I : Instance<Vector<E,M,SV1>>>(&mut self, α : E, x : I, β : E) { |
95 fn axpy<I : Instance<Vector<E,M,SV1>>>(&mut self, α : E, x : I, β : E) { |
| 95 x.eval(|x̃| Matrix::axpy(self, α, x̃, β)) |
96 x.eval(|x̃| Matrix::axpy(self, α, x̃, β)) |
| 96 } |
97 } |
| 97 |
98 |
| 98 #[inline] |
99 #[inline] |
| 99 fn copy_from<I : Instance<Vector<E,M,SV1>>>(&mut self, y : I) { |
100 fn copy_from<I : Instance<Vector<E,M,SV1>>>(&mut self, y : I) { |
| 100 y.eval(|ỹ| Matrix::copy_from(self, ỹ)) |
101 y.eval(|ỹ| Matrix::copy_from(self, ỹ)) |
| |
102 } |
| |
103 |
| |
104 #[inline] |
| |
105 fn set_zero(&mut self) { |
| |
106 self.iter_mut().for_each(|e| *e = E::ZERO); |
| |
107 } |
| |
108 |
| |
109 #[inline] |
| |
110 fn similar_origin(&self) -> Self::Owned { |
| |
111 OVector::zeros_generic(M::from_usize(self.len()), Const) |
| 101 } |
112 } |
| 102 } |
113 } |
| 103 |
114 |
| 104 /* Implemented automatically as Euclidean. |
115 /* Implemented automatically as Euclidean. |
| 105 impl<SM,M,E> Projection<E, L2> for Vector<E,M,SM> |
116 impl<SM,M,E> Projection<E, L2> for Vector<E,M,SM> |
| 189 DefaultAllocator : Allocator<M> { |
200 DefaultAllocator : Allocator<M> { |
| 190 |
201 |
| 191 type Output = OVector<E, M>; |
202 type Output = OVector<E, M>; |
| 192 |
203 |
| 193 #[inline] |
204 #[inline] |
| 194 fn similar_origin(&self) -> OVector<E, M> { |
|
| 195 OVector::zeros_generic(M::from_usize(self.len()), Const) |
|
| 196 } |
|
| 197 |
|
| 198 #[inline] |
|
| 199 fn norm2_squared(&self) -> E { |
205 fn norm2_squared(&self) -> E { |
| 200 Vector::<E,M,S>::norm_squared(self) |
206 Vector::<E,M,S>::norm_squared(self) |
| 201 } |
207 } |
| 202 |
208 |
| 203 #[inline] |
209 #[inline] |