Rate This Document
Findability
Accuracy
Completeness
Readability

Add

API Definition

int Add(int nb, const float *xb, int consecutive, int level);

int Add(int nb, const float *xb, int consecutive, int reorder, int level);

Function

Builds a graph index.

Parameters

Parameter

Data Type

Description

Value Range

nb

int

Data volume of the vector base library.

≥ 1. It is recommended that the value be less than 1 billion.

xb

const float *

Data of the vector base library.

The value cannot be null. The length is nb × dim (data volume × feature dimension).

consecutive

int

Block size.

[1, 31]

level

int

Quantization level.

[0, 3]

  • 0: FP32 quantization.
  • 1: SQ8U quantization.
  • 2: SQ4U quantization.
  • 3: FP16 quantization.

reorder

int

Indicates whether to enable base library vector reordering.

0 or 1.

Return Value

Data Type

Description

int

If the parameter value is not within the value range, −1 is returned. If this API is called after calling Load/Deserialize/LoadGraph, −1 is returned. Otherwise, 0 is returned.