de.lmu.ifi.dbs.elki.distance.distancefunction
Class LPNormDistanceFunction

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.LPNormDistanceFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable
Direct Known Subclasses:
EuclideanDistanceFunction, ManhattanDistanceFunction, MaximumDistanceFunction, WeightedLPNormDistanceFunction

public class LPNormDistanceFunction
extends AbstractVectorDoubleDistanceFunction

Provides a LP-Norm for FeatureVectors.


Nested Class Summary
static class LPNormDistanceFunction.Parameterizer
          Parameterization class.
 
Field Summary
private  double p
          Keeps the currently set p.
static OptionID P_ID
          OptionID for the "p" parameter
 
Constructor Summary
LPNormDistanceFunction(double p)
          Constructor, internal version.
 
Method Summary
 double doubleDistance(NumberVector<?,?> v1, NumberVector<?,?> v2)
          Returns the distance between the specified FeatureVectors as a LP-Norm for the currently set p.
 boolean equals(Object obj)
           
 double getP()
          Get the functions p parameter.
 boolean isMetric()
          Is this distance function metric (in particular, does it satisfy the triangle equation?)
 String toString()
           
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
distance, getDistanceFactory, getInputTypeRestriction
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction
instantiate, isSymmetric
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
instantiate, isSymmetric
 

Field Detail

P_ID

public static final OptionID P_ID
OptionID for the "p" parameter


p

private double p
Keeps the currently set p.

Constructor Detail

LPNormDistanceFunction

public LPNormDistanceFunction(double p)
Constructor, internal version.

Parameters:
p - Parameter p
Method Detail

doubleDistance

public double doubleDistance(NumberVector<?,?> v1,
                             NumberVector<?,?> v2)
Returns the distance between the specified FeatureVectors as a LP-Norm for the currently set p.

Parameters:
v1 - first FeatureVector
v2 - second FeatureVector
Returns:
the distance between the specified FeatureVectors as a LP-Norm for the currently set p

getP

public double getP()
Get the functions p parameter.

Returns:
p

isMetric

public boolean isMetric()
Description copied from interface: DistanceFunction
Is this distance function metric (in particular, does it satisfy the triangle equation?)

Specified by:
isMetric in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
Overrides:
isMetric in class AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Returns:
true when metric.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

Release 0.4.0 (2011-09-20_1324)