## de.aitools.aq.algebra.vector.functions Class EuclideanDistance

```java.lang.Object de.aitools.aq.algebra.vector.functions.EuclideanDistance
```
All Implemented Interfaces:
Distance<Vector>, Proximity<Vector>

`public final class EuclideanDistanceextends java.lang.Objectimplements Distance<Vector>`

A `Distance` measure for `Vector`s.
The Euclidean Distance of two points is defined as the length of the segment between them. In the vector application, for each vector the point is taken that would be the position of a point translated from the origin by the vector.
It is calculated as the square root of the sum of the squared differences of each coordinate of the vectors.
If one vector is of a lower dimension (range) than the other vector, the missing dimensions of the vector will be treated as zero.
The `Proximity` of two vectors is computed as the negative distance. The normalized proximity is one minus the distance divided by the highest double value (Double.MAX_VALUE). And it is 0 if the distance would be infinite.

Version:
\$Id: EuclideanDistance.java,v 1.3 2011/02/24 17:48:08 dogu3912 Exp \$
Author:
johannes.kiesel(/\t)uni-weimar.de

Constructor Summary
`EuclideanDistance()`

Method Summary
` double` ```computeDistance(Vector v1, Vector v2)```
Compute a kind of distance between two objects.
` double` ```computeNormalizedProximity(Vector v1, Vector v2)```
Compute a kind of proximity between two objects.
The value returned by this method has to be between 0 (meaning they are as far away (according to the proximity measure) from each other as possible) and 1 (identical objects according to the proximity measure).
` double` ```computeProximity(Vector v1, Vector v2)```
Compute a kind of proximity between two objects.
` double` ```computeSquaredDistance(Vector v1, Vector v2)```

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EuclideanDistance

`public EuclideanDistance()`
Method Detail

### computeSquaredDistance

```public double computeSquaredDistance(Vector v1,
Vector v2)```
Parameters:
`v1` - First vector. To be compared to...
`v2` - ... the second vector
Returns:
The squared `EuclideanDistance` of the two vectors

### computeDistance

```public double computeDistance(Vector v1,
Vector v2)```
Description copied from interface: `Distance`
Compute a kind of distance between two objects. A higher value signals higher distance.

Specified by:
`computeDistance` in interface `Distance<Vector>`
Parameters:
`v1` - One object, to be compared to the...
`v2` - ...second object
Returns:
Computed distance

### computeProximity

```public double computeProximity(Vector v1,
Vector v2)```
Description copied from interface: `Proximity`
Compute a kind of proximity between two objects. A higher value signals higher proximity.

Specified by:
`computeProximity` in interface `Proximity<Vector>`
Parameters:
`v1` - One object, to be compared to the...
`v2` - ...second object
Returns:
Computed proximity

### computeNormalizedProximity

```public double computeNormalizedProximity(Vector v1,
Vector v2)```
Description copied from interface: `Proximity`
Compute a kind of proximity between two objects.
The value returned by this method has to be between 0 (meaning they are as far away (according to the proximity measure) from each other as possible) and 1 (identical objects according to the proximity measure).

Specified by:
`computeNormalizedProximity` in interface `Proximity<Vector>`
Parameters:
`v1` - One object, to be compared to the...
`v2` - ...second object
Returns:
Computed normalized proximity