Class EncodedRealVector

java.lang.Object
com.apple.foundationdb.rabitq.EncodedRealVector
All Implemented Interfaces:
RealVector

public class EncodedRealVector extends Object implements RealVector
  • Constructor Details

    • EncodedRealVector

      public EncodedRealVector(int numExBits, @Nonnull int[] encoded, double fAddEx, double fRescaleEx, double fErrorEx)
  • Method Details

    • getEncodedData

      @Nonnull public int[] getEncodedData()
    • getAddEx

      public double getAddEx()
    • getRescaleEx

      public double getRescaleEx()
    • getErrorEx

      public double getErrorEx()
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • computeHashCode

      public int computeHashCode()
    • getNumDimensions

      public int getNumDimensions()
      Description copied from interface: RealVector
      Returns the number of elements in the vector, i.e. the number of dimensions.
      Specified by:
      getNumDimensions in interface RealVector
      Returns:
      the number of dimensions
    • getEncodedComponent

      public int getEncodedComponent(int dimension)
    • getComponent

      public double getComponent(int dimension)
      Description copied from interface: RealVector
      Gets the component of this object at the specified dimension.

      The dimension is a zero-based index. For a 3D vector, for example, dimension 0 might correspond to the x-component, 1 to the y-component, and 2 to the z-component. This method provides direct access to the underlying data element.

      Specified by:
      getComponent in interface RealVector
      Parameters:
      dimension - the zero-based index of the component to retrieve.
      Returns:
      the component at the specified dimension, which is guaranteed to be non-null.
    • getData

      @Nonnull public double[] getData()
      Description copied from interface: RealVector
      Returns the underlying data array.

      The returned array is guaranteed to be non-null. Note that this method returns a direct reference to the internal array, not a copy.

      Specified by:
      getData in interface RealVector
      Returns:
      the data array of type R[], never null.
    • withData

      @Nonnull public RealVector withData(@Nonnull double[] data)
      Specified by:
      withData in interface RealVector
    • computeData

      @Nonnull public double[] computeData(int numExBits)
    • getRawData

      @Nonnull public byte[] getRawData()
      Description copied from interface: RealVector
      Gets the raw byte data representation of this object.

      This method provides a direct, unprocessed view of the object's underlying data. The format of the byte array is implementation-specific and should be documented by the concrete class that implements this method.

      Specified by:
      getRawData in interface RealVector
      Returns:
      a non-null byte array containing the raw data.
    • computeRawData

      @Nonnull protected byte[] computeRawData(int numExBits)
    • toHalfRealVector

      @Nonnull public HalfRealVector toHalfRealVector()
      Description copied from interface: RealVector
      Converts this object into a RealVector of Half precision floating-point numbers.

      As this is an abstract method, implementing classes are responsible for defining the specific conversion logic from their internal representation to a RealVector using Half objects to serialize and deserialize the vector. If this object already is a HalfRealVector this method should return this.

      Specified by:
      toHalfRealVector in interface RealVector
      Returns:
      a non-null HalfRealVector containing the Half precision floating-point representation of this object.
    • toFloatRealVector

      @Nonnull public FloatRealVector toFloatRealVector()
      Description copied from interface: RealVector
      Converts this object into a RealVector of single precision floating-point numbers.

      As this is an abstract method, implementing classes are responsible for defining the specific conversion logic from their internal representation to a RealVector using floating point numbers to serialize and deserialize the vector. If this object already is a FloatRealVector this method should return this.

      Specified by:
      toFloatRealVector in interface RealVector
      Returns:
      a non-null FloatRealVector containing the single precision floating-point representation of this object.
    • toDoubleRealVector

      @Nonnull public DoubleRealVector toDoubleRealVector()
      Description copied from interface: RealVector
      Converts this vector into a DoubleRealVector.

      This method provides a way to obtain a double-precision floating-point representation of the vector. If the vector is already an instance of DoubleRealVector, this method may return the instance itself. Otherwise, it will create a new DoubleRealVector containing the same elements, which may involve a conversion of the underlying data type.

      Specified by:
      toDoubleRealVector in interface RealVector
      Returns:
      a non-null DoubleRealVector representation of this vector.
    • fromBytes

      @Nonnull public static EncodedRealVector fromBytes(@Nonnull byte[] vectorBytes, int numDimensions, int numExBits)