Class VALPNormDistance


  • public class VALPNormDistance
    extends java.lang.Object
    Lp-Norm distance function for partially computed objects.
    Since:
    0.5.0
    Author:
    Erich Schubert
    • Field Detail

      • onebyp

        private final double onebyp
        Value of 1/p for lP norm.
      • lookup

        private double[][] lookup
        Lookup table for grid cells.
    • Constructor Detail

      • VALPNormDistance

        public VALPNormDistance​(double p,
                                double[][] splitPositions,
                                NumberVector query,
                                VectorApproximation queryApprox)
        Constructor.
        Parameters:
        p - Value of p
        splitPositions - Split positions
        query - Query vector
        queryApprox - Query approximation
    • Method Detail

      • getPartialMinDist

        public double getPartialMinDist​(int dimension,
                                        int vp)
        Get the minimum distance contribution of a single dimension.
        Parameters:
        dimension - Dimension
        vp - Vector position
        Returns:
        Increment
      • getMinDist

        public double getMinDist​(VectorApproximation vec)
        Get the minimum distance to approximated vector vec.
        Parameters:
        vec - Vector approximation
        Returns:
        Minimum distance
      • getPartialMaxDist

        public double getPartialMaxDist​(int dimension,
                                        int vp)
        Get the maximum distance contribution of a single dimension.
        Parameters:
        dimension - Dimension
        vp - Vector position
        Returns:
        Increment
      • getMaxDist

        public double getMaxDist​(VectorApproximation vec)
        Get the maximum distance.
        Parameters:
        vec - Approximation vector
        Returns:
        Maximum distance of the vector
      • getPartialMaxMaxDist

        public double getPartialMaxMaxDist​(int dimension)
        Get the maximum distance.
        Parameters:
        dimension - Dimension
        Returns:
        Maximum distance in the given dimension
      • initializeLookupTable

        private void initializeLookupTable​(double[][] splitPositions,
                                           NumberVector query,
                                           double p)
        Initialize the lookup table.
        Parameters:
        splitPositions - Split positions
        query - Query vector
        p - p