Rate This Document
Findability
Accuracy
Completeness
Readability

Add

API Definition

int Add(int n, const float *x, int consecutive, int level);

int Add(int n, const float *x, int consecutive, int reorder, int level);

Function

Builds a graph index.

Parameters

Parameter

Description

Data Type

Value Range

n

Data volume.

int

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

x

Data.

const float *

The value cannot be null. The expected length is n × K_features (Data volume × Feature dimension).

consecutive

Block size.

int

[1, 31]

level

Quantization level.

int

[0, 3]

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

reorder

Indicates whether to enable base library vector reordering.

int

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.