The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MPExponentialAverager Class Reference

#include <exponentialaverager.h>

List of all members.

Public Member Functions

double getCurrTime ()
double getExponentialAvg (double alpha)
double getTimeEstimate ()
 MPExponentialAverager ()
void UpdateEstimate (double w)
void updateTimeSearch ()

Private Attributes

bool m_startFlag
double m_TimeBegin
double m_TimeCurrentBegin
double m_TimeEstimate


Constructor & Destructor Documentation

MPExponentialAverager  ) 
 

Definition at line 20 of file exponentialaverager.cpp.

00021 : m_startFlag(true), 
00022   m_TimeEstimate(1),
00023   m_TimeCurrentBegin(getCurrTime()),
00024   m_TimeBegin(getCurrTime()) { }


Member Function Documentation

double getCurrTime  ) 
 

Definition at line 28 of file exponentialaverager.cpp.

Referenced by getExponentialAvg(), UpdateEstimate(), and updateTimeSearch().

00028                                           { 
00029         return (static_cast<double>(clock()));
00030 }

double getExponentialAvg double  alpha  ) 
 

Definition at line 59 of file exponentialaverager.cpp.

References getCurrTime(), and getTimeEstimate().

00059                                                             {
00060         double timeConstant = -log(alpha) / getTimeEstimate();
00061         double diff = getCurrTime() - m_TimeBegin; 
00062         double expAvg = (1/alpha)*exp(-fabs(diff)*timeConstant);
00063         if (expAvg > 1) expAvg = 1;
00064         return expAvg;
00065 }

Here is the call graph for this function:

double getTimeEstimate  ) 
 

Definition at line 53 of file exponentialaverager.cpp.

Referenced by getExponentialAvg().

00053                                               { 
00054         return m_TimeEstimate; 
00055 }

void UpdateEstimate double  w  ) 
 

Definition at line 34 of file exponentialaverager.cpp.

References getCurrTime(), m_startFlag, m_TimeBegin, and m_TimeEstimate.

00034                                                    {
00035         m_TimeBegin = m_TimeCurrentBegin;
00036         double curr = getCurrTime()-m_TimeBegin;
00037         if (!m_startFlag) {
00038                 m_TimeEstimate = w*m_TimeEstimate + (1-w)*curr;
00039         } else {
00040                 m_TimeEstimate = curr;
00041                 m_startFlag = !m_startFlag;
00042         }
00043 }

Here is the call graph for this function:

void updateTimeSearch  ) 
 

Definition at line 47 of file exponentialaverager.cpp.

References getCurrTime(), and m_TimeCurrentBegin.

00047                                              { 
00048         m_TimeCurrentBegin = getCurrTime(); 
00049 }

Here is the call graph for this function:


Member Data Documentation

bool m_startFlag [private]
 

Definition at line 18 of file exponentialaverager.h.

Referenced by UpdateEstimate().

double m_TimeBegin [private]
 

Definition at line 21 of file exponentialaverager.h.

Referenced by UpdateEstimate().

double m_TimeCurrentBegin [private]
 

Definition at line 20 of file exponentialaverager.h.

Referenced by updateTimeSearch().

double m_TimeEstimate [private]
 

Definition at line 19 of file exponentialaverager.h.

Referenced by UpdateEstimate().


The documentation for this class was generated from the following files:
Generated on Mon Nov 8 17:08:34 2004 for MPT by  doxygen 1.3.9.1