Skip to content

Commit df7280b

Browse files
epishchikfacebook-github-bot
authored andcommitted
Documentation fixes (facebookresearch#3092)
Summary: As a follow-up to this issue facebookresearch#3086, I've fixed some bugs in the doxygen-generated documentation. Pull Request resolved: facebookresearch#3092 Reviewed By: pemazare Differential Revision: D50595811 Pulled By: mdouze fbshipit-source-id: 74797d3f2594a20597e1eb6545e91f6eac6d035d
1 parent 6b76150 commit df7280b

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

faiss/Index.h

+18-3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct Index {
9999
* Vectors are implicitly assigned labels ntotal .. ntotal + n - 1
100100
* This function slices the input vectors in chunks smaller than
101101
* blocksize_add and calls add_core.
102+
* @param n number of vectors
102103
* @param x input matrix, size n * d
103104
*/
104105
virtual void add(idx_t n, const float* x) = 0;
@@ -108,7 +109,9 @@ struct Index {
108109
* The default implementation fails with an assertion, as it is
109110
* not supported by all indexes.
110111
*
111-
* @param xids if non-null, ids to store for the vectors (size n)
112+
* @param n number of vectors
113+
* @param x input vectors, size n * d
114+
* @param xids if non-null, ids to store for the vectors (size n)
112115
*/
113116
virtual void add_with_ids(idx_t n, const float* x, const idx_t* xids);
114117

@@ -117,9 +120,11 @@ struct Index {
117120
* return at most k vectors. If there are not enough results for a
118121
* query, the result array is padded with -1s.
119122
*
123+
* @param n number of vectors
120124
* @param x input vectors to search, size n * d
121-
* @param labels output labels of the NNs, size n*k
125+
* @param k number of extracted vectors
122126
* @param distances output pairwise distances, size n*k
127+
* @param labels output labels of the NNs, size n*k
123128
*/
124129
virtual void search(
125130
idx_t n,
@@ -135,6 +140,7 @@ struct Index {
135140
* indexes do not implement the range_search (only the k-NN search
136141
* is mandatory).
137142
*
143+
* @param n number of vectors
138144
* @param x input vectors to search, size n * d
139145
* @param radius search radius
140146
* @param result result table
@@ -149,8 +155,10 @@ struct Index {
149155
/** return the indexes of the k vectors closest to the query x.
150156
*
151157
* This function is identical as search but only return labels of neighbors.
158+
* @param n number of vectors
152159
* @param x input vectors to search, size n * d
153160
* @param labels output labels of the NNs, size n*k
161+
* @param k number of nearest neighbours
154162
*/
155163
virtual void assign(idx_t n, const float* x, idx_t* labels, idx_t k = 1)
156164
const;
@@ -174,7 +182,7 @@ struct Index {
174182
/** Reconstruct several stored vectors (or an approximation if lossy coding)
175183
*
176184
* this function may not be defined for some indexes
177-
* @param n number of vectors to reconstruct
185+
* @param n number of vectors to reconstruct
178186
* @param keys ids of the vectors to reconstruct (size n)
179187
* @param recons reconstucted vector (size n * d)
180188
*/
@@ -184,6 +192,8 @@ struct Index {
184192
/** Reconstruct vectors i0 to i0 + ni - 1
185193
*
186194
* this function may not be defined for some indexes
195+
* @param i0 index of the first vector in the sequence
196+
* @param ni number of vectors in the sequence
187197
* @param recons reconstucted vector (size ni * d)
188198
*/
189199
virtual void reconstruct_n(idx_t i0, idx_t ni, float* recons) const;
@@ -194,6 +204,11 @@ struct Index {
194204
* If there are not enough results for a query, the resulting arrays
195205
* is padded with -1s.
196206
*
207+
* @param n number of vectors
208+
* @param x input vectors to search, size n * d
209+
* @param k number of extracted vectors
210+
* @param distances output pairwise distances, size n*k
211+
* @param labels output labels of the NNs, size n*k
197212
* @param recons reconstructed vectors size (n, k, d)
198213
**/
199214
virtual void search_and_reconstruct(

faiss/IndexFlat.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ namespace faiss {
1818

1919
/** Index that stores the full vectors and performs exhaustive search */
2020
struct IndexFlat : IndexFlatCodes {
21-
explicit IndexFlat(idx_t d, MetricType metric = METRIC_L2);
21+
explicit IndexFlat(
22+
idx_t d, ///< dimensionality of the input vectors
23+
MetricType metric = METRIC_L2);
2224

2325
void search(
2426
idx_t n,
@@ -82,6 +84,9 @@ struct IndexFlatL2 : IndexFlat {
8284
// and l2 norms.
8385
std::vector<float> cached_l2norms;
8486

87+
/**
88+
* @param d dimensionality of the input vectors
89+
*/
8590
explicit IndexFlatL2(idx_t d) : IndexFlat(d, METRIC_L2) {}
8691
IndexFlatL2() {}
8792

faiss/IndexFlatCodes.h

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ struct IndexFlatCodes : Index {
3434

3535
void reset() override;
3636

37-
/// reconstruction using the codec interface
3837
void reconstruct_n(idx_t i0, idx_t ni, float* recons) const override;
3938

4039
void reconstruct(idx_t key, float* recons) const override;

faiss/IndexPQ.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ struct IndexPQ : IndexFlatCodes {
3131
* @param M number of subquantizers
3232
* @param nbits number of bit per subvector index
3333
*/
34-
IndexPQ(int d, ///< dimensionality of the input vectors
35-
size_t M, ///< number of subquantizers
36-
size_t nbits, ///< number of bit per subvector index
37-
MetricType metric = METRIC_L2);
34+
IndexPQ(int d, size_t M, size_t nbits, MetricType metric = METRIC_L2);
3835

3936
IndexPQ();
4037

0 commit comments

Comments
 (0)