Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Public Attributes | List of all members
faiss::ScalarQuantizer Struct Reference

#include <IndexIVFScalarQuantizer.h>

Public Types

enum  QuantizerType { QT_8bit, QT_4bit, QT_8bit_uniform, QT_4bit_uniform }
 
enum  RangeStat { RS_minmax, RS_meanstd, RS_quantiles, RS_optim }
 

Public Member Functions

 ScalarQuantizer (size_t d, QuantizerType qtype)
 
void train (size_t n, const float *x)
 
void compute_codes (const float *x, uint8_t *codes, size_t n) const
 same as compute_code for several vectors
 
void decode (const uint8_t *code, float *x, size_t n) const
 decode a vector from a given code (or n vectors if third argument)
 

Public Attributes

QuantizerType qtype
 
RangeStat rangestat
 
float rangestat_arg
 
size_t d
 dimension of input vectors
 
size_t code_size
 bytes per vector
 
std::vector< float > trained
 trained values (including the range)
 

Detailed Description

An IVF implementation where the components of the residuals are encoded with a scalar uniform quantizer. All distance computations are asymmetric, so the encoded vectors are decoded and approximate distances are computed.

The uniform quantizer has a range [vmin, vmax]. The range can be the same for all dimensions (uniform) or specific per dimension (default).

Definition at line 34 of file IndexIVFScalarQuantizer.h.

Member Enumeration Documentation

Enumerator
QT_8bit 

8 bits per component

QT_4bit 

4 bits per component

QT_8bit_uniform 

same, shared range for all dimensions

Definition at line 36 of file IndexIVFScalarQuantizer.h.

The uniform encoder can estimate the range of representable values of the unform encoder using different statistics. Here rs = rangestat_arg

Enumerator
RS_minmax 

[min - rs*(max-min), max + rs*(max-min)]

RS_meanstd 

[mean - std * rs, mean + std * rs]

RS_quantiles 

[Q(rs), Q(1-rs)]

RS_optim 

alternate optimization of reconstruction error

Definition at line 50 of file IndexIVFScalarQuantizer.h.


The documentation for this struct was generated from the following files: