add_with_ids

API definition

void add_with_ids(idx_t n, const float *x, const idx_t *ids) override;

Function

Creates an AscendIndex database and adds new feature vectors into the database. Each feature vector in the database has a corresponding ID.

Input

idx_t n: number of feature vectors to be added to the database.

const float *x: feature vectors to be added to the database.

const idx_t *ids: IDs of the feature vectors to be added to the database.

Output

N/A

Return value

N/A

Restrictions

  • The length of x must be dims × n, and the length of ids must be n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown. Range of n: 0 < n < 1e9.
  • When filterable is set to true, ensure that the timestamp in ids is positive.

    ids (uint64_t) contains timestamp (int32_t) and cid (camera ID; uint8_t), as shown in the following:

    -----| cid | timestamp | -----
     14  |  8  |    32     |  10

API definition

void add_with_ids(idx_t n, const uint16_t *x, const idx_t *ids);

Function

Creates an AscendIndex database and adds new feature vectors into the database. Each feature vector in the database has a corresponding ID.

Input

idx_t n: number of feature vectors to be added to the database.

const uint16_t *x: feature vectors to be added to the database.

const idx_t *ids: IDs of the feature vectors to be added to the database.

Output

N/A

Return value

N/A

Restrictions

  • The length of x must be dims × n, and the length of ids must be n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown. Range of n: 0 < n < 1e9.
  • When filterable is set to true, ensure that the timestamp in ids is positive. ids (uint64_t) contains timestamp (int32_t) and cid (camera ID; uint8_t), as shown in the following:
    1
    2
    -----| cid | timestamp | -----
     14  |  8  |    32     |  10