Skip to content

Commit

Permalink
Merge pull request #21 from cmuparlay/reorder-initialization
Browse files Browse the repository at this point in the history
Reorder struct fields / initialization order
  • Loading branch information
jakublacki authored Nov 8, 2024
2 parents b1c1597 + b1914bd commit fd2dd28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 0 additions & 2 deletions algorithms/utils/beamSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ filtered_beam_search(const GT &G,
size_t full_dist_cmps = starting_points.size();
int remain = frontier.size();
int num_visited = 0;
double total;

// used as temporaries in the loop
std::vector<id_dist> new_frontier(2 * std::max<size_t>(beamSize,starting_points.size()) +
Expand Down Expand Up @@ -480,7 +479,6 @@ beam_search_rerank_(const Point &p,
auto [beamElts, visitedElts] = pairElts;

// recalculate distances with non-quantized points and sort
int num_rerank = beamElts.size();
parlay::sequence<id_dist> pts;
for (auto v : visitedElts) {
int j = v.first;
Expand Down
2 changes: 0 additions & 2 deletions algorithms/utils/point_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ struct PointRange{
reader.read((char*)(&num_points), sizeof(unsigned int));
n = num_points;
reader.read((char*)(&d), sizeof(unsigned int));
int dims = d;
params = parameters(d);
std::cout << "Data: detected " << num_points << " points with dimension " << d << std::endl;
int num_bytes = params.num_bytes();
Expand All @@ -106,7 +105,6 @@ struct PointRange{
size_t ceiling = index+BLOCK_SIZE <= n ? index+BLOCK_SIZE : n;
long m = ceiling - floor;
byte* data_start = new byte[m * num_bytes];
byte* data_end = data_start + m * num_bytes;
reader.read((char*)(data_start), m * num_bytes);
parlay::parallel_for(floor, ceiling, [&] (size_t i) {
std::memmove(values.get() + i * aligned_bytes,
Expand Down
12 changes: 6 additions & 6 deletions algorithms/utils/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,29 @@ struct RangeGroundTruth{


struct BuildParams{
long L; //vamana
long R; //vamana and pynnDescent
long L; //vamana
double m_l = 0; // HNSW
double alpha; //vamana and pyNNDescent
int num_passes; //vamana
int single_batch; //vamana

long num_clusters; // HCNNG and pyNNDescent
long cluster_size; //HCNNG and pyNNDescent
long MST_deg; //HCNNG

double delta; //pyNNDescent
double rerank_factor = 100; // for reranking, k * factor = to rerank

bool verbose;

int quantize = 0; // use quantization for build and query (0 = none, 1 = one-level, 2 = two-level)
double radius; // for radius search
double radius_2; // for radius search
double trim = 0.0; // for quantization
bool self;
bool range;
int single_batch; //vamana
long Q = 0; //beam width to pass onto query (0 indicates none specified)
double trim = 0.0; // for quantization
double rerank_factor = 100; // for reranking, k * factor = to rerank

std::string alg_type;

Expand All @@ -192,7 +192,7 @@ struct BuildParams{
BuildParams() {}

BuildParams(long R, long L, double a, int num_passes, bool verbose = false)
: R(R), L(L), alpha(a), num_passes(num_passes), single_batch(0), verbose(verbose)
: R(R), L(L), alpha(a), num_passes(num_passes), verbose(verbose), single_batch(0)
{alg_type = "Vamana";}

BuildParams(long R, long L, double m_l, double a)
Expand All @@ -219,9 +219,9 @@ struct QueryParams{
long k;
long beamSize;
double cut;
int rerank_factor = 100;
long limit;
long degree_limit;
int rerank_factor = 100;
float pad = 1.0;

QueryParams(long k, long Q, double cut, long limit, long dg, double rerank_factor = 100) : k(k), beamSize(Q), cut(cut), limit(limit), degree_limit(dg), rerank_factor(rerank_factor) {}
Expand Down

0 comments on commit fd2dd28

Please sign in to comment.