Go to the documentation of this file.
41 template <
typename T,
typename NUM,
typename OTHER>
52 template <
typename VEC>
56 template <
typename VEC>
59 data.assign(v1.begin(), v1.end());
61 template <
typename VEC>
66 template <
typename VEC1,
typename VEC2>
68 VEC1& vx, VEC2& vy,
const NUM width = 1.0)
const
70 std::vector<double> vvx, vvy;
72 vx.assign(vvx.begin(), vvx.end());
73 vy.assign(vvy.begin(), vvy.end());
77 std::vector<double>& vx, std::vector<double>& vy,
78 const NUM width = 1.0)
const
81 0, *max_element(
data.begin(),
data.end()), width));
107 throw std::logic_error(
"Value generator function is not set.");
108 std::vector<T> baseData(N);
109 std::vector<NUM> errorData(N);
116 baseData.begin(), baseData.end(), errorData.begin(),
errorFun1);
122 throw std::logic_error(
123 "Experiment-related functions are not set.");
124 std::vector<OTHER> intermediate(N);
126 baseData.begin(), baseData.end(), intermediate.begin(),
129 for (
size_t i = 0; i < N; ++i)
130 errorData[i] =
errorFun2(baseData[i], intermediate[i]);
133 NUM res = accumulate(errorData.begin(), errorData.end(), NUM(0)) /
140 std::vector<NUM> errorX,errorY;
142 wnd.
plot(errorX,errorY,
"b-",
"Plot1");
143 NUM maxVal=*std::max_element(errorY.begin(),errorY.end());
144 const std::vector<NUM> dx{res, res}, dy{.0, maxVal};
145 wnd.
plot(dx,dy,
"r-",
"Plot2");
const_iterator end() const
This class provides an easy way of computing histograms for unidimensional real valued variables.
void getData(VEC &v1) const
A high-performance stopwatch, with typical resolution of nanoseconds.
NUM doExperiment(size_t N, double &time, bool showInWindow=false)
CStatisticalAnalyzer(const VEC &v1)
A thred-safe pseudo random number generator, based on an internal MT19937 randomness generator.
Eigen::Matrix< NUM, Eigen::Dynamic, 1 > data
Montecarlo simulation for experiments in 1D.
NUM(* errorFun1)(const T &)
void getDistribution(std::vector< double > &vx, std::vector< double > &vy, const NUM width=1.0) const
NUM(* errorFun2)(const T &, const OTHER &)
OTHER(* intermediateFun)(const T &)
mrpt::random::CRandomGenerator gen
double Tac() noexcept
Stops the stopwatch.
const_iterator begin() const
CHistogram createWithFixedWidth(double min, double max, double binWidth)
Constructor with a fixed bin width.
bool isOpen()
Returns false if the user has already closed the window.
T(* valueGenerator)(mrpt::random::CRandomGenerator &)
void Tic() noexcept
Starts the stopwatch.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
void getHistogram(std::vector< double > &x, std::vector< double > &hits) const
Returns the list of bin centers & hit counts.
This base provides a set of functions for maths stuff.
void add(const double x)
Add an element to the histogram.
void getDistribution(VEC1 &vx, VEC2 &vy, const NUM width=1.0) const
void setData(const VEC &v1)
void plot(const VEC1 &x, const VEC2 &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
Adds a new layer with a 2D plot based on two vectors of X and Y points, using a MATLAB-like syntax.
Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020 | |