BINARY_QUANTIZE
Description
Binarizes the input vector by converting each floating-point element into a binary representation. Typically used for vector compression and fast similarity computation, where each bit represents the binarization result of the corresponding element in the original vector (typically using 0 as the threshold: >= 0 becomes 1, < 0 becomes 0).
Parameter Description
vec: Input vector, supported types arevector<float>,vector<double>, and other numeric vector types.
Return Result
Returns a vector<tinyint> type result, where each tinyint element (typically 8 bits) packs the binarization results of multiple elements from the original vector.
Examples
- Binarize a floating-point vector
- Binarize a vector with all positive values
- Binarize a vector with all negative values
