Float32BinaryVector
, Int8BinaryVector
, PackedBitBinaryVector
Binary Vectors are densely packed arrays of numbers, all the same type, which are stored and retrieved efficiently using the BSON Binary Subtype 9 format. This class supports multiple vector
BinaryVector.DataType
's and provides static methods to create vectors.
NOTE: This class should be treated as sealed: it must not be extended or implemented by consumers of the library.
Nested Classes
static enum
Represents the data type (dtype) of a vector.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Creates a vector with the
BinaryVector.DataType.PACKED_BIT
data type.
A BinaryVector.DataType.PACKED_BIT
vector is a binary quantized vector where each element of a vector is represented by a single bit (0 or 1). Each byte can hold up to 8 bits (vector elements). The padding parameter is used to specify how many least-significant bits in the final byte should be ignored.
For example, a vector with two bytes and a padding of 4 would have the following structure:
Byte 1: 238 (binary: 11101110) Byte 2: 224 (binary: 11100000) Padding: 4 (ignore the last 4 bits in Byte 2) Resulting vector: 12 bits: 111011101110
NOTE: The byte array `data` is not copied; changes to the provided array will be reflected in the created PackedBitBinaryVector
instance.
data
- The byte array representing the packed bit vector data. Each byte can store 8 bits.
padding
- The number of least-significant bits (0 to 7) to ignore in the final byte of the vector data.
PackedBitBinaryVector
instance with the BinaryVector.DataType.PACKED_BIT
data type.
IllegalArgumentException
- If the padding value is greater than 7.
Creates a vector with the
BinaryVector.DataType.INT8
data type.
A BinaryVector.DataType.INT8
vector is a vector of 8-bit signed integers where each byte in the vector represents an element of a vector, with values in the range [-128, 127].
NOTE: The byte array `data` is not copied; changes to the provided array will be reflected in the created Int8BinaryVector
instance.
data
- The byte array representing the BinaryVector.DataType.INT8
vector data.
Int8BinaryVector
instance with the BinaryVector.DataType.INT8
data type.
data
- The float array representing the BinaryVector.DataType.FLOAT32
vector data.
Float32BinaryVector
instance with the BinaryVector.DataType.FLOAT32
data type.
PackedBitBinaryVector
.
IllegalStateException
- if this vector is not of type BinaryVector.DataType.PACKED_BIT
. Use getDataType()
to check the vector type before calling this method.
Int8BinaryVector
.
IllegalStateException
- if this vector is not of type BinaryVector.DataType.INT8
. Use getDataType()
to check the vector type before calling this method.
Float32BinaryVector
.
IllegalStateException
- if this vector is not of type BinaryVector.DataType.FLOAT32
. Use getDataType()
to check the vector type before calling this method.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4