35 #include <itpp/itexports.h> 70 int encode(
const vec &x);
72 ivec encode(
const vec &x,
int num);
74 vec decode(
int Index)
const;
80 vec operator()(
const vec &x);
82 void set_codebook(
const mat &CB);
84 mat get_codebook()
const;
86 void set_codevector(
int Index,
const vec &indata);
88 vec get_codevector(
int Index)
const;
90 void modify_codevector(
int no,
double mul,
const vec &add);
103 void load(
const char *Name);
110 void save(
const char *Name)
const;
112 double latest_distortion();
160 int encode(
double x)
const;
162 ivec encode(
const vec &x)
const;
164 double decode(
int Index)
const;
166 vec decode(
const ivec &Index)
const;
168 double Q(
double x)
const;
170 vec Q(
const vec &x)
const;
172 double operator()(
double x)
const;
174 vec operator()(
const vec &x)
const;
176 void set_levels(
const vec &L);
178 vec get_levels()
const;
208 #endif // #ifndef VQ_H Class for vector quantization.
double latest_distortion()
Returns the distortion at the latest time a vector was encoded.
double operator()(double x) const
Quantize.
vec get_levels() const
Returns the codebook.
vec decode(int Index) const
Decode the index.
vec Q(const vec &x)
Quantize the input vector.
double LatestDist
The distortion at the latest time a vector was encoded.
double Q(double x) const
Quantize.
Automatic naming when savingAn easy way to give a variable a name and optionally description when sav...
Logarithmic and exponenential functions - header file.
vec Levels
The vector containing the code book.
double scalar_quantize(double x, vec &Levels)
ADD DOCUMENTATION HERE.
ITPP_EXPORT int scalar_encode(double x, vec &Levels)
ADD DOCUMENTATION HERE.
void set_levels(const vec &L)
Initialize the codebook by a matrix.
int size(const Vec< T > &v)
Length of vector.
double LatestDist
The distortion at the latest time a vector was encoded.
vec operator()(const vec &x)
Quantize the input vector.
Class for vector quantization.
int dim() const
Returns the dimension of the VQ.
int size() const
Returns the size (number of codevectors) of the VQ.
vec CodeBook
The vector containing the code book.
int Size
The size of the code book.
int nobits() const
Returns the number of bits of the VQ [log2(size)/dim].
int size() const
Returns the size (number of codevectors) of the VQ.
double decode(int Index) const
Decode the index.
int levels2bits(int n)
Calculate the number of bits needed to represent n different values (levels).
Templated Vector Class Definitions.
int Dim
The dimension of the code book.