|
Index * | index_factory (int d, const char *description_in, MetricType metric) |
|
IndexBinary * | index_binary_factory (int d, const char *description) |
|
float | kmeans_clustering (size_t d, size_t n, size_t k, const float *x, float *centroids) |
|
void | handleExceptions (std::vector< std::pair< int, std::exception_ptr >> &exceptions) |
|
template<size_t nbits, typename T > |
T | hamming (const uint8_t *bs1, const uint8_t *bs2) |
|
template<size_t nbits> |
hamdis_t | hamming (const uint64_t *bs1, const uint64_t *bs2) |
|
template<> |
hamdis_t | hamming< 64 > (const uint64_t *pa, const uint64_t *pb) |
|
template<> |
hamdis_t | hamming< 128 > (const uint64_t *pa, const uint64_t *pb) |
|
template<> |
hamdis_t | hamming< 256 > (const uint64_t *pa, const uint64_t *pb) |
|
hamdis_t | hamming (const uint64_t *bs1, const uint64_t *bs2, size_t nwords) |
|
template<size_t nbits> |
void | hammings (const uint64_t *bs1, const uint64_t *bs2, size_t n1, size_t n2, hamdis_t *dis) |
|
void | hammings (const uint64_t *bs1, const uint64_t *bs2, size_t n1, size_t n2, size_t nwords, hamdis_t *__restrict dis) |
|
template<size_t nbits> |
void | hamming_count_thres (const uint64_t *bs1, const uint64_t *bs2, size_t n1, size_t n2, hamdis_t ht, size_t *nptr) |
|
template<size_t nbits> |
void | crosshamming_count_thres (const uint64_t *dbs, size_t n, int ht, size_t *nptr) |
|
template<size_t nbits> |
size_t | match_hamming_thres (const uint64_t *bs1, const uint64_t *bs2, size_t n1, size_t n2, int ht, long *idx, hamdis_t *hams) |
|
void | fvec2bitvec (const float *x, uint8_t *b, size_t d) |
|
void | fvecs2bitvecs (const float *x, uint8_t *b, size_t d, size_t n) |
|
void | bitvec_print (const uint8_t *b, size_t d) |
|
void | hammings (const uint8_t *a, const uint8_t *b, size_t na, size_t nb, size_t ncodes, hamdis_t *__restrict dis) |
|
void | hammings_knn (int_maxheap_array_t *ha, const uint8_t *a, const uint8_t *b, size_t nb, size_t ncodes, int order) |
|
void | hammings_knn_hc (int_maxheap_array_t *ha, const uint8_t *a, const uint8_t *b, size_t nb, size_t ncodes, int order) |
|
void | hammings_knn_mc (const uint8_t *a, const uint8_t *b, size_t na, size_t nb, size_t k, size_t ncodes, int32_t *distances, long *labels) |
|
void | hamming_count_thres (const uint8_t *bs1, const uint8_t *bs2, size_t n1, size_t n2, hamdis_t ht, size_t ncodes, size_t *nptr) |
|
void | crosshamming_count_thres (const uint8_t *dbs, size_t n, hamdis_t ht, size_t ncodes, size_t *nptr) |
|
size_t | match_hamming_thres (const uint8_t *bs1, const uint8_t *bs2, size_t n1, size_t n2, hamdis_t ht, size_t ncodes, long *idx, hamdis_t *dis) |
|
void | generalized_hammings_knn_hc (int_maxheap_array_t *ha, const uint8_t *a, const uint8_t *b, size_t nb, size_t code_size, int ordered) |
|
int | popcount64 (uint64_t x) |
|
void | hammings (const uint8_t *a, const uint8_t *b, size_t na, size_t nb, size_t nbytespercode, hamdis_t *dis) |
|
| SPECIALIZED_HC (4) |
|
| SPECIALIZED_HC (8) |
|
| SPECIALIZED_HC (16) |
|
| SPECIALIZED_HC (20) |
|
| SPECIALIZED_HC (32) |
|
| SPECIALIZED_HC (64) |
|
int | generalized_hamming_64 (uint64_t a) |
|
template<class C > |
void | heap_pop (size_t k, typename C::T *bh_val, typename C::TI *bh_ids) |
|
template<class C > |
void | heap_push (size_t k, typename C::T *bh_val, typename C::TI *bh_ids, typename C::T val, typename C::TI ids) |
|
template<typename T > |
void | minheap_pop (size_t k, T *bh_val, long *bh_ids) |
|
template<typename T > |
void | minheap_push (size_t k, T *bh_val, long *bh_ids, T val, long ids) |
|
template<typename T > |
void | maxheap_pop (size_t k, T *bh_val, long *bh_ids) |
|
template<typename T > |
void | maxheap_push (size_t k, T *bh_val, long *bh_ids, T val, long ids) |
|
template<class C > |
void | heap_heapify (size_t k, typename C::T *bh_val, typename C::TI *bh_ids, const typename C::T *x=nullptr, const typename C::TI *ids=nullptr, size_t k0=0) |
|
template<typename T > |
void | minheap_heapify (size_t k, T *bh_val, long *bh_ids, const T *x=nullptr, const long *ids=nullptr, size_t k0=0) |
|
template<typename T > |
void | maxheap_heapify (size_t k, T *bh_val, long *bh_ids, const T *x=nullptr, const long *ids=nullptr, size_t k0=0) |
|
template<class C > |
void | heap_addn (size_t k, typename C::T *bh_val, typename C::TI *bh_ids, const typename C::T *x, const typename C::TI *ids, size_t n) |
|
template<typename T > |
void | minheap_addn (size_t k, T *bh_val, long *bh_ids, const T *x, const long *ids, size_t n) |
|
template<typename T > |
void | maxheap_addn (size_t k, T *bh_val, long *bh_ids, const T *x, const long *ids, size_t n) |
|
template<typename C > |
size_t | heap_reorder (size_t k, typename C::T *bh_val, typename C::TI *bh_ids) |
|
template<typename T > |
size_t | minheap_reorder (size_t k, T *bh_val, long *bh_ids) |
|
template<typename T > |
size_t | maxheap_reorder (size_t k, T *bh_val, long *bh_ids) |
|
template<class C > |
void | indirect_heap_pop (size_t k, const typename C::T *bh_val, typename C::TI *bh_ids) |
|
template<class C > |
void | indirect_heap_push (size_t k, const typename C::T *bh_val, typename C::TI *bh_ids, typename C::TI id) |
|
void | write_VectorTransform (const VectorTransform *vt, IOWriter *f) |
|
void | write_ProductQuantizer (const ProductQuantizer *pq, IOWriter *f) |
|
void | write_InvertedLists (const InvertedLists *ils, IOWriter *f) |
|
void | write_ProductQuantizer (const ProductQuantizer *pq, const char *fname) |
|
void | write_index (const Index *idx, IOWriter *f) |
|
void | write_index (const Index *idx, FILE *f) |
|
void | write_index (const Index *idx, const char *fname) |
|
void | write_VectorTransform (const VectorTransform *vt, const char *fname) |
|
VectorTransform * | read_VectorTransform (IOReader *f) |
|
InvertedLists * | read_InvertedLists (IOReader *f, int io_flags) |
|
ProductQuantizer * | read_ProductQuantizer (const char *fname) |
|
ProductQuantizer * | read_ProductQuantizer (IOReader *reader) |
|
Index * | read_index (IOReader *f, int io_flags) |
|
Index * | read_index (FILE *f, int io_flags) |
|
Index * | read_index (const char *fname, int io_flags) |
|
VectorTransform * | read_VectorTransform (const char *fname) |
|
Index * | clone_index (const Index *index) |
|
void | write_index_binary (const IndexBinary *idx, IOWriter *f) |
|
void | write_index_binary (const IndexBinary *idx, FILE *f) |
|
void | write_index_binary (const IndexBinary *idx, const char *fname) |
|
IndexBinary * | read_index_binary (IOReader *f, int io_flags) |
|
IndexBinary * | read_index_binary (FILE *f, int io_flags) |
|
IndexBinary * | read_index_binary (const char *fname, int io_flags) |
|
template<typename CT , class C > |
void | pq_estimators_from_tables_Mmul4 (int M, const CT *codes, size_t ncodes, const float *__restrict dis_table, size_t ksub, size_t k, float *heap_dis, long *heap_ids) |
|
template<typename CT , class C > |
void | pq_estimators_from_tables_M4 (const CT *codes, size_t ncodes, const float *__restrict dis_table, size_t ksub, size_t k, float *heap_dis, long *heap_ids) |
|
template<class PQEncoder > |
void | compute_code (const ProductQuantizer &pq, const float *x, uint8_t *code) |
|
template<class PQDecoder > |
void | decode (const ProductQuantizer &pq, const uint8_t *code, float *x) |
|
double | getmillisecs () |
| ms elapsed since some arbitrary epoch
|
|
void | float_rand (float *x, size_t n, long seed) |
|
void | float_randn (float *x, size_t n, long seed) |
|
void | long_rand (long *x, size_t n, long seed) |
|
void | rand_perm (int *perm, size_t n, long seed) |
|
void | byte_rand (uint8_t *x, size_t n, long seed) |
|
void | reflection (const float *__restrict u, float *__restrict x, size_t n, size_t d, size_t nu) |
|
void | reflection_ref (const float *u, float *x, size_t n, size_t d, size_t nu) |
|
void | fvec_inner_products_ny (float *ip, const float *x, const float *y, size_t d, size_t ny) |
|
void | fvec_norms_L2 (float *__restrict nr, const float *__restrict x, size_t d, size_t nx) |
|
void | fvec_norms_L2sqr (float *__restrict nr, const float *__restrict x, size_t d, size_t nx) |
|
void | fvec_renorm_L2 (size_t d, size_t nx, float *__restrict x) |
|
void | knn_inner_product (const float *x, const float *y, size_t d, size_t nx, size_t ny, float_minheap_array_t *res) |
|
void | knn_L2sqr (const float *x, const float *y, size_t d, size_t nx, size_t ny, float_maxheap_array_t *res) |
|
void | knn_L2sqr_base_shift (const float *x, const float *y, size_t d, size_t nx, size_t ny, float_maxheap_array_t *res, const float *base_shift) |
|
void | fvec_inner_products_by_idx (float *__restrict ip, const float *x, const float *y, const long *__restrict ids, size_t d, size_t nx, size_t ny) |
|
void | fvec_L2sqr_by_idx (float *__restrict dis, const float *x, const float *y, const long *__restrict ids, size_t d, size_t nx, size_t ny) |
|
void | knn_inner_products_by_idx (const float *x, const float *y, const long *ids, size_t d, size_t nx, size_t ny, float_minheap_array_t *res) |
|
void | knn_L2sqr_by_idx (const float *x, const float *y, const long *__restrict ids, size_t d, size_t nx, size_t ny, float_maxheap_array_t *res) |
|
void | range_search_L2sqr (const float *x, const float *y, size_t d, size_t nx, size_t ny, float radius, RangeSearchResult *res) |
|
void | range_search_inner_product (const float *x, const float *y, size_t d, size_t nx, size_t ny, float radius, RangeSearchResult *result) |
| same as range_search_L2sqr for the inner product similarity
|
|
void | inner_product_to_L2sqr (float *__restrict dis, const float *nr1, const float *nr2, size_t n1, size_t n2) |
|
void | matrix_qr (int m, int n, float *a) |
|
void | pairwise_L2sqr (long d, long nq, const float *xq, long nb, const float *xb, float *dis, long ldq, long ldb, long ldd) |
|
int | km_update_centroids (const float *x, float *centroids, long *assign, size_t d, size_t k, size_t n, size_t k_frozen) |
|
void | ranklist_handle_ties (int k, long *idx, const float *dis) |
|
size_t | merge_result_table_with (size_t n, size_t k, long *I0, float *D0, const long *I1, const float *D1, bool keep_min, long translation) |
|
size_t | ranklist_intersection_size (size_t k1, const long *v1, size_t k2, const long *v2_in) |
|
double | imbalance_factor (int k, const int *hist) |
| same, takes a histogram as input
|
|
double | imbalance_factor (int n, int k, const long *assign) |
| a balanced assignment has a IF of 1
|
|
int | ivec_hist (size_t n, const int *v, int vmax, int *hist) |
| compute histogram on v
|
|
void | bincode_hist (size_t n, size_t nbits, const uint8_t *codes, int *hist) |
|
size_t | ivec_checksum (size_t n, const int *a) |
| compute a checksum on a table.
|
|
void | fvec_argsort (size_t n, const float *vals, size_t *perm) |
|
void | fvec_argsort_parallel (size_t n, const float *vals, size_t *perm) |
|
const float * | fvecs_maybe_subsample (size_t d, size_t *n, size_t nmax, const float *x, bool verbose, long seed) |
|
void | binary_to_real (size_t d, const uint8_t *x_in, float *x_out) |
|
void | real_to_binary (size_t d, const float *x_in, uint8_t *x_out) |
|
uint64_t | hash_bytes (const uint8_t *bytes, long n) |
|
bool | check_openmp () |
|
size_t | get_mem_usage_kb () |
| get current RSS usage in kB
|
|
float | fvec_L2sqr (const float *x, const float *y, size_t d) |
| Squared L2 distance between two vectors.
|
|
float | fvec_inner_product (const float *x, const float *y, size_t d) |
|
void | fvec_L2sqr_ny (float *__restrict dis, const float *x, const float *y, size_t d, size_t ny) |
|
float | fvec_norm_L2sqr (const float *x, size_t d) |
|
void | fvec_norms_L2 (float *ip, const float *x, size_t d, size_t nx) |
|
void | fvec_norms_L2sqr (float *ip, const float *x, size_t d, size_t nx) |
| same as fvec_norms_L2, but computes square norms
|
|
void | fvec_renorm_L2 (size_t d, size_t nx, float *x) |
|
void | fvec_madd (size_t n, const float *a, float bf, const float *b, float *c) |
|
int | fvec_madd_and_argmin (size_t n, const float *a, float bf, const float *b, float *c) |
|
void | reflection (const float *u, float *x, size_t n, size_t d, size_t nu) |
|
float | fvec_L2sqr_ref (const float *x, const float *y, size_t d) |
|
float | fvec_inner_product_ref (const float *x, const float *y, size_t d) |
|
float | fvec_norm_L2sqr_ref (const float *x, size_t d) |
|
void | fvec_L2sqr_ny_ref (float *dis, const float *x, const float *y, size_t d, size_t ny) |
|
void | fvec_L2sqr_ny (float *dis, const float *x, const float *y, size_t d, size_t ny) |
|
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.Multi-dimensional array class for CUDA device and host usage. Originally from Facebook's fbcunn, since added to the Torch GPU library cutorch as well.
Throughout the library, vectors are provided as float * pointers. Most algorithms can be optimized when several vectors are processed (added/searched) together in a batch. In this case, they are passed in as a matrix. When n vectors of size d are provided as float * x, component j of vector i is
x[ i * d + j ]
where 0 <= i < n and 0 <= j < d. In other words, matrices are always compact. When specifying the size of the matrix, we call it an n*d matrix, which implies a row-major storage.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. I/O functions can read/write to a filename, a file handle or to an object that abstracts the medium.
The read functions return objects that should be deallocated with delete. All references within these objectes are owned by the object.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Definition of inverted lists + a few common classes that implement the interface.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Since IVF (inverted file) indexes are of so much use for large-scale use cases, we group a few functions related to them in this small library. Most functions work both on IndexIVFs and IndexIVFs embedded within an IndexPreTransform.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Defines a few objects that apply transformations to a set of vectors Often these are pre-processing steps.