linbox
Public Member Functions
TimeWatcher Class Reference

Helper. More...

#include <benchmark.h>

Public Member Functions

 TimeWatcher (dvector_t &pts, dvector_t &vals)
 constructor. More...
 
 TimeWatcher ()
 Null Constructor. The pointers are intialised to NULL.
 
dvector_trefX ()
 returns the vector of abscissa (points)
 
dvector_trefY ()
 returns the vector of ordiantes (values)
 
double predict (double x)
 Prediction for the next experiment time. More...
 
bool keepon (index_t &repet, double tim, bool usePrediction=false)
 Watches a timer and a number and repet and signals if over. More...
 
index_t size () const
 size
 
void clear ()
 clear the pointers (not the settings)
 

Detailed Description

Helper.

This helper has several functions :

Warning
if the timings are too short, this may not be accurate.

See member function help for more information.

Constructor & Destructor Documentation

TimeWatcher ( dvector_t pts,
dvector_t vals 
)

constructor.

Inits the time watcher with a pair of points/values

Parameters
ptsvector of points
valsvector of times

Member Function Documentation

double predict ( double  x)

Prediction for the next experiment time.

It is assumed that predict(0)=0. If Curent_<3, a linear, then quadratic fit is done. Other wise, a cubic fit is performed.

Parameters
xthe next evaluation point.
Returns
f(x) where f tries to fit the points : $ f(\mathtt{Data\_}[0][0..\mathtt{Current\_}-1]) \approx refY()[0..\mathtt{Current\_}-1]$
bool keepon ( index_t &  repet,
double  tim,
bool  usePrediction = false 
)

Watches a timer and a number and repet and signals if over.

We want at least 2 repetions but not more than maxtime spent on timing.

Parameters
repetnumber of previous repetitions. Should be 0 on the first time keepon is called.
timtimer to watch
maxtimemaximum time (in seconds) until watchon tells stop.
Returns
true if we conditions are not met to stop, false otherwise.
Precondition
tim should have been started previously !

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