sbrt.kernel.math.geom.comp
Class EuclideanDist

java.lang.Object
  extended by sbrt.kernel.math.geom.comp.EuclideanDist

public final class EuclideanDist
extends java.lang.Object

This class is used to compute Euclidean distances. All provided numbers are converted to double precision via the method Number.doubleValue().

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
EuclideanDist()
           
 
Method Summary
 double getDist(java.util.Collection<? extends java.lang.Number> x, java.util.Collection<? extends java.lang.Number> y)
          Computes and returns the Euclidean distance between the provided collections.
 double getDist(java.util.Map<?,? extends java.lang.Number> x, java.util.Map<?,? extends java.lang.Number> y)
          Computes and returns the Euclidean distance between the provided maps.
 double getDist(java.lang.Number[] x, java.lang.Number[] y)
          Computes and returns the Euclidean distance between the provided arrays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EuclideanDist

public EuclideanDist()
Method Detail

getDist

public double getDist(java.lang.Number[] x,
                      java.lang.Number[] y)
Computes and returns the Euclidean distance between the provided arrays.

Parameters:
x - an array of numbers.
y - another array of numbers.
Returns:
the Euclidean distance between the provided arrays.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided arrays are not equal.

getDist

public double getDist(java.util.Collection<? extends java.lang.Number> x,
                      java.util.Collection<? extends java.lang.Number> y)
Computes and returns the Euclidean distance between the provided collections. Numbers are compared upon iteration over each collection.

Parameters:
x - a collection of numbers.
y - another collection of numbers.
Returns:
the Euclidean distance between the provided collections.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided collections are not equal.

getDist

public double getDist(java.util.Map<?,? extends java.lang.Number> x,
                      java.util.Map<?,? extends java.lang.Number> y)
Computes and returns the Euclidean distance between the provided maps. The sets of keys from each map must be equal.

Parameters:
x - a map.
y - another map.
Returns:
the Euclidean distance between the provided maps.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided maps or the key sets are not equal.