itpp::Scalar_Quantizer Class Reference
Source Coding Module » Source Coding Routines

Class for vector quantization. More...

`#include <itpp/srccode/vq.h>`

## Public Member Functions

| Scalar_Quantizer ()
| Default constructor.
| Scalar_Quantizer (const char *Name)
| Create a VQ from a VQ file.
int | encode (double x) const
| Encode.
ivec | encode (const vec &x) const
| Encode the input vector.
double | decode (int Index) const
| Decode the index.
vec | decode (const ivec &Index) const
| Decode the indices.
double | Q (double x) const
| Quantize.
vec | Q (const vec &x) const
| Quantize the input vector.
double | operator() (double x) const
| Quantize.
vec | operator() (const vec &x) const
| Quantize the input vector.
void | set_levels (const vec &L)
| Initialize the codebook by a matrix.
vec | get_levels () const
| Returns the codebook.
int | size () const
| Returns the size (number of codevectors) of the VQ.

## Protected Attributes

vec | Levels
| The vector containing the code book.
double | LatestDist
| The distortion at the latest time a vector was encoded.

## Detailed Description

Class for vector quantization.

The following code illustrates how the quantizer can be initialized from a file and used to quantize a random vector.

Scalar_Quantizer Quantizer;
double x,y;
int i;
Quantizer.load("random.sq");
x=randn();
i=Quantizer.encode(x);
y=Quantizer.decode(i);

Definition at line 152 of file vq.h.

The documentation for this class was generated from the following file:

- itpp/srccode/vq.h

itpp::Scalar_Quantizer::Scalar_Quantizer
Scalar_Quantizer()
Default constructor.
itpp::randn
double randn(void)
Generates a random Gaussian (0,1) variable.
Definition: random.h:831

Generated on Mon Mar 23 2020 06:18:03 for IT++ by Doxygen 1.8.17