linbox
PlotData Class Reference

The raw data to plot. More...

#include <benchmark.h>

Public Member Functions

const DataSeriesgetSeries (const size_t &i) const
 Returns the ith series of measurements.
 
const DataSeriesselectSeries (const size_t &i)
 Returns the ith series of measurements.
 
const DataSeriesselectSeries (const std::string &name)
 Returns the series of measurements after its name.
 
const DataSeriesgetCurrentSeries () const
 Returns the current series of measurements.
 
DataSeriesrefSeries (const size_t &i)
 Returns the ith series of measurements.
 
DataSeriesrefSeries (const std::string &nom)
 Returns the ith series of measurements.
 
DataSeriesrefCurrentSeries ()
 Returns the current series of measurements.
 
 PlotData ()
 Inits a plot with series of data.
 
 ~PlotData ()
 destructor.
 
 PlotData (const PlotData &PD)
 copy constructor.
 
void clear ()
 initialize to empty
 
void merge (const PlotData &PD)
 merges another plot data to the current one.
 
size_t size () const
 get the number of series.
 
size_t getCurrentSeriesNumber () const
 gets the current series number.
 
void setSeriesName (const size_t &i, const std::string &nom)
 Sets the name of a series.
 
template<class Pt>
std::vector< typename Pt::type > & refSeries (const size_t &i, Pt kind)
 
template<class Pt>
std::vector< typename Pt::type > & refSeries (const std::string &name, Pt kind)
 
template<class Pt>
const std::vector< typename Pt::type > & getSeries (const size_t &i, Pt kind) const
 
template<class Pt>
const std::vector< typename Pt::type > & getSeries (const std::string &name, Pt kind) const
 
template<class Pt>
const std::vector< typename Pt::type > & getCurrentSeries (Pt kind) const
 
template<class Pt>
const Pt::type & getSeriesEntry (const size_t &i, const size_t &j, Pt kind) const
 
template<class Pt>
const Pt::type & getSeriesEntry (const std::string &name, const size_t &j, Pt kind) const
 
template<class Pt>
const Pt::type & getSeriesEntry (const size_t &i, Pt kind) const
 
template<class Pt>
const Pt::type & getSeriesEntry (const std::string &name, Pt kind) const
 
template<class Pt>
const Pt::type & getCurrentSeriesEntry (const size_t &j, Pt kind) const
 
template<class Pt>
const Pt::type & getCurrentSeriesEntry (Pt kind) const
 
const std::string & getSeriesName (const size_t &i) const
 Gets the name of a series.
 
const std::string & getCurrentSeriesName () const
 Gets the name of the current series.
 
void setCurrentSeriesName (const std::string &nom)
 Sets the name of the current series.
 
void initWatch (const size_t &i)
 Inits the watch on a series.
 
void initCurrentSeriesWatch ()
 Inits the watch to current series.
 
void newSeries (const std::string &nom="")
 Creates a new series.
 
void finishSeries ()
 Finish a series of measurements.
 
size_t getSeriesSize (const size_t &i) const
 size of a series.
 
size_t getCurrentSeriesSize () const
 size of the current series.
 
bool selectNextSeries ()
 goes to the next series of points
 
void selectFirstSeries ()
 selects the first series
 
template<class T>
void setSeriesPointLabel (const size_t &i, const size_t &j, const T &nom)
 Sets the name of a point.
 
void setCurrentSeriesPointLabel (const size_t &j, const std::string &nom)
 Sets the name of a point.
 
std::string getSeriesLabel (const size_t &i) const
 gets the name of a series.
 
std::string getCurrentSeriesLabel () const
 gets the name of a series.
 
const svector_tgetSeriesLabels () const
 gets all the names in the series.
 
void setSeriesEntry (const size_t &i, const std::string &nam, const double &val, const double &xval=NAN, const double &yval=NAN)
 sets a new entry.
 
void setSeriesEntry (const std::string &nom, const std::string &nam, const double &val, const double &xval=NAN, const double &yval=NAN)
 sets a new entry.
 
template<class T>
void setCurrentSeriesEntry (const T &nam, const double &val, const double &xval=NAN, const double &yval=NAN)
 sets a new entry.
 
