| 213 }) |
213 }) |
| 214 } |
214 } |
| 215 |
215 |
| 216 // TODO: should allow different input storages in `Euclidean`. |
216 // TODO: should allow different input storages in `Euclidean`. |
| 217 |
217 |
| 218 impl<E, M, S> Euclidean<E> for Vector<E, M, S> |
218 impl<E, M, S> Euclidean for Vector<E, M, S> |
| 219 where |
219 where |
| 220 M: Dim, |
220 M: Dim, |
| 221 S: StorageMut<E, M> + Clone, |
221 S: StorageMut<E, M> + Clone, |
| 222 E: Float + Scalar + Zero + One + RealField, |
222 E: Float + Scalar + Zero + One + RealField, |
| 223 DefaultAllocator: Allocator<M>, |
223 DefaultAllocator: Allocator<M>, |
| 224 { |
224 { |
| 225 type Output = OVector<E, M>; |
|
| 226 |
|
| 227 #[inline] |
225 #[inline] |
| 228 fn dot<I: Instance<Self>>(&self, other: I) -> E { |
226 fn dot<I: Instance<Self>>(&self, other: I) -> E { |
| 229 Vector::<E, M, S>::dot(self, other.ref_instance()) |
227 Vector::<E, M, S>::dot(self, other.ref_instance()) |
| 230 } |
228 } |
| 231 |
229 |
| 238 fn dist2_squared<I: Instance<Self>>(&self, other: I) -> E { |
236 fn dist2_squared<I: Instance<Self>>(&self, other: I) -> E { |
| 239 metric_distance_squared(self, other.ref_instance()) |
237 metric_distance_squared(self, other.ref_instance()) |
| 240 } |
238 } |
| 241 } |
239 } |
| 242 |
240 |
| 243 impl<E, M, S> StaticEuclidean<E> for Vector<E, M, S> |
241 impl<E, M, S> StaticEuclidean for Vector<E, M, S> |
| 244 where |
242 where |
| 245 M: DimName, |
243 M: DimName, |
| 246 S: StorageMut<E, M> + Clone, |
244 S: StorageMut<E, M> + Clone, |
| 247 E: Float + Scalar + Zero + One + RealField, |
245 E: Float + Scalar + Zero + One + RealField, |
| 248 DefaultAllocator: Allocator<M>, |
246 DefaultAllocator: Allocator<M>, |