Class VectorNorm.Linf

java.lang.Object
imagingbook.common.math.VectorNorm
imagingbook.common.math.VectorNorm.Linf
Enclosing class:
VectorNorm

public static class VectorNorm.Linf extends VectorNorm
Implementation of the L-infinity vector norm (maximum norm/distance). This class defines no public constructor, use method getInstance() to retrieve the associated (singleton) instance.
  • Nested Class Summary

    Nested classes/interfaces inherited from class imagingbook.common.math.VectorNorm

    VectorNorm.L1, VectorNorm.L2, VectorNorm.Linf, VectorNorm.NormType
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    distance(double[] a, double[] b)
    Returns the distance between two double[] vectors under this norm.
    double
    distance(float[] a, float[] b)
    Returns the distance between two float[] vectors under this norm.
    double
    distance(int[] a, int[] b)
    Returns the distance between two int[] vectors under this norm.
    double
    distance2(double[] a, double[] b)
    Returns the squared distance between two double[] vectors under this norm.
    double
    distance2(float[] a, float[] b)
    Returns the squared distance between two float[] vectors under this norm.
    double
    distance2(int[] a, int[] b)
    Returns the squared distance between two int[] vectors under this norm.
    Returns an instance of this specific VectorNorm type.
    double
    getScale(int n)
    Returns a factor to scale magnitude and distance values to the range of the vector components of dimensionality n.
    double
    magnitude(double[] a)
    Returns the magnitude of the specified double[] vector under this norm.
    double
    magnitude(float[] a)
    Returns the magnitude of the specified float[] vector under this norm.
    double
    magnitude(int[] a)
    Returns the magnitude of the specified int[] vector under this norm.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstance

      public static VectorNorm.Linf getInstance()
      Returns an instance of this specific VectorNorm type.
      Returns:
      a VectorNorm instance
    • magnitude

      public double magnitude(double[] a)
      Description copied from class: VectorNorm
      Returns the magnitude of the specified double[] vector under this norm.
      Specified by:
      magnitude in class VectorNorm
      Parameters:
      a - a vector
      Returns:
      the magnitude of the vector
    • magnitude

      public double magnitude(float[] a)
      Description copied from class: VectorNorm
      Returns the magnitude of the specified float[] vector under this norm.
      Specified by:
      magnitude in class VectorNorm
      Parameters:
      a - a vector
      Returns:
      the magnitude of the vector
    • magnitude

      public double magnitude(int[] a)
      Description copied from class: VectorNorm
      Returns the magnitude of the specified int[] vector under this norm.
      Specified by:
      magnitude in class VectorNorm
      Parameters:
      a - a vector
      Returns:
      the magnitude of the vector
    • distance

      public double distance(double[] a, double[] b)
      Description copied from class: VectorNorm
      Returns the distance between two double[] vectors under this norm.
      Specified by:
      distance in class VectorNorm
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the distance between vectors a and b
    • distance2

      public double distance2(double[] a, double[] b)
      Description copied from class: VectorNorm
      Returns the squared distance between two double[] vectors under this norm.
      Specified by:
      distance2 in class VectorNorm
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the distance between vectors a and b
    • distance

      public double distance(int[] a, int[] b)
      Description copied from class: VectorNorm
      Returns the distance between two int[] vectors under this norm.
      Specified by:
      distance in class VectorNorm
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the distance between vectors a and b
    • distance2

      public double distance2(int[] a, int[] b)
      Description copied from class: VectorNorm
      Returns the squared distance between two int[] vectors under this norm.
      Specified by:
      distance2 in class VectorNorm
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the distance between vectors a and b
    • distance2

      public double distance2(float[] a, float[] b)
      Description copied from class: VectorNorm
      Returns the squared distance between two float[] vectors under this norm.
      Specified by:
      distance2 in class VectorNorm
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the distance between vectors a and b
    • distance

      public double distance(float[] a, float[] b)
      Description copied from class: VectorNorm
      Returns the distance between two float[] vectors under this norm.
      Specified by:
      distance in class VectorNorm
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the distance between vectors a and b
    • getScale

      public double getScale(int n)
      Description copied from class: VectorNorm
      Returns a factor to scale magnitude and distance values to the range of the vector components of dimensionality n. This is prim. used for scaling color distances (n = 3). E.g., if components are distributed in [0,255], the distances multiplied by this factor should again be in [0,255].
      Specified by:
      getScale in class VectorNorm
      Parameters:
      n - dimensionality
      Returns:
      scale factor