12 #ifndef FAISS_INDEX_IO_H
13 #define FAISS_INDEX_IO_H
30 struct VectorTransform;
32 struct ProductQuantizer;
37 void write_index (
const Index *idx,
const char *fname);
38 void write_index (
const Index *idx, FILE *f);
39 void write_index (
const Index *idx, IOWriter *writer);
41 void write_index_binary (
const IndexBinary *idx,
const char *fname);
42 void write_index_binary (
const IndexBinary *idx, FILE *f);
43 void write_index_binary (
const IndexBinary *idx, IOWriter *writer);
46 const int IO_FLAG_MMAP = 1;
47 const int IO_FLAG_READ_ONLY = 2;
50 const int IO_FLAG_ONDISK_SAME_DIR = 4;
52 Index *read_index (
const char *fname,
int io_flags = 0);
53 Index *read_index (FILE * f,
int io_flags = 0);
54 Index *read_index (IOReader *reader,
int io_flags = 0);
56 IndexBinary *read_index_binary (
const char *fname,
int io_flags = 0);
57 IndexBinary *read_index_binary (FILE * f,
int io_flags = 0);
58 IndexBinary *read_index_binary (IOReader *reader,
int io_flags = 0);
60 void write_VectorTransform (
const VectorTransform *vt,
const char *fname);
61 VectorTransform *read_VectorTransform (
const char *fname);
63 ProductQuantizer * read_ProductQuantizer (
const char*fname);
64 ProductQuantizer * read_ProductQuantizer (IOReader *reader);
66 void write_ProductQuantizer (
const ProductQuantizer*pq,
const char *fname);
67 void write_ProductQuantizer (
const ProductQuantizer*pq, IOWriter *f);
69 void write_InvertedLists (
const InvertedLists *ils, IOWriter *f);
70 InvertedLists *read_InvertedLists (IOReader *reader,
int io_flags = 0);
73 Index *clone_index (
const Index *);