Class ManhattanDistance

  • All Implemented Interfaces:
    org.api4.java.common.math.IMetric<double[]>, IDistanceMetric

    public class ManhattanDistance
    extends java.lang.Object
    implements IDistanceMetric
    Implementation of the Manhattan distance for time series. The Manhattan distance for two time series A and B of length n is defined as \sum_{i=0}^{n} |A_i - B_i|. Therefore, it is required for A and B to be of the same length.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double distance​(double[] a, double[] b)
      Calculates the distance between two time series.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ManhattanDistance

        public ManhattanDistance()
    • Method Detail

      • distance

        public double distance​(double[] a,
                               double[] b)
        Description copied from interface: IDistanceMetric
        Calculates the distance between two time series.
        Specified by:
        distance in interface IDistanceMetric
        Parameters:
        a - First time series.
        b - Second time series.
        Returns:
        Distance between the first and second time series.