mirror of https://github.com/milvus-io/milvus.git
parent
e8f759c22b
commit
50ddc49332
|
@ -5,6 +5,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
namespace hnswlib {
|
||||
|
||||
template<typename dist_t>
|
||||
class BruteforceSearch : public AlgorithmInterface<dist_t> {
|
||||
public:
|
||||
|
@ -83,10 +84,8 @@ namespace hnswlib {
|
|||
data_ + size_per_element_ * (cur_element_count-1),
|
||||
data_size_+sizeof(labeltype));
|
||||
cur_element_count--;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::priority_queue<std::pair<dist_t, labeltype >>
|
||||
searchKnn(const void *query_data, size_t k) const {
|
||||
std::priority_queue<std::pair<dist_t, labeltype >> topResults;
|
||||
|
@ -106,7 +105,6 @@ namespace hnswlib {
|
|||
topResults.pop();
|
||||
lastdist = topResults.top().first;
|
||||
}
|
||||
|
||||
}
|
||||
return topResults;
|
||||
};
|
||||
|
@ -143,8 +141,6 @@ namespace hnswlib {
|
|||
}
|
||||
|
||||
void loadIndex(const std::string &location, SpaceInterface<dist_t> *s) {
|
||||
|
||||
|
||||
std::ifstream input(location, std::ios::binary);
|
||||
std::streampos position;
|
||||
|
||||
|
@ -163,8 +159,6 @@ namespace hnswlib {
|
|||
input.read(data_, maxelements_ * size_per_element_);
|
||||
|
||||
input.close();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ typedef unsigned int linklistsizeint;
|
|||
|
||||
template<typename dist_t>
|
||||
class HierarchicalNSW : public AlgorithmInterface<dist_t> {
|
||||
|
||||
public:
|
||||
HierarchicalNSW(SpaceInterface<dist_t> *s) {
|
||||
}
|
||||
|
|
|
@ -89,8 +89,6 @@ namespace hnswlib {
|
|||
virtual ~AlgorithmInterface(){
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#include "space_l2.h"
|
||||
|
|
|
@ -212,7 +212,6 @@ namespace hnswlib {
|
|||
#endif
|
||||
|
||||
class InnerProductSpace : public SpaceInterface<float> {
|
||||
|
||||
DISTFUNC<float> fstdistfunc_;
|
||||
size_t data_size_;
|
||||
size_t dim_;
|
||||
|
@ -243,6 +242,4 @@ namespace hnswlib {
|
|||
|
||||
~InnerProductSpace() {}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace hnswlib {
|
|||
res += t * t;
|
||||
}
|
||||
return (res);
|
||||
|
||||
}
|
||||
|
||||
#if defined(USE_AVX)
|
||||
|
@ -143,7 +142,6 @@ namespace hnswlib {
|
|||
#endif
|
||||
|
||||
class L2Space : public SpaceInterface<float> {
|
||||
|
||||
DISTFUNC<float> fstdistfunc_;
|
||||
size_t data_size_;
|
||||
size_t dim_;
|
||||
|
@ -180,7 +178,6 @@ namespace hnswlib {
|
|||
|
||||
static int
|
||||
L2SqrI(const void *__restrict pVect1, const void *__restrict pVect2, const void *__restrict qty_ptr) {
|
||||
|
||||
size_t qty = *((size_t *) qty_ptr);
|
||||
int res = 0;
|
||||
unsigned char *a = (unsigned char *) pVect1;
|
||||
|
@ -205,16 +202,12 @@ namespace hnswlib {
|
|||
res += ((*a) - (*b)) * ((*a) - (*b));
|
||||
a++;
|
||||
b++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return (res);
|
||||
|
||||
}
|
||||
|
||||
class L2SpaceI : public SpaceInterface<int> {
|
||||
|
||||
DISTFUNC<int> fstdistfunc_;
|
||||
size_t data_size_;
|
||||
size_t dim_;
|
||||
|
@ -240,5 +233,4 @@ namespace hnswlib {
|
|||
~L2SpaceI() {}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace hnswlib {
|
|||
|
||||
~VisitedList() { delete[] mass; }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
// Class for multi-threaded pool-management of VisitedLists
|
||||
|
|
Loading…
Reference in New Issue