krl_reorder_2_vector_continuous
Interface Definition
int krl_reorder_2_vector_continuous(const KRLDistanceHandle* kdh, int64_t base_k, int64_t begin_id, const float* query_vector, int64_t k, float* dis, int64_t* idx, size_t query_vector_size);
Function
Computes high-accuracy distances between a single query vector and multiple contiguous base vectors, and returns the results sorted by distance.
Parameters
Parameter |
Data Type |
Description |
Value Range |
|---|---|---|---|
kdh |
const KRLDistanceHandle* |
Pointer to a KRLDistanceHandle instance. |
It cannot be null, and is initialized using krl_create_reorder_handle. |
base_k |
int64_t |
The number of candidate base vectors selected by a low-accuracy retrieval algorithm. |
It falls within [k, codes_num], where codes_num is the number of base vectors. |
begin_id |
int64_t |
ID of the first base vector to be included in the computation. |
[0, codes_num-base_k]. |
query_vector |
const float* |
Query vector data. |
The size is specified by query_vector_size. |
k |
int64_t |
The number of the nearest neighbors to return after computation. |
It falls within [1, base_k]. |
dis |
float* |
Stores the computed distances between the query vector and its nearest neighbors. |
The value is specified by k. The memory needs to be allocated in advance. |
idx |
int64_t* |
Stores IDs of the nearest neighbors. |
The value is specified by k. The memory needs to be allocated in advance. |
query_vector_size |
size_t |
Size of the query vector array. |
The value is specified by dim, the vector dimension. |
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: |