| 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 #[inline] |
225 #[inline] |
| 226 fn dot<I: Instance<Self>>(&self, other: I) -> E { |
226 fn dot<I: Instance<Self>>(&self, other: I) -> E { |
| 227 other.eval_ref_decompose(|r| Vector::<E, M, S>::dot(self, r)) |
227 other.eval(|r| Vector::<E, M, S>::dot(self, r)) |
| 228 } |
228 } |
| 229 |
229 |
| 230 #[inline] |
230 #[inline] |
| 231 fn norm2_squared(&self) -> E { |
231 fn norm2_squared(&self) -> E { |
| 232 Vector::<E, M, S>::norm_squared(self) |
232 Vector::<E, M, S>::norm_squared(self) |
| 233 } |
233 } |
| 234 |
234 |
| 235 #[inline] |
235 #[inline] |
| 236 fn dist2_squared<I: Instance<Self>>(&self, other: I) -> E { |
236 fn dist2_squared<I: Instance<Self>>(&self, other: I) -> E { |
| 237 other.eval_ref_decompose(|r| metric_distance_squared(self, r)) |
237 other.eval(|r| metric_distance_squared(self, r)) |
| 238 } |
238 } |
| 239 } |
239 } |
| 240 |
240 |
| 241 impl<E, M, S> StaticEuclidean<E> for Vector<E, M, S> |
241 impl<E, M, S> StaticEuclidean<E> for Vector<E, M, S> |
| 242 where |
242 where |
| 303 E: Float + Scalar + Zero + One + RealField, |
303 E: Float + Scalar + Zero + One + RealField, |
| 304 DefaultAllocator: Allocator<M>, |
304 DefaultAllocator: Allocator<M>, |
| 305 { |
305 { |
| 306 #[inline] |
306 #[inline] |
| 307 fn dist<I: Instance<Self>>(&self, other: I, _: L1) -> E { |
307 fn dist<I: Instance<Self>>(&self, other: I, _: L1) -> E { |
| 308 other.eval_ref_decompose(|r| nalgebra::Norm::metric_distance(&LpNorm(1), self, r)) |
308 other.eval(|r| nalgebra::Norm::metric_distance(&LpNorm(1), self, r)) |
| 309 } |
309 } |
| 310 } |
310 } |
| 311 |
311 |
| 312 impl<E, M, S> Norm<L2, E> for Vector<E, M, S> |
312 impl<E, M, S> Norm<L2, E> for Vector<E, M, S> |
| 313 where |
313 where |
| 329 E: Float + Scalar + Zero + One + RealField, |
329 E: Float + Scalar + Zero + One + RealField, |
| 330 DefaultAllocator: Allocator<M>, |
330 DefaultAllocator: Allocator<M>, |
| 331 { |
331 { |
| 332 #[inline] |
332 #[inline] |
| 333 fn dist<I: Instance<Self>>(&self, other: I, _: L2) -> E { |
333 fn dist<I: Instance<Self>>(&self, other: I, _: L2) -> E { |
| 334 other.eval_ref_decompose(|r| nalgebra::Norm::metric_distance(&LpNorm(2), self, r)) |
334 other.eval(|r| nalgebra::Norm::metric_distance(&LpNorm(2), self, r)) |
| 335 } |
335 } |
| 336 } |
336 } |
| 337 |
337 |
| 338 impl<E, M, S> Norm<Linfinity, E> for Vector<E, M, S> |
338 impl<E, M, S> Norm<Linfinity, E> for Vector<E, M, S> |
| 339 where |
339 where |
| 355 E: Float + Scalar + Zero + One + RealField, |
355 E: Float + Scalar + Zero + One + RealField, |
| 356 DefaultAllocator: Allocator<M>, |
356 DefaultAllocator: Allocator<M>, |
| 357 { |
357 { |
| 358 #[inline] |
358 #[inline] |
| 359 fn dist<I: Instance<Self>>(&self, other: I, _: Linfinity) -> E { |
359 fn dist<I: Instance<Self>>(&self, other: I, _: Linfinity) -> E { |
| 360 other.eval_ref_decompose(|r| nalgebra::Norm::metric_distance(&UniformNorm, self, r)) |
360 other.eval(|r| nalgebra::Norm::metric_distance(&UniformNorm, self, r)) |
| 361 } |
361 } |
| 362 } |
362 } |
| 363 |
363 |
| 364 /// Helper trait to hide the symbols of [`nalgebra::RealField`]. |
364 /// Helper trait to hide the symbols of [`nalgebra::RealField`]. |
| 365 /// |
365 /// |