pub fn chebyshev<T: Number>(x: &[T], y: &[T]) -> T
Expand description
Chebyshev distance between two vectors.
Also known as the L∞-norm, the Chebyshev distance is defined as the maximum absolute difference between the corresponding elements of the two vectors.
See the crate::vectors
module documentation for information on this
function’s potentially unexpected behaviors
§Arguments
x
- The first slice ofNumber
s.y
- The second slice ofNumber
s.
§Examples
use distances::vectors::chebyshev;
let x: Vec<f64> = vec![1.0, 2.0, 3.0];
let y: Vec<f64> = vec![6.0, 5.0, 4.0];
let distance: f64 = chebyshev(&x, &y);
assert!((distance - 5.0).abs() <= f64::EPSILON);