|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.matrix.TaxicabDistance
public class TaxicabDistance
The TaxicabDistance class implements standard taxicab,
or Manhattan distance between vectors. The taxicab distance forms
a metric. The taxicab distance is often called the
L1 distance, 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
v1 and v2 is:
withdistance(v1,v2) = Σi abs(v1[i] - v2[i])
v1[i] standing for the method call
v1.value(i) and i ranging 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:
| Field Summary | |
|---|---|
static TaxicabDistance |
DISTANCE
The taxicab distance. |
| Constructor Summary | |
|---|---|
TaxicabDistance()
Construct a new taxicab distance. |
|
| Method Summary | |
|---|---|
double |
distance(Vector v1,
Vector v2)
Returns the taxicab distance between the specified pair of vectors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final TaxicabDistance DISTANCE
| Constructor Detail |
|---|
public TaxicabDistance()
| Method Detail |
|---|
public double distance(Vector v1,
Vector v2)
distance in interface Distance<Vector>v1 - First vector.v2 - Second vector.
IllegalArgumentException - If the vectors are not of the
same dimensionality.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||