at.tuwien.ifs.somtoolbox.layers.metrics
Class L2MetricFast
java.lang.Object
at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
at.tuwien.ifs.somtoolbox.layers.metrics.L2Metric
at.tuwien.ifs.somtoolbox.layers.metrics.L2MetricFast
- All Implemented Interfaces:
- DistanceMetric, Comparable<DistanceMetric>
public class L2MetricFast
- extends L2Metric
Implements a fast version of the L2 or Euclidean metric, by not taking the square root. Thus, this implementation
should be used only when the ranking of distances is important, and the total distance value does not matter.
- Version:
- $Id: L2MetricFast.java 3583 2010-05-21 10:07:41Z mayer $
- Author:
- Rudolf Mayer
Method Summary |
double |
distance(double[] vector1,
double[] vector2)
Calculates the distance between two vectors provided by argument vector1 and vector2 . |
String |
toString()
|
Methods inherited from class at.tuwien.ifs.somtoolbox.layers.metrics.L2Metric |
main, norm |
Methods inherited from class at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric |
checkDimensions, checkDimensions, compareTo, distance, distance, distance, distance, distance, distance, distance, distance, instantiate, instantiateNice, meanVector, performanceTest, setMetricParams, transformValue, transformVector |
Methods inherited from interface at.tuwien.ifs.somtoolbox.layers.metrics.DistanceMetric |
distance, distance, distance, distance, distance, distance, distance, distance, setMetricParams, transformValue, transformVector |
L2MetricFast
public L2MetricFast()
distance
public double distance(double[] vector1,
double[] vector2)
throws MetricException
- Description copied from interface:
DistanceMetric
- Calculates the distance between two vectors provided by argument
vector1
and vector2
. A
MetricException
is thrown, if the dimensionalities of the two vectors differ.
- Specified by:
distance
in interface DistanceMetric
- Overrides:
distance
in class L2Metric
- Parameters:
vector1
- first vector.vector2
- second vector.
- Returns:
- the distance between
vector1
and vector2
.
- Throws:
MetricException
- if the dimensionalities of the two vectors differ.- See Also:
DistanceMetric.distance(double[], double[])
toString
public String toString()
- Overrides:
toString
in class L2Metric