org.apache.commons.math3.ml.distance
Class ManhattanDistance
java.lang.Object
org.apache.commons.math3.ml.distance.ManhattanDistance
- All Implemented Interfaces:
- Serializable, DistanceMeasure
public class ManhattanDistance
- extends Object
- implements DistanceMeasure
Calculates the L1 (sum of abs) distance between two points.
- Since:
- 3.2
- Version:
- $Id $
- See Also:
- Serialized Form
Field Summary |
private static long |
serialVersionUID
Serializable version identifier. |
Method Summary |
double |
compute(double[] a,
double[] b)
Compute the distance between two n-dimensional vectors. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- Serializable version identifier.
- See Also:
- Constant Field Values
ManhattanDistance
public ManhattanDistance()
compute
public double compute(double[] a,
double[] b)
- Compute the distance between two n-dimensional vectors.
The two vectors are required to have the same dimension.
- Specified by:
compute
in interface DistanceMeasure
- Parameters:
a
- the first vectorb
- the second vector
- Returns:
- the distance between the two vectors
Copyright (c) 2003-2013 Apache Software Foundation