iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
iCub::ctrl::WaveletEncoder Class Reference

Encode any given function as a set of wavelet coefficients. More...

#include <functionEncoder.h>

+ Inheritance diagram for iCub::ctrl::WaveletEncoder:

Public Member Functions

 WaveletEncoder ()
 Constructor. More...
 
virtual bool setEncoderOptions (const yarp::os::Property &options)
 Configure the encoder. More...
 
virtual yarp::os::Property getEncoderOptions ()
 Retrieve the encoder's configuration options. More...
 
virtual Code encode (const yarp::sig::Vector &values)
 Encode the function. More...
 
virtual double decode (const Code &code, const double x)
 Compute the approximated value of function in x, given the input set of wavelet coefficients. More...
 
virtual ~WaveletEncoder ()
 Destructor. More...
 
- Public Member Functions inherited from iCub::ctrl::FunctionEncoder
virtual ~FunctionEncoder ()
 Destructor. More...
 

Protected Member Functions

double interpWavelet (const double x)
 
double interpFunction (const yarp::sig::Vector &values, const double x)
 

Protected Attributes

void * w
 
void * F
 
const yarp::sig::Vector * pVal
 
unsigned int iCoeff
 
double resolution
 

Friends

double waveletIntegrand (double, void *)
 

Detailed Description

Encode any given function as a set of wavelet coefficients.

The father wavelet used here is the db4.

Definition at line 113 of file functionEncoder.h.

Constructor & Destructor Documentation

◆ WaveletEncoder()

WaveletEncoder::WaveletEncoder ( )

Constructor.

Definition at line 113 of file functionEncoder.cpp.

◆ ~WaveletEncoder()

WaveletEncoder::~WaveletEncoder ( )
virtual

Destructor.

Definition at line 232 of file functionEncoder.cpp.

Member Function Documentation

◆ decode()

double WaveletEncoder::decode ( const Code code,
const double  x 
)
virtual

Compute the approximated value of function in x, given the input set of wavelet coefficients.

Parameters
codecontains wavelet coefficients vector along with the first initial value f(0).
xis the point at which the result is computed. It shall be in [0,1].
Returns
the decoded function value.
Note
It shall hold that coefficients.length()>=floor(R)+2.

Implements iCub::ctrl::FunctionEncoder.

Definition at line 218 of file functionEncoder.cpp.

◆ encode()

Code WaveletEncoder::encode ( const yarp::sig::Vector &  values)
virtual

Encode the function.

Parameters
valuesis the vector containing the samples of function f to be encoded. The x coordinates of the points are intended to be normalized in [0,1], so that f(0)=values[0] and f(1)=values[values.length()-1].
Returns
the code containing the computed 1+N coefficients, with the first one being f(0) and the following N are the actual wavelet expansion coefficients.

Implements iCub::ctrl::FunctionEncoder.

Definition at line 195 of file functionEncoder.cpp.

◆ getEncoderOptions()

Property WaveletEncoder::getEncoderOptions ( )
virtual

Retrieve the encoder's configuration options.

Returns
a Property object containing the encoder options.

Implements iCub::ctrl::FunctionEncoder.

Definition at line 186 of file functionEncoder.cpp.

◆ interpFunction()

double WaveletEncoder::interpFunction ( const yarp::sig::Vector &  values,
const double  x 
)
protected

Definition at line 143 of file functionEncoder.cpp.

◆ interpWavelet()

double WaveletEncoder::interpWavelet ( const double  x)
protected

Definition at line 125 of file functionEncoder.cpp.

◆ setEncoderOptions()

bool WaveletEncoder::setEncoderOptions ( const yarp::os::Property &  options)
virtual

Configure the encoder.

Parameters
optionslets user specify the resolution R to which the encoding is computed. Accepted options are of the form ("resolution" <double>).
Returns
true/false on success/fail.
Note
It holds that N=floor(R)+1, where N is the number of coefficients of the vector space. Recap that floor(.) is the round function towards minus infinity.

Implements iCub::ctrl::FunctionEncoder.

Definition at line 170 of file functionEncoder.cpp.

Friends And Related Function Documentation

◆ waveletIntegrand

double waveletIntegrand ( double  x,
void *  params 
)
friend

Definition at line 99 of file functionEncoder.cpp.

Member Data Documentation

◆ F

void* iCub::ctrl::WaveletEncoder::F
protected

Definition at line 117 of file functionEncoder.h.

◆ iCoeff

unsigned int iCub::ctrl::WaveletEncoder::iCoeff
protected

Definition at line 120 of file functionEncoder.h.

◆ pVal

const yarp::sig::Vector* iCub::ctrl::WaveletEncoder::pVal
protected

Definition at line 118 of file functionEncoder.h.

◆ resolution

double iCub::ctrl::WaveletEncoder::resolution
protected

Definition at line 121 of file functionEncoder.h.

◆ w

void* iCub::ctrl::WaveletEncoder::w
protected

Definition at line 116 of file functionEncoder.h.


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