public class RawVector extends Object
This class encapsulates the binary representation of a vector along with metadata about its quantization type, normalization factor, and quantization range. The raw binary format allows for efficient storage and processing of vector data.
The VEMB command with RAW option returns the following data:
| Constructor and Description |
|---|
RawVector()
Creates a new empty raw vector.
|
RawVector(QuantizationType type,
ByteBuffer vector,
Double beforeNormalization,
Double quantizationRange)
Creates a new raw vector with the specified properties.
|
| Modifier and Type | Method and Description |
|---|---|
Double |
beforeNormalization()
Gets the L2 norm of the vector before normalization.
|
Double |
getQuantizationRange()
Gets the quantization range used for Q8 quantization.
|
QuantizationType |
getType()
Gets the quantization type used for storing the vector.
|
ByteBuffer |
getVector()
Gets the raw binary data of the vector.
|
public RawVector(QuantizationType type, ByteBuffer vector, Double beforeNormalization, Double quantizationRange)
type - the quantization type used for storing the vectorvector - the raw binary data of the vectorbeforeNormalization - the L2 norm of the vector before normalizationquantizationRange - the quantization range (only for Q8 quantization)public RawVector()
This constructor creates an empty raw vector object. The fields will be populated when the object is used to parse the response from a Redis VEMB command with the RAW option.
public QuantizationType getType()
null if not availablepublic ByteBuffer getVector()
The format of this data depends on the quantization type.
null if not availablepublic Double beforeNormalization()
This value represents the original magnitude of the vector before it was normalized for storage in the vector set.
null if not availablepublic Double getQuantizationRange()
This value is only present for vectors with Q8 quantization and is used to convert between the 8-bit integer representation and the original floating point values.
null if not available or not using Q8 quantizationCopyright © 2025 lettuce.io. All rights reserved.