Class DefaultVectorUtilSupport

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float cosine​(byte[] a, byte[] b)
      Returns the cosine similarity between the two byte vectors.
      float cosine​(float[] a, float[] b)
      Returns the cosine similarity between the two vectors.
      int dotProduct​(byte[] a, byte[] b)
      Returns the dot product computed over signed bytes.
      float dotProduct​(float[] a, float[] b)
      Calculates the dot product of the given float arrays.
      private static float fma​(float a, float b, float c)  
      int squareDistance​(byte[] a, byte[] b)
      Returns the sum of squared differences of the two byte vectors.
      float squareDistance​(float[] a, float[] b)
      Returns the sum of squared differences of the two vectors.
      • Methods inherited from class java.lang.Object

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

      • DefaultVectorUtilSupport

        DefaultVectorUtilSupport()
    • Method Detail

      • fma

        private static float fma​(float a,
                                 float b,
                                 float c)
      • dotProduct

        public float dotProduct​(float[] a,
                                float[] b)
        Description copied from interface: VectorUtilSupport
        Calculates the dot product of the given float arrays.
        Specified by:
        dotProduct in interface VectorUtilSupport
      • cosine

        public float cosine​(float[] a,
                            float[] b)
        Description copied from interface: VectorUtilSupport
        Returns the cosine similarity between the two vectors.
        Specified by:
        cosine in interface VectorUtilSupport
      • squareDistance

        public float squareDistance​(float[] a,
                                    float[] b)
        Description copied from interface: VectorUtilSupport
        Returns the sum of squared differences of the two vectors.
        Specified by:
        squareDistance in interface VectorUtilSupport
      • dotProduct

        public int dotProduct​(byte[] a,
                              byte[] b)
        Description copied from interface: VectorUtilSupport
        Returns the dot product computed over signed bytes.
        Specified by:
        dotProduct in interface VectorUtilSupport
      • cosine

        public float cosine​(byte[] a,
                            byte[] b)
        Description copied from interface: VectorUtilSupport
        Returns the cosine similarity between the two byte vectors.
        Specified by:
        cosine in interface VectorUtilSupport
      • squareDistance

        public int squareDistance​(byte[] a,
                                  byte[] b)
        Description copied from interface: VectorUtilSupport
        Returns the sum of squared differences of the two byte vectors.
        Specified by:
        squareDistance in interface VectorUtilSupport