org.finetracker
Class AvgSquareDist

java.lang.Object
  extended by org.finetracker.AvgSquareDist
All Implemented Interfaces:
DistanceCalculation

public class AvgSquareDist
extends java.lang.Object
implements DistanceCalculation

This class implements the normalized Euclidean distance calculation between two vectors.

Author:
Frank Kusters

Constructor Summary
AvgSquareDist()
           
 
Method Summary
 double calcDistance(double[] from, double[] to)
          Calculates the Euclidean distance between two vectors.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvgSquareDist

public AvgSquareDist()
Method Detail

calcDistance

public double calcDistance(double[] from,
                           double[] to)
Calculates the Euclidean distance between two vectors. The result is normalized to eliminate if an element is negative or NaN. Requires both vectors to be of equal length.

Specified by:
calcDistance in interface DistanceCalculation
Parameters:
from - the first vector
to - the second vector
Returns:
the distance
See Also:
DistanceCalculation.calcDistance(double[], double[])