From f2bb5fa73b612e80cc899765fad5bd30ad98bc20 Mon Sep 17 00:00:00 2001 From: Harsha Vardhan Simhadri Date: Sat, 10 Sep 2022 21:10:27 -0400 Subject: [PATCH 1/2] added code to count balance of hash bins in build_lsh --- include/lsh.h | 6 ++++++ src/lsh.cpp | 28 ++++++++++++++++++++++++++-- tests/build_lsh.cpp | 1 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/lsh.h b/include/lsh.h index ac69c27..c9fddd8 100644 --- a/include/lsh.h +++ b/include/lsh.h @@ -30,12 +30,17 @@ namespace grann { void write_to_file(std::ofstream &out); void read_from_file(std::ifstream &in); + void print_balance(); + protected: _u32 vector_dim; // dimension of points stored/each hp vector _u32 table_size; // number of hyperplanes // float **random_hps; std::vector> random_hps; std::map> hashed_vectors; + + std::vector count_plus, count_minus; + }; template @@ -53,6 +58,7 @@ namespace grann { _u32 search(const T *query, _u32 res_count, const Parameters &search_params, _u32 *indices, float *distances, QueryStats *stats = nullptr, std::vector