forked from facebookresearch/faiss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistances.h
54 lines (36 loc) · 1.19 KB
/
distances.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* 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.
*/
// -*- c++ -*-
#ifndef FAISS_distances_h
#define FAISS_distances_h
/** In this file are the implementations of extra metrics beyond L2
* and inner product */
#include <stdint.h>
#include "Index.h"
#include "Heap.h"
namespace faiss {
void pairwise_extra_distances (
int64_t d,
int64_t nq, const float *xq,
int64_t nb, const float *xb,
MetricType mt, float metric_arg,
float *dis,
int64_t ldq = -1, int64_t ldb = -1, int64_t ldd = -1);
void knn_extra_metrics (
const float * x,
const float * y,
size_t d, size_t nx, size_t ny,
MetricType mt, float metric_arg,
float_maxheap_array_t * res);
/** get a DistanceComputer that refers to this type of distance and
* indexes a flat array of size nb */
DistanceComputer *get_extra_distance_computer (
size_t d,
MetricType mt, float metric_arg,
size_t nb, const float *xb);
}
#endif