13 #ifndef FAISS_INDEX_IO_H
14 #define FAISS_INDEX_IO_H
24 struct VectorTransform;
26 struct ProductQuantizer;
31 void write_index (
const Index *idx,
const char *fname);
32 void write_index (
const Index *idx, FILE *f);
33 void write_index (
const Index *idx, IOWriter *writer);
35 void write_index_binary (
const IndexBinary *idx,
const char *fname);
36 void write_index_binary (
const IndexBinary *idx, FILE *f);
37 void write_index_binary (
const IndexBinary *idx, IOWriter *writer);
39 const int IO_FLAG_MMAP = 1;
40 const int IO_FLAG_READ_ONLY = 2;
42 Index *read_index (
const char *fname,
int io_flags = 0);
43 Index *read_index (FILE * f,
int io_flags = 0);
44 Index *read_index (IOReader *reader,
int io_flags = 0);
46 IndexBinary *read_index_binary (
const char *fname,
int io_flags = 0);
47 IndexBinary *read_index_binary (FILE * f,
int io_flags = 0);
48 IndexBinary *read_index_binary (IOReader *reader,
int io_flags = 0);
50 void write_VectorTransform (
const VectorTransform *vt,
const char *fname);
51 VectorTransform *read_VectorTransform (
const char *fname);
53 ProductQuantizer * read_ProductQuantizer (
const char*fname);
54 ProductQuantizer * read_ProductQuantizer (IOReader *reader);
56 void write_ProductQuantizer (
const ProductQuantizer*pq,
const char *fname);
57 void write_ProductQuantizer (
const ProductQuantizer*pq, IOWriter *f);
59 void write_InvertedLists (
const InvertedLists *ils, IOWriter *f);
60 InvertedLists *read_InvertedLists (IOReader *reader,
int io_flags = 0);
63 Index *clone_index (
const Index *);