krl_table_lookup_8b_f32_with_handle
Interface Definition
int krl_table_lookup_8b_f32_with_handle(KRLLUT8bHandle* klh, size_t dim, size_t ncode, const uint8_t* codes, const float* sim_table, float dis0, size_t codes_size, size_t sim_table_size);
Function
Obtains distance values from the float-type LUT using 8-bit indexes, accumulates the distance values, adds dis0 to the result after accumulation, and stores the final result in distance. The idx and distance arrays are contained in the KRLLUT8bHandle instance. Only the base vectors whose IDs are in the idx array are used for computation.
Parameters
Parameter |
Data Type |
Description |
Value Range |
|---|---|---|---|
klh |
KRLLUT8bHandle* |
Pointer to the KRLLUT8bHandle instance. |
It cannot be null, and is initialized using krl_create_LUT8b_handle. |
dim |
size_t |
Vector dimension. |
[1, 65535] |
ncode |
size_t |
Number of vectors in the inverted list. |
[1, 2^30 – 1] |
codes |
const uint8_t* |
Codebook, which stores indexes of base vectors. |
The size is specified by codes_size. |
sim_table |
const float* |
Similarity LUT, which stores the distances between query vectors for each dimension and all centroids. |
The size is specified by sim_table_size. |
dis0 |
float |
Initial distance. |
Floating point number. |
codes_size |
size_t |
Length of the codebook array. |
dim x ncode |
sim_table_size |
size_t |
Length of the similarity LUT array. |
dim x 256 |
Return Values
Data Type |
Description |
|---|---|
int |
0 is returned on successful execution. In case of failure, an error code is returned to indicate the specific issue:
|