#include <MaxLloydQuantizer.h>
Public Member Functions | |
MaxLloydQuantizer () | |
Constructor resulting in an uninitialized and untrained quantizer. | |
MaxLloydQuantizer (unsigned int R) | |
Constructor which initialize the quantizer. | |
MaxLloydQuantizer (unsigned int R, itpp::Vec< T > trainingdata, double epsilon=1e-3, unsigned int max_iter=1e3, unsigned hist_size=1000) | |
Constructor which initialize and train the quantizer. | |
virtual | ~MaxLloydQuantizer () |
Destructor. | |
bool | train (const itpp::Vec< T > &trainingdata, double epsilon=1e-3, unsigned int max_iter=1e3) |
training method. | |
bool | train2 (const itpp::Vec< T > &trainingdata, double epsilon=1e-3, unsigned int max_iter=1e3) |
unsigned int | getNumberOfQuantizerLevels () const |
Getter for the number of quantizer levels. | |
unsigned int | getTargetRate () const |
Getter for the target rate. | |
bool | isTrained () const |
Inspector for the trained state of the quantizer. | |
bool | isInitialized () const |
Inspector for the initialized state of the quantizer. | |
void | setTargetRate (unsigned int R) |
Setter for the target rate / number of quantization levels ![]() | |
unsigned int | quantize (T x) |
Quantization method. Quantize an input sample. Input samples smaller than the smallest training value will be quantized to 0, input samples greater than the biggest training value will be quantized to N-1. | |
T | inv_quant (unsigned int level) |
Inverse quantization method (fast, without range checks). | |
Protected Attributes | |
itpp::Vec< T > | d |
itpp::Vec< T > | r |
unsigned int | Rate |
unsigned int | N |
bool | trained |
bool | initialized |
itpp::MaxLloydQuantizer< T >::MaxLloydQuantizer | ( | unsigned int | R | ) | [inline] |
Constructor which initialize the quantizer.
R | Target rate (Number of quantizer levels = ![]() |
itpp::MaxLloydQuantizer< T >::MaxLloydQuantizer | ( | unsigned int | R, | |
itpp::Vec< T > | trainingdata, | |||
double | epsilon = 1e-3 , |
|||
unsigned int | max_iter = 1e3 , |
|||
unsigned | hist_size = 1000 | |||
) | [inline] |
Constructor which initialize and train the quantizer.
R | Target rate (Number of quantizer levels = ![]() | |
trainingdata | Data to train the quantizer. | |
epsilon | Terminate iteration if ![]() | |
max_iter | Maximum number of iterations. | |
hist_size | Number of histogram bins |
unsigned int itpp::MaxLloydQuantizer< T >::getNumberOfQuantizerLevels | ( | ) | const [inline] |
Getter for the number of quantizer levels.
unsigned int itpp::MaxLloydQuantizer< T >::getTargetRate | ( | ) | const [inline] |
Getter for the target rate.
T itpp::MaxLloydQuantizer< T >::inv_quant | ( | unsigned int | level | ) | [inline] |
Inverse quantization method (fast, without range checks).
level | quantizer level index. |
bool itpp::MaxLloydQuantizer< T >::isTrained | ( | ) | const [inline] |
Inspector for the trained state of the quantizer.
unsigned int itpp::MaxLloydQuantizer< T >::quantize | ( | T | x | ) | [inline] |
Quantization method. Quantize an input sample. Input samples smaller than the smallest training value will be quantized to 0, input samples greater than the biggest training value will be quantized to N-1.
Input | sample. |
void itpp::MaxLloydQuantizer< T >::setTargetRate | ( | unsigned int | R | ) | [inline] |
Setter for the target rate / number of quantization levels . After calling this method, the quantizer is untrained again!
R | new target rate. |
bool itpp::MaxLloydQuantizer< T >::train | ( | const itpp::Vec< T > & | trainingdata, | |
double | epsilon = 1e-3 , |
|||
unsigned int | max_iter = 1e3 | |||
) | [inline] |
training method.
trainingdata | Data to train the quantizer. | |
epsilon | Terminate iteration if ![]() | |
max_iter | Maximum number of iterations. |
itpp::Vec<T> itpp::MaxLloydQuantizer< T >::d [protected] |
Quantizer cell bounds
bool itpp::MaxLloydQuantizer< T >::initialized [protected] |
flag indicating that the quantizer has been initialized
unsigned int itpp::MaxLloydQuantizer< T >::N [protected] |
number of quantization levels
itpp::Vec<T> itpp::MaxLloydQuantizer< T >::r [protected] |
reconstruction values
unsigned int itpp::MaxLloydQuantizer< T >::Rate [protected] |
target rate for the quantizer
bool itpp::MaxLloydQuantizer< T >::trained [protected] |
flag indicating if the quantizer has been trained