be.hogent.tarsos.lsh.families
Class CityBlockDistance

java.lang.Object
  extended by be.hogent.tarsos.lsh.families.CityBlockDistance
All Implemented Interfaces:
DistanceMeasure

public class CityBlockDistance
extends java.lang.Object
implements DistanceMeasure

This distance measure calculates the city block distance between two vectors. This distance metric also known as the Manhattan distance or L1 distance. Wikipedia calls it "Taxicab geometry":

Taxicab geometry, considered by Hermann Minkowski in the 19th century, is a form of geometry in which the usual distance function or metric of Euclidean geometry is replaced by a new metric in which the distance between two points is the sum of the absolute differences of their coordinates. The taxicab metric is also known as rectilinear distance, L1 distance or norm (see Lp space), city block distance, Manhattan distance, or Manhattan length, with corresponding variations in the name of the geometry. The latter names allude to the grid layout of most streets on the island of Manhattan, which causes the shortest path a car could take between two intersections in the borough to have length equal to the intersections' distance in taxicab geometry.

Author:
Joren Six

Constructor Summary
CityBlockDistance()
           
 
Method Summary
 double distance(Vector one, Vector other)
          Calculate the distance between two vectors.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CityBlockDistance

public CityBlockDistance()
Method Detail

distance

public double distance(Vector one,
                       Vector other)
Description copied from interface: DistanceMeasure
Calculate the distance between two vectors. From one to two.

Specified by:
distance in interface DistanceMeasure
Parameters:
one - The first vector.
other - The other vector
Returns:
A value representing the distance between two vectors.