at.tuwien.ifs.feature.extraction.audio.distance
Class L1Metric

java.lang.Object
  extended by at.tuwien.ifs.feature.extraction.audio.distance.AbstractMetric
      extended by at.tuwien.ifs.feature.extraction.audio.distance.L1Metric
All Implemented Interfaces:
DistanceMetric

public class L1Metric
extends AbstractMetric
implements DistanceMetric

Implements the L1 or city block metric. Though this class could use at.ec3.somtoolbox.layers.metrics.LNMetric, for performance issues this less complex computation should be used.

Version:
$Id: L1Metric.java 167 2010-06-17 10:12:01Z frank $
Author:
mbach

Constructor Summary
L1Metric()
           
 
Method Summary
 double distance(double[] vector1, double[] vector2)
          Calculates the distance between two vectors provided by argument vector1 and vector2.
 java.lang.String toString()
           
 
Methods inherited from class at.tuwien.ifs.feature.extraction.audio.distance.AbstractMetric
checkDimensions, instantiate, meanVector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

L1Metric

public L1Metric()
Method Detail

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
Specified by:
distance in class AbstractMetric
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 java.lang.String toString()
Overrides:
toString in class java.lang.Object