Documentation clean-up and fixes

more clean-up and polishing
after some further test regarding the topic of timing measurements

Improved handling: filter test cases to be performed
This commit is contained in:
Fischlurch 2021-10-09 17:38:37 +02:00
parent 48d74f261f
commit ef91088fb7
3 changed files with 45 additions and 3 deletions

View file

@ -253,6 +253,17 @@ public:
});
}
void dropLastRow()
{
if (not empty())
forEach(TAB::allColumns(),
[](auto& col)
{
size_t siz = col.data.size();
col.data.resize(siz>0? siz-1 : 0);
});
}
void reserve(size_t expectedCapacity)
{
forEach(TAB::allColumns(),
@ -282,6 +293,7 @@ public:
fs::rename(filename_, oldFile);
}
fs::rename(newFilename, filename_);
filename_ = consolidated(filename_); // lock onto absolute path
}

View file

@ -32,9 +32,12 @@
#include <regex>
#include <string>
#include <optional>
namespace util {
using std::regex;
using std::smatch;
using std::string;
@ -43,7 +46,7 @@ using std::string;
struct MatchSeq
: std::sregex_iterator
{
MatchSeq(string const& toParse, std::regex const& regex)
MatchSeq(string const& toParse, regex const& regex)
: std::sregex_iterator{toParse.begin(), toParse.end(), regex}
{ }
@ -53,5 +56,32 @@ struct MatchSeq
};
/** encapsulated regex buildable from string */
class Matcher
{
std::optional<regex> pattern_;
public:
Matcher() = default;
Matcher(string const& regexDefinition)
: pattern_{regexDefinition.empty()? std::nullopt
: std::make_optional<regex>(regexDefinition, regex::optimize)}
{ }
// standard copy acceptable
explicit operator bool() const
{
return bool(pattern_);
}
bool matchesWithin(string probe) const
{
return pattern_? std::regex_search(probe, *pattern_)
: true; // undefined pattern matches everything
}
};
}//(End)namespace util
#endif /*TESTRUNNER_UTIL_REGEX_HPP_*/

View file

@ -243,7 +243,7 @@ inline auto computeLinearRegression(DataSpan<RegressionPoint> const& points)
double socket = ym - gradient * xm; // Regression line: Y-ym = gradient · (x-xm) ; set x≔0 yields socket
// Correlation (Pearson's r)
double correlation = wyysum==0.0? 0.0 : gradient * sqrt(varx/vary);
double correlation = wyysum==0.0? 1.0 : gradient * sqrt(varx/vary);
// calculate error Δ for all measurement points
size_t n = points.size();
@ -304,7 +304,7 @@ inline auto computeTimeSeriesLinearRegression(DataSpan<D> const& series)
double socket = ym - gradient * im; // Regression line: Y-ym = Gradient · (i-im) ; set i≔0 yields socket
// Correlation (Pearson's r)
double correlation = yysum==0.0? 0.0 : gradient * sqrt(varx/vary);
double correlation = yysum==0.0? 1.0 : gradient * sqrt(varx/vary);
return make_tuple(socket,gradient,correlation);
}