Skip to content

Commit

Permalink
add some comments on variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rootlesstree committed Aug 26, 2022
1 parent 83f0727 commit dd6fa9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pecos/core/ann/hnsw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,13 @@ namespace ann {

ProductQuantizer4Bits quantizer;
index_type num_node;
// code_dimension is number of 4 bits code used to encode a data point in GraphPQ4Bits
// code_dimension can be different from parameter num_local_codebooks in quantizer
// as we might adjust code_dimension to make it divisble by 4. More details can be
// found in pad_parameters function of ann/quantizer_impl/x86.hpp
size_t code_dimension;
size_t code_offset;
// code_offset helps to locate memory position containing neighboring codes
size_t code_offset;
size_t node_mem_size;
index_type max_degree;
std::vector<uint64_t> mem_start_of_node;
Expand Down Expand Up @@ -1025,8 +1030,8 @@ namespace ann {
index_type efC; // size of priority queue for construction time
index_type max_level;
index_type init_node;
index_type subspace_dimension;
index_type sub_sample_points;
index_type subspace_dimension; // dimension of each subspace in Product Quantization
index_type sub_sample_points; // number of sub-sampled points used to build quantizer subspace centors.

GraphL0<feat_vec_t> feature_vec; // feature vectors only
GraphL1 graph_l1; // neighborhood graphs from level 1 and above
Expand Down
6 changes: 6 additions & 0 deletions pecos/core/ann/quantizer_impl/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ namespace ann {


struct ProductQuantizer4BitsBase {
// num_of_local_centroids denotes number of cluster centers used in quantization
// In 4 Bit case, it's a fixed to be 16
const size_t num_of_local_centroids = 16;
// num_local_codebooks denotes number of local codebooks we have or in other words,
// number of subspace we have in Product Quantization.
// Supposedly, num_local_codebooks * local_dimension equals dimension of original data vector
index_type num_local_codebooks;
// local dimension denotes the dimensionality of subspace in Product Quantization
int local_dimension;
std::vector<float> global_centroid;
std::vector<float> local_codebooks;
Expand Down

0 comments on commit dd6fa9b

Please sign in to comment.