Skip to content

Vector functions for group comparison #48831

@alexey-milovidov

Description

@alexey-milovidov

Use case

Compression, quantization, and indexing in vector search databases.

Describe the solution you'd like

L2NearestCentroid(vec, centroids)

Takes vec - Array of numbers, typically Float32,
and centroids - constant Array of Arrays - vectors to compare.

Returns the index of the nearest centroid, according to the L2 distance.
For convenience, the index can count from zero instead of one.

partitionByHyperplanes(vec, normals, [offsets])

Takes vec - Array of numbers, typically Float32, representing a point in vector space,
normals - constant Array of Arrays, each of them representing a normal vector for a hyperplane,
offsets (optional) - constant Array of Arrays, each of them representing an offset for the corresponding hyperplane (default zero).

Note: every hyperplane has the following equation (vec - offset) ⋅ normal = 0.

Returns FixedString with every bit corresponding to a subspace, relative to the corresponding hyperplane.

Additional context

These are one of the few functions, that could benefit from GPU.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions