Flat Orchestrator

Documentation for the type-erased version of the svs::index::flat::FlatIndex.

class Flat : public svs::manager::IndexManager<FlatInterface>

Type erased container for the Flat index.

Public Types

using search_parameters_type = typename IFace::search_parameters_type

Require the presence of the search_parameters_type alias in the instantiating interface.

Public Functions

inline size_t size() const

Return the number of elements in the indexed dataset.

inline size_t dimensions() const

Return the logical number of dimensions of each vector in the indexed dataset.

inline std::vector<svs::DataType> query_types() const

Return query-types that this index is specialized to work with.

inline bool can_change_threads() const

Return whether the back-end implementation can change the number of threads.

inline size_t get_num_threads() const

Return the current number of worker threads used by this index for searches.

inline void set_num_threads(size_t num_threads)

Set the number of threads to use for searching.

Only effective if can_change_threads() returns true.

Parameters:

num_threads – The number of threads to use. If set to 0, will implicitly default to 1.

Public Static Functions

template<manager::QueryTypeDefinition QueryTypes, typename DataLoader, typename Distance>
static inline Flat assemble(DataLoader &&data_loader, Distance distance, size_t num_threads)

Load a Flat Index from an existing dataset.

data_loader

The data loader should be any object loadable via svs::detail::dispatch_load returning a Vamana compatible dataset. Concrete examples include:

  • An instance of VectorDataLoader.

  • An LVQ loader: svs::quantization::lvq::LVQLoader.

  • An implementation of svs::data::ImmutableMemoryDataset (passed by value).

Template Parameters:

QueryType – The element type of the vectors that will be used for querying.

Parameters:
  • data_loader – A compatible class capable of load data. See expanded notes.

  • distance – A distance functor to use or a svs::DistanceType enum.

  • num_threads – The number of threads to use for index searches.

struct AssembleTag

Internal dispatch tag.