Skip to main content

cuvsVamanaBuild

Function cuvsVamanaBuild 

Source
pub unsafe extern "C" fn cuvsVamanaBuild(
    res: cuvsResources_t,
    params: cuvsVamanaIndexParams_t,
    dataset: *mut DLManagedTensor,
    index: cuvsVamanaIndex_t,
) -> cuvsError_t
Expand description

@brief Build Vamana index

Build the index from the dataset for efficient DiskANN search.

The build uses the Vamana insertion-based algorithm to create the graph. The algorithm starts with an empty graph and iteratively inserts batches of nodes. Each batch involves performing a greedy search for each vector to be inserted, and inserting it with edges to all nodes traversed during the search. Reverse edges are also inserted and robustPrune is applied to improve graph quality. The index_params struct controls the degree of the final graph.

The following distance metrics are supported:

  • L2

Usage example: @code{.c} // Create cuvsResources_t cuvsResources_t res; cuvsResourcesCreate(&res);

// Assume a row-major dataset [n_rows, n_cols] is defined as float* dataset cuvsVamanaIndexParams_t index_params; cuvsVamanaIndexParamsCreate(&index_params); index_params->metric = L2Expanded; // set distance metric cuvsVamanaIndex_t index; cuvsVamanaIndexCreate(&index); cuvsVamanaBuild(res, index_params, dataset, index); @endcode

@param[in] res cuvsResources_t opaque C handle @param[in] params cuvsVamanaIndexParams_t used to build Vamana index @param[in] dataset DLManagedTensor* training dataset @param[out] index cuvsVamanaIndex_t Vamana index @return cuvsError_t