@@ -98,17 +98,22 @@ auto medoid(auto&& P, Distance distance = Distance{}) {
9898}
9999
100100/* *
101- * @brief Index class for vamana search
102- * @tparam feature_type Type of the elements in the feature vectors
103- * @tparam id_type Type of the ids of the feature vectors
101+ * @brief The Vamana index.
102+ *
103+ * @tparam FeatureType Type of the elements in the feature vectors.
104+ * @tparam IdType Type of the ids of the feature vectors.
105+ * @tparam AdjacencyRowIndexType Types of the indexes used in the graph.
104106 */
105- template <class FeatureType , class IdType , class IndexType = uint64_t >
107+ template <
108+ class FeatureType ,
109+ class IdType ,
110+ class AdjacencyRowIndexType = uint64_t >
106111class vamana_index {
107112 public:
108113 using feature_type = FeatureType;
109114 using id_type = IdType;
110- using adjacency_row_index_type = IndexType ;
111- using score_type = float ;
115+ using adjacency_row_index_type = AdjacencyRowIndexType ;
116+ using adjacency_scores_type = float ;
112117
113118 using group_type = vamana_index_group<vamana_index>;
114119 using metadata_type = vamana_index_metadata;
@@ -136,7 +141,7 @@ class vamana_index {
136141 uint64_t num_edges_{0 };
137142
138143 /* * The graph representing the index over `feature_vectors_` */
139- ::detail::graph::adj_list<score_type , id_type> graph_;
144+ ::detail::graph::adj_list<adjacency_scores_type , id_type> graph_;
140145
141146 /*
142147 * The medoid of the feature vectors -- the vector in the set that is closest
@@ -250,7 +255,7 @@ class vamana_index {
250255 ****************************************************************************/
251256 graph_ = ::detail::graph::adj_list<feature_type, id_type>(num_vectors_);
252257
253- auto adj_scores = read_vector<score_type >(
258+ auto adj_scores = read_vector<adjacency_scores_type >(
254259 group_->cached_ctx (),
255260 group_->adjacency_scores_uri (),
256261 0 ,
@@ -467,7 +472,7 @@ class vamana_index {
467472
468473 auto top_k = ColMajorMatrix<id_type>(k_nn, ::num_vectors (queries));
469474 auto top_k_scores =
470- ColMajorMatrix<score_type >(k_nn, ::num_vectors (queries));
475+ ColMajorMatrix<adjacency_scores_type >(k_nn, ::num_vectors (queries));
471476
472477 for (size_t i = 0 ; i < num_vectors (queries); ++i) {
473478 auto && [tk_scores, tk, V] = ::best_first_O2 (
@@ -494,7 +499,7 @@ class vamana_index {
494499
495500 auto top_k = ColMajorMatrix<id_type>(k_nn, ::num_vectors (queries));
496501 auto top_k_scores =
497- ColMajorMatrix<score_type >(k_nn, ::num_vectors (queries));
502+ ColMajorMatrix<adjacency_scores_type >(k_nn, ::num_vectors (queries));
498503
499504 for (size_t i = 0 ; i < num_vectors (queries); ++i) {
500505 auto && [tk_scores, tk, V] = ::best_first_O3 (
@@ -521,7 +526,7 @@ class vamana_index {
521526
522527 auto top_k = ColMajorMatrix<id_type>(k_nn, ::num_vectors (queries));
523528 auto top_k_scores =
524- ColMajorMatrix<score_type >(k_nn, ::num_vectors (queries));
529+ ColMajorMatrix<adjacency_scores_type >(k_nn, ::num_vectors (queries));
525530
526531 for (size_t i = 0 ; i < num_vectors (queries); ++i) {
527532 auto && [tk_scores, tk, V] = ::best_first_O4 (
@@ -548,7 +553,7 @@ class vamana_index {
548553
549554 auto top_k = ColMajorMatrix<id_type>(k_nn, ::num_vectors (queries));
550555 auto top_k_scores =
551- ColMajorMatrix<score_type >(k_nn, ::num_vectors (queries));
556+ ColMajorMatrix<adjacency_scores_type >(k_nn, ::num_vectors (queries));
552557
553558 for (size_t i = 0 ; i < num_vectors (queries); ++i) {
554559 auto && [tk_scores, tk, V] = ::best_first_O5 (
@@ -588,7 +593,8 @@ class vamana_index {
588593 // L = std::min<size_t>(L, l_build_);
589594
590595 auto top_k = ColMajorMatrix<id_type>(k, ::num_vectors (query_set));
591- auto top_k_scores = ColMajorMatrix<score_type>(k, ::num_vectors (query_set));
596+ auto top_k_scores =
597+ ColMajorMatrix<adjacency_scores_type>(k, ::num_vectors (query_set));
592598
593599#if 0
594600 // Parallelized implementation -- we stay single-threaded for now
@@ -768,7 +774,7 @@ class vamana_index {
768774 false ,
769775 temporal_policy_);
770776
771- auto adj_scores = Vector<score_type >(graph_.num_edges ());
777+ auto adj_scores = Vector<adjacency_scores_type >(graph_.num_edges ());
772778 auto adj_ids = Vector<id_type>(graph_.num_edges ());
773779 auto adj_index =
774780 Vector<adjacency_row_index_type>(graph_.num_vertices () + 1 );
0 commit comments