org.jscience.mathematics.geometry
Class MinkowskiMetric

java.lang.Object
  extended by org.jscience.mathematics.geometry.MinkowskiMetric
All Implemented Interfaces:
Metric

public final class MinkowskiMetric
extends java.lang.Object
implements Metric

This class provides an implementation for Metric, using the Minkowski metric. Minkowski Metric, also known as the L_p norm. Special cases include the Manhatten city-block distance with q=1 and the Euclidean distance with q=2. The special case with q equal to positive infinity is supported.


Constructor Summary
MinkowskiMetric(double q)
          Constructor for Minkowski metric.
 
Method Summary
 ComparableNumber getDistance(Vector a, Vector b)
          DOCUMENT ME!
 double getQParameter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinkowskiMetric

public MinkowskiMetric(double q)
Constructor for Minkowski metric.

Parameters:
q - Power of component wise absolute difference; must be at least 1
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!
Method Detail

getQParameter

public double getQParameter()

getDistance

public ComparableNumber getDistance(Vector a,
                                    Vector b)
Description copied from interface: Metric
DOCUMENT ME!

Specified by:
getDistance in interface Metric
Parameters:
a - DOCUMENT ME!
b - DOCUMENT ME!
Returns:
DOCUMENT ME!