const std::vector< DataSeries > & getTable () const
 gets a reference to the array of data.
 
std::vector< DataSeries > & refTable ()
 gets a reference to the array of data.
 
bool keepon (size_t &repet, double tim, bool usePrediction=false)
 Continue for another time measure ?
 
void load (const std::string &filename)
 
void save (const std::string &filename, const std::string &title="", const std::string &xtitle="", const std::string &ytitle="")
 saves the data in XML format.
 
void addCurrentEntryMetaData (const MetaData &m)
 
const std::string & getCurrentEntryId () const
 returns the unique ID of the current series last entry
 
const std::string & getCurrentSeriesId (const size_t &j) const
 returns the unique ID of the current series j'th entry.
 
const std::string & getId (const size_t &i, const size_t &j)
 returns the unique ID of the i'th series j'th entry.
 
const std::string & getId (const std::string &name, const size_t &j)
 returns the unique ID of the i'th series j'th entry.
 
template<>
svector_trefSeries (const size_t &i, Point::Labels)
 
template<>
dvector_trefSeries (const size_t &i, Point::Values)
 
template<>
dvector_trefSeries (const size_t &i, Point::Points)
 
template<>
dvector_trefSeries (const size_t &i, Point::Times)
 
template<>
const svector_tgetSeries (const size_t &i, Point::Labels) const
 
template<>
const dvector_tgetSeries (const size_t &i, Point::Values) const
 
template<>
const dvector_tgetSeries (const size_t &i, Point::Points) const
 
template<>
const dvector_tgetSeries (const size_t &i, Point::Times) const
 

Detailed Description

The raw data to plot.

Represents the labels for the points (X axis) and the values for each series of measures (Y axis).

Members that set/get are named as follows :

  • getX(nom,j) return the j'th element of series named nom
  • getX(i,j) return the j'th element of series number i
  • getCurrentSeriesX(j) return the j'th element of current series
  • getCurrentEntryX() return the current element of current series (ie the last one)
  • .

Members are also named as follows :

  • getXXX is a const member
  • selectXXX is non const and may create/update stuff
  • refXXX returns a reference
  • setXXX sets something

The internal representation is a vector of vector, each series of point being a vector of double.

Template Parameters
Xkindthe X axis is parametrised by Xkind (string, int, double...) The Y axis is always represented by double.
Todo
put the legend (title, x, y) in there

Constructor & Destructor Documentation

◆ PlotData() [1/2]

PlotData ( )

Inits a plot with series of data.

Parameters
nb_ptsnumber of points in each series.
nb_srsnumber of series of points. Default is 1.

◆ ~PlotData()

~PlotData ( )

destructor.

◆ PlotData() [2/2]

PlotData ( const PlotData & PD)

copy constructor.

Parameters
PDa PlotData to copy.

Member Function Documentation

◆ getSeries() [1/7]

const DataSeries & getSeries ( const size_t & i) const

Returns the ith series of measurements.

Parameters
iith series to be returned

◆ selectSeries() [1/2]

const DataSeries & selectSeries ( const size_t & i)

Returns the ith series of measurements.

Parameters
iith series to be returned

◆ selectSeries() [2/2]

const DataSeries & selectSeries ( const std::string & name)

Returns the series of measurements after its name.

Parameters
nomname of series to be returned

◆ getCurrentSeries() [1/2]

const DataSeries & getCurrentSeries ( ) const

Returns the current series of measurements.

◆ refSeries() [1/8]

DataSeries & refSeries ( const size_t & i)

Returns the ith series of measurements.

Parameters
iith series to be returned

◆ refSeries() [2/8]

DataSeries & refSeries ( const std::string & nom)

Returns the ith series of measurements.

Parameters
iith series to be returned

◆ refCurrentSeries()

DataSeries & refCurrentSeries ( )

Returns the current series of measurements.

◆ clear()

void clear ( )

initialize to empty

◆ merge()

void merge ( const PlotData & PD)

merges another plot data to the current one.

(just adds to the end, does not merge series by name yet)

◆ size()

size_t size ( ) const

get the number of series.

Returns
number of series.

◆ getCurrentSeriesNumber()

size_t getCurrentSeriesNumber ( ) const

