Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions faiss/IndexIVFPQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,8 @@ struct IVFPQScannerT : QueryTables {
float distance_2 = 0;
float distance_3 = 0;
distance_four_codes<PQDecoder>(
pq,
pq.M,
pq.nbits,
sim_table,
codes + saved_j[0] * pq.code_size,
codes + saved_j[1] * pq.code_size,
Expand All @@ -957,24 +958,30 @@ struct IVFPQScannerT : QueryTables {
}

if (counter >= 1) {
float dis =
dis0 +
float dis = dis0 +
distance_single_code<PQDecoder>(
pq, sim_table, codes + saved_j[0] * pq.code_size);
pq.M,
pq.nbits,
sim_table,
codes + saved_j[0] * pq.code_size);
res.add(saved_j[0], dis);
}
if (counter >= 2) {
float dis =
dis0 +
float dis = dis0 +
distance_single_code<PQDecoder>(
pq, sim_table, codes + saved_j[1] * pq.code_size);
pq.M,
pq.nbits,
sim_table,
codes + saved_j[1] * pq.code_size);
res.add(saved_j[1], dis);
}
if (counter >= 3) {
float dis =
dis0 +
float dis = dis0 +
distance_single_code<PQDecoder>(
pq, sim_table, codes + saved_j[2] * pq.code_size);
pq.M,
pq.nbits,
sim_table,
codes + saved_j[2] * pq.code_size);
res.add(saved_j[2], dis);
}
}
Expand Down Expand Up @@ -1137,7 +1144,8 @@ struct IVFPQScannerT : QueryTables {
float distance_2 = dis0;
float distance_3 = dis0;
distance_four_codes<PQDecoder>(
pq,
pq.M,
pq.nbits,
sim_table,
codes + saved_j[0] * pq.code_size,
codes + saved_j[1] * pq.code_size,
Expand Down Expand Up @@ -1165,10 +1173,12 @@ struct IVFPQScannerT : QueryTables {
for (size_t kk = 0; kk < counter; kk++) {
n_hamming_pass++;

float dis =
dis0 +
float dis = dis0 +
distance_single_code<PQDecoder>(
pq, sim_table, codes + saved_j[kk] * pq.code_size);
pq.M,
pq.nbits,
sim_table,
codes + saved_j[kk] * pq.code_size);

res.add(saved_j[kk], dis);
}
Expand All @@ -1185,7 +1195,10 @@ struct IVFPQScannerT : QueryTables {

float dis = dis0 +
distance_single_code<PQDecoder>(
pq, sim_table, codes + j * code_size);
pq.M,
pq.nbits,
sim_table,
codes + j * code_size);

res.add(j, dis);
}
Expand Down Expand Up @@ -1263,7 +1276,7 @@ struct IVFPQScanner : IVFPQScannerT<idx_t, METRIC_TYPE, PQDecoder>,
assert(precompute_mode == 2);
float dis = this->dis0 +
distance_single_code<PQDecoder>(
this->pq, this->sim_table, code);
this->pq.M, this->pq.nbits, this->sim_table, code);
return dis;
}

Expand Down
2 changes: 1 addition & 1 deletion faiss/IndexPQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct PQDistanceComputer : FlatCodesDistanceComputer {
ndis++;

float dis = distance_single_code<PQDecoder>(
pq, precomputed_table.data(), code);
pq.M, pq.nbits, precomputed_table.data(), code);
return dis;
}

Expand Down
Loading