cc.mallet.types
Class Minkowski

java.lang.Object
  extended by cc.mallet.types.Minkowski
All Implemented Interfaces:
Metric

public class Minkowski
extends java.lang.Object
implements Metric


Constructor Summary
Minkowski(double q)
          Constructor for Minkowski metric.
 
Method Summary
 double distance(SparseVector a, SparseVector b)
          Gives the Minkowski distance between two vectors.
 double euclideanDistance(SparseVector a, SparseVector b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Minkowski

public Minkowski(double q)
Constructor for Minkowski metric.

Parameters:
q - Power of component wise absolute difference; must be at least 1
Method Detail

distance

public double distance(SparseVector a,
                       SparseVector b)
Gives the Minkowski distance between two vectors. distance(x,y) := \left( \Sum_i=0^d-1 \left| x_i - y_i \right|^q \right)^\frac{1}{q} for 1<=q
Specified by:
distance in interface Metric

euclideanDistance

public double euclideanDistance(SparseVector a,
                                SparseVector b)