gets the current series number.

◆ setSeriesName()

void setSeriesName ( const size_t & i,
const std::string & nom )

Sets the name of a series.

Parameters
iindex of the series
nomname of the series

◆ refSeries() [3/8]

template<class Pt>
std::vector< typename Pt::type > & refSeries ( const size_t & i,
Pt kind )

◆ refSeries() [4/8]

template<class Pt>
std::vector< typename Pt::type > & refSeries ( const std::string & name,
Pt kind )
inline

◆ getSeries() [2/7]

template<class Pt>
const std::vector< typename Pt::type > & getSeries ( const size_t & i,
Pt kind ) const

◆ getSeries() [3/7]

template<class Pt>
const std::vector< typename Pt::type > & getSeries ( const std::string & name,
Pt kind ) const
inline

◆ getCurrentSeries() [2/2]

template<class Pt>
const std::vector< typename Pt::type > & getCurrentSeries ( Pt kind) const
inline

◆ getSeriesEntry() [1/4]

template<class Pt>
const Pt::type & getSeriesEntry ( const size_t & i,
const size_t & j,
Pt kind ) const
inline

◆ getSeriesEntry() [2/4]

template<class Pt>
const Pt::type & getSeriesEntry ( const std::string & name,
const size_t & j,
Pt kind ) const
inline

◆ getSeriesEntry() [3/4]

template<class Pt>
const Pt::type & getSeriesEntry ( const size_t & i,
Pt kind ) const
inline

◆ getSeriesEntry() [4/4]

template<class Pt>
const Pt::type & getSeriesEntry ( const std::string & name,
Pt kind ) const
inline

◆ getCurrentSeriesEntry() [1/2]

template<class Pt>
const Pt::type & getCurrentSeriesEntry ( const size_t & j,
Pt kind ) const
inline

◆ getCurrentSeriesEntry() [2/2]

template<class Pt>
const Pt::type & getCurrentSeriesEntry ( Pt kind) const
inline

◆ getSeriesName()

const std::string & getSeriesName ( const size_t & i) const

Gets the name of a series.

Parameters
iindex of the series

◆ getCurrentSeriesName()

const std::string & getCurrentSeriesName ( ) const

Gets the name of the current series.

◆ setCurrentSeriesName()

void setCurrentSeriesName ( const std::string & nom)

Sets the name of the current series.

Parameters
nomname of the series

◆ initWatch()

void initWatch ( const size_t & i)

Inits the watch on a series.

Parameters
iindex of a series

◆ initCurrentSeriesWatch()

void initCurrentSeriesWatch ( )

Inits the watch to current series.

◆ newSeries()

void newSeries ( const std::string & nom = "")

Creates a new series.

It is created after the last series. getCurrentSeries() points to it.

Parameters
nomname of the new series

◆ finishSeries()

void finishSeries ( )

Finish a series of measurements.

Nothing is done for the moment.

◆ getSeriesSize()

size_t getSeriesSize ( const size_t & i) const

size of a series.

Parameters
iindex of the series

◆ getCurrentSeriesSize()

size_t getCurrentSeriesSize ( ) const

size of the current series.

◆ selectNextSeries()

bool selectNextSeries ( )

goes to the next series of points

◆ selectFirstSeries()

void selectFirstSeries ( )

selects the first series

◆ setSeriesPointLabel()

template<class T>
void setSeriesPointLabel ( const size_t & i,
const size_t & j,
const T & nom )
inline

Sets the name of a point.

Parameters
iseries number
jindex for the the point
nomname of the point

◆ setCurrentSeriesPointLabel()

void setCurrentSeriesPointLabel ( const size_t & j,
const std::string & nom )

Sets the name of a point.

Parameters
jindex for the the point
nomname of the point

◆ getSeriesLabel()

std::string getSeriesLabel ( const size_t & i) const

gets the name of a series.

Defaults to "series.i"

Parameters
iits index.
Returns
its name.

◆ getCurrentSeriesLabel()

std::string getCurrentSeriesLabel ( ) const

gets the name of a series.

Defaults to "series.i"

Parameters
iits index.
Returns
its name.

◆ getSeriesLabels()

