MCPcopy Create free account
hub / github.com/antgroup/vsag / CalcDistanceById

Method CalcDistanceById

src/algorithm/ivf.cpp:1030–1043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1028 return result;
1029}
1030float
1031IVF::CalcDistanceById(const float* query, int64_t id) const {
1032 if (this->use_reorder_) {
1033 float dist = 0.0F;
1034 auto computer = this->reorder_codes_->FactoryComputer(query);
1035 auto inner_id = this->label_table_->GetIdByLabel(id);
1036 this->reorder_codes_->Query(&dist, computer, &inner_id, 1);
1037 return dist;
1038 }
1039 auto computer = this->bucket_->FactoryComputer(query);
1040 auto inner_id = this->label_table_->GetIdByLabel(id);
1041 auto location = this->get_location(inner_id);
1042 return this->bucket_->QueryOneById(computer, location.first, location.second);
1043}
1044
1045void
1046IVF::GetVectorByInnerId(InnerIdType inner_id, float* data) const {

Callers 1

Calls 5

get_locationMethod · 0.95
GetIdByLabelMethod · 0.80
QueryOneByIdMethod · 0.80
FactoryComputerMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected