|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.matrix.EuclideanDistance
public class EuclideanDistance
The EuclideanDistance class implements standard
Euclidean distance between vectors. Euclidean distance forms a
metric. Euclidean distance is often called the
L2 distance, because it is 2-norm Minkowski
distance.
The definition of Euclidean distance over vectors
v1 and v2 is:
withdistance(v1,v2) = sqrt(Σi (v1[i] - v2[i])2 )
v1[i] standing for the method call
v1.value(i) and i ranging over the
dimensions of the vectors, which must be the same.
Note that the Euclidean distance is equivalent to the
Minkowski distance metric of order 2. See the class
documentation for MinkowskiDistance for more information.
An understandable explanation of Euclidean and related distances may be found at:
| Field Summary | |
|---|---|
static EuclideanDistance |
DISTANCE
The Euclidean distance. |
| Constructor Summary | |
|---|---|
EuclideanDistance()
Construct a new Euclidean distance. |
|
| Method Summary | |
|---|---|
double |
distance(Vector v1,
Vector v2)
Returns the Euclidean 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 EuclideanDistance DISTANCE
| Constructor Detail |
|---|
public EuclideanDistance()
| 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 | ||||||||