const svector_t & getSeriesLabels ( ) const

gets all the names in the series.

Returns
a vector of names.

◆ setSeriesEntry() [1/2]

void setSeriesEntry ( const size_t & i,
const std::string & nam,
const double & val,
const double & xval = NAN,
const double & yval = NAN )

sets a new entry.

Parameters
iindex of the series
jindex of the point
namname of the point (eg size of the matrix, name of a sparse matrix,...)
valvalue to be inserted (eg mflops, sec,...).
xvalx value of the point (eg size of the matrix, of a sparse matrix,...)
yvaltime for this computation (seconds)

◆ setSeriesEntry() [2/2]

void setSeriesEntry ( const std::string & nom,
const std::string & nam,
const double & val,
const double & xval = NAN,
const double & yval = NAN )

sets a new entry.

Parameters
namename of the series
jindex of the point
namname of the point (eg size of the matrix, name of a sparse matrix,...)
valvalue to be inserted (eg mflops, sec,...).
xvalx value of the point (eg size of the matrix, of a sparse matrix,...)
yvaltime for this computation (seconds)

◆ setCurrentSeriesEntry()

template<class T>
void setCurrentSeriesEntry ( const T & nam,
const double & val,
const double & xval = NAN,
const double & yval = NAN )
inline

sets a new entry.

Parameters
jindex of the point
namname of the point (eg size of the matrix, name of a sparse matrix,...)
valvalue to be inserted (eg mflops, sec,...).

◆ getTable()

const std::vector< DataSeries > & getTable ( ) const

gets a reference to the array of data.

Returns
a reference to the member _tableau_ representing the data.

◆ refTable()

std::vector< DataSeries > & refTable ( )

gets a reference to the array of data.

Returns
a reference to the member _tableau_ representing the data.

◆ keepon()

bool keepon ( size_t & repet,
double tim,
bool usePrediction = false )

Continue for another time measure ?

See also
TimeWatcher::keepon
Parameters
repetcurrent number of repetitions for this new measure
timtime previously spent on the measures.
Returns
true if one more measure can be done

◆ load()

void load ( const std::string & filename)

◆ save()

void save ( const std::string & filename,
const std::string & title = "",
const std::string & xtitle = "",
const std::string & ytitle = "" )

saves the data in XML format.

Parameters
filenamefile name
titletitles of the data
xtitlelegend of the X axis
ytitlelegend of the Y axis.

◆ addCurrentEntryMetaData()

void addCurrentEntryMetaData ( const MetaData & m)
inline

◆ getCurrentEntryId()

const std::string & getCurrentEntryId ( ) const
inline

returns the unique ID of the current series last entry

◆ getCurrentSeriesId()

const std::string & getCurrentSeriesId ( const size_t & j) const
inline

returns the unique ID of the current series j'th entry.

Parameters
jindex of the entry.

◆ getId() [1/2]

const std::string & getId ( const size_t & i,
const size_t & j )
inline

returns the unique ID of the i'th series j'th entry.

Parameters
iindex of the series.
jindex of the entry.

◆ getId() [2/2]

const std::string & getId ( const std::string & name,
const size_t & j )
inline

returns the unique ID of the i'th series j'th entry.

Parameters
iindex of the series.
jindex of the entry.

◆ refSeries() [5/8]

template<>
svector_t & refSeries ( const size_t & i,
Point::Labels  )

◆ refSeries() [6/8]

template<>
dvector_t & refSeries ( const size_t & i,
Point::Values  )

◆ refSeries() [7/8]

template<>
dvector_t & refSeries ( const size_t & i,
Point::Points  )

◆ refSeries() [8/8]

template<>
dvector_t & refSeries ( const size_t & i,
Point::Times  )

◆ getSeries() [4/7]

template<>
const svector_t & getSeries ( const size_t & i,
Point::Labels  ) const

◆ getSeries() [5/7]

template<>
const dvector_t & getSeries ( const size_t & i,
Point::Values  ) const

◆ getSeries() [6/7]

template<>
const dvector_t & getSeries ( const size_t & i,
Point::Points  ) const

◆ getSeries() [7/7]

template<>
const dvector_t & getSeries ( const size_t & i,
Point::Times  ) const

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