smile.math.distance.Distance Maven / Gradle / Ivy
/******************************************************************************
* Confidential Proprietary *
* (c) Copyright Haifeng Li 2011, All Rights Reserved *
******************************************************************************/
package smile.math.distance;
/**
* An interface to calculate a distance measure between two objects. A distance
* function maps pairs of points into the nonnegative reals and has to satisfy
*
* - non-negativity: d(x, y) ≥ 0
*
- isolation: d(x, y) = 0 if and only if x = y
*
- symmetry: d(x, y) = d(x, y)
*
.
* Note that a distance function is not required to satisfy triangular inequality
* |x - y| + |y - z| ≥ |x - z|, which is necessary for a metric.
*
* @author Haifeng Li
*/
public interface Distance {
/**
* Returns the distance measure between two objects.
*/
public double d(T x, T y);
}