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

Public Types

enum  QuantizerType {
  QT_8bit, QT_4bit, QT_8bit_uniform, QT_4bit_uniform,
  QT_fp16, QT_8bit_direct, QT_6bit
}
 
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)
 
SQDistanceComputerget_distance_computer (MetricType metric=METRIC_L2) const
 

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

Definition at line 32 of file IndexScalarQuantizer.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

QT_6bit 

fast indexing of uint8s

6 bits per component

Definition at line 34 of file IndexScalarQuantizer.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 51 of file IndexScalarQuantizer.h.


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