public class TaxicabDistance extends Object implements Distance<Vector>, Serializable
TaxicabDistanceclass implements standard taxicab, or Manhattan distance between vectors. The taxicab distance forms a metric. The taxicab distance is often called the
L1distance, because it is 1-norm Minkowski distance after the inventor of the general family of vector distance metrics and related geometries.
The definition of the taxicab distance over vectors
withdistance(v1,v2) = Σi abs(v1[i] - v2[i])
v1[i]standing for the method call
iranging over the dimensions of the vectors, which must be the same.
An understandable explanation of the taxicab distance and related distances may be found at:
|Modifier and Type||Field and Description|
The taxicab distance.
|Constructor and Description|
Construct a new taxicab distance.
|Modifier and Type||Method and Description|
Returns the taxicab distance between the specified pair of vectors.
public static final TaxicabDistance DISTANCE