Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
/data/users/matthijs/github_faiss/faiss/index_io.h
1 /**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the CC-by-NC license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9 // Copyright 2004-present Facebook. All Rights Reserved
10 // -*- c++ -*-
11 // I/O code for indexes
12
13 #ifndef FAISS_INDEX_IO_H
14 #define FAISS_INDEX_IO_H
15
16 #include <cstdio>
17
18 namespace faiss {
19
20 struct Index;
21 struct VectorTransform;
22 struct IndexIVF;
23 struct ProductQuantizer;
24
25 void write_index (const Index *idx, FILE *f);
26 void write_index (const Index *idx, const char *fname);
27
28 /**
29 * mmap'ing currently works only for IndexIVFPQCompact, the
30 * IndexIVFPQCompact destructor will unmap the file.
31 */
32 Index *read_index (FILE * f, bool try_mmap = false);
33 Index *read_index (const char *fname, bool try_mmap = false);
34
35
36
37 void write_VectorTransform (const VectorTransform *vt, const char *fname);
38 VectorTransform *read_VectorTransform (const char *fname);
39
40 ProductQuantizer * read_ProductQuantizer (const char*fname);
41 void write_ProductQuantizer (const ProductQuantizer*pq, const char *fname);
42
43
44
45 /* cloning functions */
46 Index *clone_index (const Index *);
47
48 /** Cloner class, useful to override classes with other cloning
49 * functions. The cloning function above just calls
50 * Cloner::clone_Index. */
51 struct Cloner {
52 virtual VectorTransform *clone_VectorTransform (const VectorTransform *);
53 virtual Index *clone_Index (const Index *);
54 virtual IndexIVF *clone_IndexIVF (const IndexIVF *);
55 virtual ~Cloner() {}
56 };
57
58 }
59
60 #endif
faiss::IndexIVF
Definition: IndexIVF.h:45
faiss::Cloner
Definition: index_io.h:51
faiss::read_index
Index * read_index(FILE *f, bool try_mmap)
Definition: index_io.cpp:536
faiss::VectorTransform
Definition: VectorTransform.h:28
faiss::Index
Definition: Index.h:60