我要评分
获取效率
正确性
完整性
易理解

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 expected 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 Load/Deserialize/LoadGraph is called, -1 is returned. In other cases, 0 is returned.