assign

API definition

void assign(idx_t n, const int8_t *x, idx_t *labels, idx_t k = 1);

Function

Queries the feature vectors for AscendIndexInt8 and returns IDs of the most similar k features based on the input feature vectors.

Input

idx_t n: number of feature vectors to be queried.

const int8_t *x: feature vector data.

idx_t k: number of the most similar results to be returned.

Output

idx_t *labels: IDs of the first k nearest vectors that are queried.

Return value

N/A

Restrictions

  • The length of the queried feature vector data x must be dims × n, and the length of labels must be k × n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown.
  • The value of n is greater than 0 and less than 1e9.
  • The value of k is greater than 0 and less than or equal to 4096.
  • The value of n × k is less than 1e10.