forked from DataIntelligenceCrew/go-faiss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faiss.go
31 lines (26 loc) · 785 Bytes
/
faiss.go
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
package faiss
// Package faiss provides bindings to Faiss, a library for vector similarity
// search.
// More detailed documentation can be found at the Faiss wiki:
// https://github.com/facebookresearch/faiss/wiki.
/*
#cgo LDFLAGS: -ljemalloc -lfaiss_c
#include <faiss/c_api/Index_c.h>
#include <faiss/c_api/error_c.h>
*/
import "C"
import "errors"
func getLastError() error {
return errors.New(C.GoString(C.faiss_get_last_error()))
}
// Metric type
const (
MetricInnerProduct = C.METRIC_INNER_PRODUCT
MetricL2 = C.METRIC_L2
MetricL1 = C.METRIC_L1
MetricLinf = C.METRIC_Linf
MetricLp = C.METRIC_Lp
MetricCanberra = C.METRIC_Canberra
MetricBrayCurtis = C.METRIC_BrayCurtis
MetricJensenShannon = C.METRIC_JensenShannon
)