XVector
xvec_knn_exact.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2026 XCENA Inc.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
30 #pragma once
31 
32 #include "xvec_types.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
39 
40  // =============================================================================
41  // Index Loading and Management
42  // =============================================================================
43 
63  xvecStatus xvecKnnExactLoadIndexFromRawVectors(xvecExecutionContextTag* context,
64  const xvecFloat32* vectors,
65  xvecVectorIdType vectorCount,
66  xvecDimensionType dimension,
67  xvecDistanceType distanceType,
68  xvecKnnExactIndexTag** outIndexHandle);
69 
86  xvecStatus xvecKnnExactLoadIndexFromFaissFile(xvecExecutionContextTag* context,
87  const char* indexFilePath,
88  xvecKnnExactIndexTag** outIndexHandle);
89 
104  xvecStatus xvecKnnExactDestroyIndex(xvecExecutionContextTag* context,
105  xvecKnnExactIndexTag* indexHandle);
106 
107  // =============================================================================
108  // Kernel Preparation
109  // =============================================================================
110 
127  xvecStatus xvecKnnExactPrepareKernel(xvecExecutionContextTag* context);
128 
129  // =============================================================================
130  // Search APIs
131  // =============================================================================
132 
153  xvecStatus xvecKnnExactSearch(xvecExecutionContextTag* context,
154  xvecKnnExactIndexTag* indexHandle,
155  xvecKnnExactSearchQueryFloat32* searchQuery,
156  xvecBufferTag* resultsBufferHandle,
157  xvecKnnExactSearchTiming* outTiming);
158 
159 #ifdef __cplusplus
160 }
161 #endif
Search query parameters for KNN brute-force search.
Definition: xvec_types.h:433
xvecStatus xvecKnnExactPrepareKernel(xvecExecutionContextTag *context)
Pre-initializes PXL resources (Job, Module, Function) for KNN search.
xvecStatus xvecKnnExactLoadIndexFromRawVectors(xvecExecutionContextTag *context, const xvecFloat32 *vectors, xvecVectorIdType vectorCount, xvecDimensionType dimension, xvecDistanceType distanceType, xvecKnnExactIndexTag **outIndexHandle)
Loads a KNN index from raw float32 vectors.
xvecStatus xvecKnnExactDestroyIndex(xvecExecutionContextTag *context, xvecKnnExactIndexTag *indexHandle)
Destroys a KNN index handle and releases its host-side data.
struct xvecKnnExactSearchTiming xvecKnnExactSearchTiming
xvecStatus xvecKnnExactSearch(xvecExecutionContextTag *context, xvecKnnExactIndexTag *indexHandle, xvecKnnExactSearchQueryFloat32 *searchQuery, xvecBufferTag *resultsBufferHandle, xvecKnnExactSearchTiming *outTiming)
Performs a brute-force K-nearest neighbors search.
xvecStatus xvecKnnExactLoadIndexFromFaissFile(xvecExecutionContextTag *context, const char *indexFilePath, xvecKnnExactIndexTag **outIndexHandle)
Loads a KNN index from a Faiss IndexFlat file.
Core types, enums, and structures for the XVector library.
uint32_t xvecDimensionType
Type for vector dimension.
Definition: xvec_types.h:194
xvecStatus
Status codes returned by XVector API functions.
Definition: xvec_types.h:133
xvecDistanceType
Distance/similarity metrics for vector search.
Definition: xvec_types.h:172
float xvecFloat32
32-bit floating point type for vector components.
Definition: xvec_types.h:111
uint64_t xvecVectorIdType
Type for vector identifiers.
Definition: xvec_types.h:209