Coverage Report

Created: 2025-09-16 13:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/contrib/faiss/faiss/IndexIVFIndependentQuantizer.h
Line
Count
Source
1
/*
2
 * Copyright (c) Meta Platforms, Inc. and affiliates.
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
8
#pragma once
9
10
#include <faiss/IndexIVF.h>
11
#include <faiss/VectorTransform.h>
12
13
namespace faiss {
14
15
/** An IVF index with a quantizer that has a different input dimension from the
16
 * payload size. The vectors to encode are obtained from the input vectors by a
17
 * VectorTransform.
18
 */
19
struct IndexIVFIndependentQuantizer : Index {
20
    /// quantizer is fed directly with the input vectors
21
    Index* quantizer = nullptr;
22
23
    /// transform before the IVF vectors are applied
24
    VectorTransform* vt = nullptr;
25
26
    /// the IVF index, controls nlist and nprobe
27
    IndexIVF* index_ivf = nullptr;
28
29
    /// whether *this owns the 3 fields
30
    bool own_fields = false;
31
32
    IndexIVFIndependentQuantizer(
33
            Index* quantizer,
34
            IndexIVF* index_ivf,
35
            VectorTransform* vt = nullptr);
36
37
0
    IndexIVFIndependentQuantizer() {}
38
39
    void train(idx_t n, const float* x) override;
40
41
    void add(idx_t n, const float* x) override;
42
43
    void search(
44
            idx_t n,
45
            const float* x,
46
            idx_t k,
47
            float* distances,
48
            idx_t* labels,
49
            const SearchParameters* params = nullptr) const override;
50
51
    void reset() override;
52
53
    ~IndexIVFIndependentQuantizer() override;
54
};
55
56
} // namespace faiss