Rate This Document
Findability
Accuracy
Completeness
Readability

krl_L2sqr_by_idx_f16f32

Interface Definition

int krl_L2sqr_by_idx_f16f32(float* dis, const uint16_t* x, const uint16_t* y, const int64_t* ids, size_t d, size_t ny, size_t dis_size);

Function

Performs one-to-many Euclidean distance computation on vectors represented in fp16 precision.

Parameters

Parameter

Data Type

Description

Value Range

dis

float*

Stores the distance computation result.

The size is specified by dis_size. The memory needs to be allocated in advance.

x

const uint16_t*

Query vector for distance computation.

The vector has a dimension of d.

y

const uint16_t*

Base vector for distance computation.

The size is specified by d × ny.

ids

const int64_t*

IDs of base vectors.

The ID value is greater than or equal to 0 and less than the total number of base vectors.

d

size_t

Vector dimension.

[1, 65535]

ny

size_t

The number of base vectors.

[1, 2^30 − 1]

dis_size

size_t

Specifies the size of the distance result array.

The value is specified by ny.

Return Values

Data Type

Description

int

0 is returned on successful execution. In case of failure, an error code is returned to indicate the specific issue:

  • -1: invalid pointer
  • -2: memory allocation failure
  • -3: invalid input parameter
  • -4: double free
  • -5: insecure memory operation
  • -6: I/O failure