java.lang.Object
org.elasticsearch.index.codec.vectors.BQVectorUtils

public class BQVectorUtils extends Object
Utility class for vector quantization calculations
  • Constructor Details

    • BQVectorUtils

      public BQVectorUtils()
  • Method Details

    • sqrtNewtonRaphson

      public static double sqrtNewtonRaphson(double x, double curr, double prev)
    • constSqrt

      public static double constSqrt(double x)
    • isUnitVector

      public static boolean isUnitVector(float[] v)
    • packAsBinary

      public static void packAsBinary(byte[] vector, byte[] packed)
    • discretize

      public static int discretize(int value, int bucket)
    • pad

      public static float[] pad(float[] vector, int dimensions)
    • pad

      public static byte[] pad(byte[] vector, int dimensions)
    • popcount

      public static int popcount(byte[] d)
      Copied from Lucene, replace with Lucene's implementation sometime after Lucene 10
      Parameters:
      d - the byte array to count the number of set bits in
      Returns:
      count of flipped bits in the byte array
    • divideInPlace

      public static void divideInPlace(float[] a, float b)
    • subtract

      public static float[] subtract(float[] a, float[] b)
    • subtractInPlace

      public static void subtractInPlace(float[] target, float[] other)
    • norm

      public static float norm(float[] vector)