File size: 412 Bytes
e87a50a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include <vector>
#include <cstdint>
class IndexPQ{
private: 
    int d; 
    int m; 
    int k_sub;
    int d_sub;

    std::vector<float> centroids;
    bool trained  = false;
public: 
    IndexPQ(int d, int m);
    void train(int n, const float* x, bool subsampling, int seed);
    void encode(const float *x, uint8_t* out);
    void compute_distance_table(const float *query, float *outable);
};