Interface Metric<T>

All Known Implementing Classes:
ChebyshevMetric, CosineMetric, EuclideanMetric, MahalanobisMetric, ManhattanMetric, MinkowskiMetric

public interface Metric<T>
Represents a metric (distance function).

A metric must satisfy:

  • Non-negativity: d(x,y) ≥ 0
  • Identity: d(x,y) = 0 ⟺ x = y
  • Symmetry: d(x,y) = d(y,x)
  • Triangle inequality: d(x,z) ≤ d(x,y) + d(y,z)

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Summary

    Modifier and Type
    Method
    Description
    distance(T a, T b)
    Computes the distance between two objects.
  • Method Details

    • distance

      Real distance(T a, T b)
      Computes the distance between two objects.
      Parameters:
      a - the first object
      b - the second object
      Returns:
      the distance between a and b (always non-negative)