NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
plugin_statistics.cpp File Reference
#include <vector>
#include "plugins.hpp"
#include "maths/parser_functions.hpp"
#include "maths/student_t.hpp"
#include "../kernel.hpp"
Include dependency graph for plugin_statistics.cpp:

Go to the source code of this file.

Enumerations

enum  StatsFields {
  STATS_AVG , STATS_STD , STATS_CONFINT , STATS_STDERR ,
  STATS_MED , STATS_Q1 , STATS_Q3 , STATS_RMS ,
  STATS_SKEW , STATS_EXC , STATS_MIN , STATS_MAX ,
  STATS_NUM , STATS_CNT , STATS_S_T , STATS_FIELD_COUNT
}
 This enumeration defines the available statistical values in the vector returned from calcStats(). More...
 

Functions

static std::vector< std::vector< double > > calcStats (MemoryManager &_data, const std::string &sTable)
 This static function calculates the statistical values for all columns in the passed table and returns them as a vector array. More...
 
static std::string getStatFieldName (int nStatField)
 This static function maps the statistical value enumerators to strings used for the tables and the return value. More...
 
static void createStatsFile (Output &_out, const std::vector< std::vector< double > > &vStats, const std::string &sSavePath, MemoryManager &_data, const std::string &sTable, const Settings &_option)
 This static function will create the output file using the functionalities of the Output class. More...
 
static void createStatsOutput (Output &_out, const std::vector< std::vector< double > > &vStats, const std::string &sSavePath, MemoryManager &_data, const std::string &sTable, const Settings &_option)
 This static function creates the output table for the terminal. The table will get formatted using the Output class. More...
 
std::string plugin_statistics (std::string &sCmd, MemoryManager &_data)
 This is the implementation of the stats command. More...
 

Variables

const std::string PI_MED = "1.1.2"
 

Enumeration Type Documentation

◆ StatsFields

This enumeration defines the available statistical values in the vector returned from calcStats().

Enumerator
STATS_AVG 
STATS_STD 
STATS_CONFINT 
STATS_STDERR 
STATS_MED 
STATS_Q1 
STATS_Q3 
STATS_RMS 
STATS_SKEW 
STATS_EXC 
STATS_MIN 
STATS_MAX 
STATS_NUM 
STATS_CNT 
STATS_S_T 
STATS_FIELD_COUNT 

Definition at line 38 of file plugin_statistics.cpp.

Function Documentation

◆ calcStats()

static std::vector< std::vector< double > > calcStats ( MemoryManager _data,
const std::string &  sTable 
)
static

This static function calculates the statistical values for all columns in the passed table and returns them as a vector array.

Parameters
_dataMemoryManager&
sTableconst std::string&
Returns
std::vector<std::vector<double>>

Definition at line 70 of file plugin_statistics.cpp.

References MemoryManager::avg(), MemoryManager::cnt(), MemoryManager::getCols(), MemoryManager::getElement(), MemoryManager::getLines(), intPower(), MemoryManager::isValidElement(), MemoryManager::max(), MemoryManager::med(), MemoryManager::min(), MemoryManager::norm(), MemoryManager::num(), MemoryManager::pct(), mu::real(), date::round(), STATS_AVG, STATS_CNT, STATS_CONFINT, STATS_EXC, STATS_FIELD_COUNT, STATS_MAX, STATS_MED, STATS_MIN, STATS_NUM, STATS_Q1, STATS_Q3, STATS_RMS, STATS_S_T, STATS_SKEW, STATS_STD, STATS_STDERR, MemoryManager::std(), and student_t().

Referenced by plugin_statistics().

Here is the call graph for this function:

◆ createStatsFile()

static void createStatsFile ( Output _out,
const std::vector< std::vector< double > > &  vStats,
const std::string &  sSavePath,
MemoryManager _data,
const std::string &  sTable,
const Settings _option 
)
static

This static function will create the output file using the functionalities of the Output class.

Parameters
_outOutput&
vStatsconst std::vector<std::vector<double>>&
sSavePathconst std::string&
_dataMemoryManager&
sTableconst std::string&
_optionconst Settings&
Returns
void

Definition at line 211 of file plugin_statistics.cpp.

References _lang, Output::format(), Language::get(), MemoryManager::getCols(), NumeRe::FileAdapter::getDataFileName(), MemoryManager::getElement(), MemoryManager::getHeadlineCount(), MemoryManager::getHeadLineElement(), MemoryManager::getLines(), Settings::getPrecision(), getStatFieldName(), MemoryManager::isValidElement(), PI_MED, Output::reset(), Output::setCommentLine(), Output::setCompact(), Output::setFileName(), Output::setPluginName(), Output::setPrefix(), STATS_AVG, STATS_FIELD_COUNT, STATS_NUM, and toString().

Referenced by createStatsOutput().

Here is the call graph for this function:

◆ createStatsOutput()

static void createStatsOutput ( Output _out,
const std::vector< std::vector< double > > &  vStats,
const std::string &  sSavePath,
MemoryManager _data,
const std::string &  sTable,
const Settings _option 
)
static

This static function creates the output table for the terminal. The table will get formatted using the Output class.

This function will also redirect the control to createStatsFile if a file shall be created.

Parameters
_outOutput&
vStatsconst std::vector<std::vector<double>>&
sSavePathconst std::string&
_dataMemoryManager&
sTableconst std::string&
_optionconst Settings&
Returns
void

Definition at line 314 of file plugin_statistics.cpp.

References _lang, createStatsFile(), Output::format(), Language::get(), MemoryManager::getCols(), MemoryManager::getHeadlineCount(), MemoryManager::getHeadLineElement(), getStatFieldName(), Output::isFile(), make_hline(), NumeReKernel::print(), Output::reset(), Output::setCommentLine(), Output::setCompact(), STATS_AVG, STATS_CONFINT, STATS_FIELD_COUNT, STATS_NUM, NumeReKernel::toggleTableStatus(), toString(), toSystemCodePage(), and toUpperCase().

Referenced by plugin_statistics().

Here is the call graph for this function:

◆ getStatFieldName()

static std::string getStatFieldName ( int  nStatField)
static

This static function maps the statistical value enumerators to strings used for the tables and the return value.

Parameters
nStatFieldint
Returns
std::string

Definition at line 155 of file plugin_statistics.cpp.

References _lang, Language::get(), STATS_AVG, STATS_CNT, STATS_CONFINT, STATS_EXC, STATS_FIELD_COUNT, STATS_MAX, STATS_MED, STATS_MIN, STATS_NUM, STATS_Q1, STATS_Q3, STATS_RMS, STATS_S_T, STATS_SKEW, STATS_STD, and STATS_STDERR.

Referenced by createStatsFile(), createStatsOutput(), and plugin_statistics().

Here is the call graph for this function:

◆ plugin_statistics()

std::string plugin_statistics ( std::string &  sCmd,
MemoryManager _data 
)

Variable Documentation

◆ PI_MED

const std::string PI_MED = "1.1.2"

Definition at line 30 of file plugin_statistics.cpp.

Referenced by createStatsFile().