#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. | |
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 153 of file vq.h.
| itpp::Scalar_Quantizer::Scalar_Quantizer | ( | ) |
| itpp::Scalar_Quantizer::Scalar_Quantizer | ( | const char * | Name | ) |
Create a VQ from a VQ file.
| int itpp::Scalar_Quantizer::encode | ( | double | x | ) | const |
| ivec itpp::Scalar_Quantizer::encode | ( | const vec & | x | ) | const |
| double itpp::Scalar_Quantizer::decode | ( | int | Index | ) | const [inline] |
| vec itpp::Scalar_Quantizer::decode | ( | const ivec & | Index | ) | const |
| double itpp::Scalar_Quantizer::Q | ( | double | x | ) | const [inline] |
| vec itpp::Scalar_Quantizer::Q | ( | const vec & | x | ) | const |
| double itpp::Scalar_Quantizer::operator() | ( | double | x | ) | const [inline] |
| vec itpp::Scalar_Quantizer::operator() | ( | const vec & | x | ) | const [inline] |
| void itpp::Scalar_Quantizer::set_levels | ( | const vec & | L | ) | [inline] |
| vec itpp::Scalar_Quantizer::get_levels | ( | ) | const [inline] |
| int itpp::Scalar_Quantizer::size | ( | ) | const [inline] |
vec itpp::Scalar_Quantizer::Levels [protected] |
The vector containing the code book.
Definition at line 183 of file vq.h.
Referenced by decode(), encode(), get_levels(), itpp::scalar_encode(), itpp::scalar_quantize(), set_levels(), and size().
double itpp::Scalar_Quantizer::LatestDist [protected] |
Generated on Wed Apr 18 11:23:43 2007 for IT++ by Doxygen 1.5.2