at.tuwien.ifs.somtoolbox.layers.metrics
Class LnMetric

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
      extended by at.tuwien.ifs.somtoolbox.layers.metrics.LnMetric
All Implemented Interfaces:
DistanceMetric, Comparable<DistanceMetric>

public class LnMetric
extends AbstractMetric
implements DistanceMetric

Generic Ln metric. L1 and L2 metrics are still implemented in seperate classes for performance reasons.

Version:
$Id: LnMetric.java 3883 2010-11-02 17:13:23Z frank $
Author:
Rudolf Mayer

Nested Class Summary
(package private)  class LnMetric.LnMetricMatrix
           
 
Nested classes/interfaces inherited from interface at.tuwien.ifs.somtoolbox.layers.metrics.DistanceMetric
DistanceMetric.SparcseMetricModes
 
Field Summary
private  LnMetric.LnMetricMatrix LN_METRIC_MATRIX
           
private  double n
           
private  double root
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
PACKAGE_NAME
 
Constructor Summary
LnMetric(double power)
           
 
Method Summary
 double distance(double[] vector1, double[] vector2)
          Calculates the distance between two vectors provided by argument vector1 and vector2.
 double distance(cern.colt.matrix.DoubleMatrix1D vector1, cern.colt.matrix.DoubleMatrix1D 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.AbstractMetric
checkDimensions, checkDimensions, compareTo, distance, distance, distance, distance, distance, distance, distance, instantiate, instantiateNice, meanVector, performanceTest, setMetricParams, transformValue, transformVector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface at.tuwien.ifs.somtoolbox.layers.metrics.DistanceMetric
distance, distance, distance, distance, distance, distance, distance, setMetricParams, transformValue, transformVector
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

LN_METRIC_MATRIX

private final LnMetric.LnMetricMatrix LN_METRIC_MATRIX

n

private double n

root

private double root
Constructor Detail

LnMetric

public LnMetric(double power)
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 String toString()
Overrides:
toString in class Object

distance

public double distance(cern.colt.matrix.DoubleMatrix1D vector1,
                       cern.colt.matrix.DoubleMatrix1D 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 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(cern.colt.matrix.DoubleMatrix1D, cern.colt.matrix.DoubleMatrix1D)