Ignite - In-Memory Database and Caching Platform
org.apache.ignite.ml.math.distances

Class EuclideanDistance

• Constructor Summary

Constructors
Constructor and Description
`EuclideanDistance()`
• Method Summary

All Methods
Modifier and Type Method and Description
`double` ```compute(Vector a, double[] b)```
Compute the distance between n-dimensional vector and n-dimensional array.
`double` ```compute(Vector a, Vector b)```
Compute the distance between two n-dimensional vectors.
`boolean` `equals(Object obj)`
`int` `hashCode()`
`void` `readExternal(ObjectInput in)`
`void` `writeExternal(ObjectOutput out)`
• Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• EuclideanDistance

`public EuclideanDistance()`
• Method Detail

• compute

```public double compute(Vector a,
Vector b)
throws CardinalityException```
Compute the distance between two n-dimensional vectors.

The two vectors are required to have the same dimension.

Specified by:
`compute` in interface `DistanceMeasure`
Parameters:
`a` - The first vector.
`b` - The second vector.
Returns:
The distance between the two vectors.
Throws:
`CardinalityException` - if the array lengths differ.
• compute

```public double compute(Vector a,
double[] b)
throws CardinalityException```
Compute the distance between n-dimensional vector and n-dimensional array.

The two data structures are required to have the same dimension.

Specified by:
`compute` in interface `DistanceMeasure`
Parameters:
`a` - The vector.
`b` - The array.
Returns:
The distance between vector and array.
Throws:
`CardinalityException` - if the data structures lengths differ.
• writeExternal

```public void writeExternal(ObjectOutput out)
throws IOException```
Specified by:
`writeExternal` in interface `Externalizable`
Throws:
`IOException`

```public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException```
Specified by:
`readExternal` in interface `Externalizable`
Throws:
`IOException`
`ClassNotFoundException`
• equals

`public boolean equals(Object obj)`
Overrides:
`equals` in class `Object`
• hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`