Class EncodedRealVector
- All Implemented Interfaces:
RealVector
-
Constructor Summary
ConstructorsConstructorDescriptionEncodedRealVector(int numExBits, int[] encoded, double fAddEx, double fRescaleEx, double fErrorEx) -
Method Summary
Modifier and TypeMethodDescriptiondouble[]computeData(int numExBits) intprotected byte[]computeRawData(int numExBits) final booleanstatic EncodedRealVectorfromBytes(byte[] vectorBytes, int numDimensions, int numExBits) doublegetAddEx()doublegetComponent(int dimension) Gets the component of this object at the specified dimension.double[]getData()Returns the underlying data array.intgetEncodedComponent(int dimension) int[]doubleintReturns the number of elements in the vector, i.e.byte[]Gets the raw byte data representation of this object.doubleinthashCode()Converts this vector into aDoubleRealVector.Converts this object into aRealVectorof single precision floating-point numbers.Converts this object into aRealVectorofHalfprecision floating-point numbers.withData(double[] data)
-
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
-
hashCode
public int hashCode() -
computeHashCode
public int computeHashCode() -
getNumDimensions
public int getNumDimensions()Description copied from interface:RealVectorReturns the number of elements in the vector, i.e. the number of dimensions.- Specified by:
getNumDimensionsin interfaceRealVector- Returns:
- the number of dimensions
-
getEncodedComponent
public int getEncodedComponent(int dimension) -
getComponent
public double getComponent(int dimension) Description copied from interface:RealVectorGets 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:
getComponentin interfaceRealVector- 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:RealVectorReturns 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:
getDatain interfaceRealVector- Returns:
- the data array of type
R[], nevernull.
-
withData
- Specified by:
withDatain interfaceRealVector
-
computeData
@Nonnull public double[] computeData(int numExBits) -
getRawData
@Nonnull public byte[] getRawData()Description copied from interface:RealVectorGets 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:
getRawDatain interfaceRealVector- Returns:
- a non-null byte array containing the raw data.
-
computeRawData
@Nonnull protected byte[] computeRawData(int numExBits) -
toHalfRealVector
Description copied from interface:RealVectorConverts this object into aRealVectorofHalfprecision 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
RealVectorusingHalfobjects to serialize and deserialize the vector. If this object already is aHalfRealVectorthis method should returnthis.- Specified by:
toHalfRealVectorin interfaceRealVector- Returns:
- a non-null
HalfRealVectorcontaining theHalfprecision floating-point representation of this object.
-
toFloatRealVector
Description copied from interface:RealVectorConverts this object into aRealVectorof 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
RealVectorusing floating point numbers to serialize and deserialize the vector. If this object already is aFloatRealVectorthis method should returnthis.- Specified by:
toFloatRealVectorin interfaceRealVector- Returns:
- a non-null
FloatRealVectorcontaining the single precision floating-point representation of this object.
-
toDoubleRealVector
Description copied from interface:RealVectorConverts this vector into aDoubleRealVector.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 newDoubleRealVectorcontaining the same elements, which may involve a conversion of the underlying data type.- Specified by:
toDoubleRealVectorin interfaceRealVector- Returns:
- a non-null
DoubleRealVectorrepresentation of this vector.
-
fromBytes
@Nonnull public static EncodedRealVector fromBytes(@Nonnull byte[] vectorBytes, int numDimensions, int numExBits)
-