GetPQDistance
API Definition
int GetPQDistance(const unsigned char *basecode, const unsigned char *querycode, const PQParams *params, const float *pqDistanceTable, float *PQDistance, size_t basecode_size, size_t querycode_size, size_t pqDistanceTable_size, size_t pqDistance_size);
Function
Calculates the PQ ADC or SDC distance. If querycode == NULL, the ADC distance is calculated. If querycode != NULL, the SDC distance is calculated.
Parameters
Parameter |
Data Type |
Description |
Value Range |
|---|---|---|---|
basecode |
unsigned char* |
Quantized base. |
The value cannot be null. |
querycode |
unsigned char* |
Quantized query. |
- |
pqDistanceTable |
float* |
SDC or ADC distance table. |
The value cannot be null. |
PQDistance |
float* |
SDC or ADC distance. |
The value cannot be null. |
basecode_size |
size_t |
Length of the quantized base array. |
The value is specified by pqM, which is a field in the PQParams structure and indicates the number of subspaces. |
querycode_size |
size_t |
Length of the quantized query array. |
If querycode is not null, the value is specified by pqM, where querycode indicates the quantized query. |
pqDistanceTable_size |
size_t |
Length of the SDC/ADC distance table array. |
If querycode is null, the value is specified by pqM × pqKsub. If querycode is not null, the value is specified by pqM × pqKsub × pqKsub, where querycode indicates the quantized query, pqKsub is a field in the PQParams structure and indicates the number of cluster centroids in the subspaces. |
PQDistance_size |
size_t |
Length of the SDC/ADC distance array. |
The value is 1. |
params |
PQParams |
For details, see the description of PQParams in Structure Description. |
|
Return Value
Data Type |
Description |
|---|---|
int |
The value 0 is returned when the system runs properly, and the value -1 is returned when the system exits abnormally. |