mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
XY*Data: helper methods for unidimensional data
This commit is contained in:
parent
2fca987e8f
commit
3d86708e6f
@ -80,6 +80,9 @@ public:
|
||||
const DMatSample & x(const Index k);
|
||||
DSample & y(const Index k, const Index j);
|
||||
const DSample & y(const Index k, const Index j) const;
|
||||
template <typename... Ts>
|
||||
void setUnidimData(const DMatSample &xData,
|
||||
const Ts & ...yDatas);
|
||||
const DMat & getXXVar(const Index i1, const Index i2);
|
||||
const DMat & getYYVar(const Index j1, const Index j2);
|
||||
const DMat & getXYVar(const Index i, const Index j);
|
||||
@ -132,6 +135,25 @@ private:
|
||||
/******************************************************************************
|
||||
* XYSampleData template implementation *
|
||||
******************************************************************************/
|
||||
template <typename... Ts>
|
||||
void XYSampleData::setUnidimData(const DMatSample &xData, const Ts & ...yDatas)
|
||||
{
|
||||
static_assert(static_or<std::is_assignable<DMatSample, Ts>::value...>::value,
|
||||
"y data arguments are not compatible with DMatSample");
|
||||
|
||||
std::vector<const DMatSample *> yData{&yDatas...};
|
||||
|
||||
FOR_STAT_ARRAY(xData, s)
|
||||
FOR_VEC(xData[central], r)
|
||||
{
|
||||
x(r, 0)[s] = xData[s](r);
|
||||
for (unsigned int j = 0; j < yData.size(); ++j)
|
||||
{
|
||||
y(r, j)[s] = (*(yData[j]))[s](r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
SampleFitResult XYSampleData::fit(std::vector<Minimizer *> &minimizer,
|
||||
const DVec &init,
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
void setXYVar(const Index i, const Index j, const DMat &m);
|
||||
void setXError(const Index i, const DVec &err);
|
||||
void setYError(const Index j, const DVec &err);
|
||||
template <typename... Ts>
|
||||
void setUnidimData(const DMat &xData, const Ts & ...yDatas);
|
||||
const DMat & getXXVar(const Index i1, const Index i2) const;
|
||||
const DMat & getYYVar(const Index j1, const Index j2) const;
|
||||
const DMat & getXYVar(const Index i, const Index j) const;
|
||||
@ -135,6 +137,24 @@ private:
|
||||
/******************************************************************************
|
||||
* XYStatData template implementation *
|
||||
******************************************************************************/
|
||||
template <typename... Ts>
|
||||
void XYStatData::setUnidimData(const DMat &xData, const Ts & ...yDatas)
|
||||
{
|
||||
static_assert(static_or<std::is_assignable<DMat, Ts>::value...>::value,
|
||||
"y data arguments are not compatible with DMat");
|
||||
|
||||
std::vector<const DMat *> yData{&yDatas...};
|
||||
|
||||
FOR_VEC(xData, r)
|
||||
{
|
||||
x(r, 0) = xData(r);
|
||||
for (unsigned int j = 0; j < yData.size(); ++j)
|
||||
{
|
||||
y(r, j) = (*(yData[j]))(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
FitResult XYStatData::fit(std::vector<Minimizer *> &minimizer, const DVec &init,
|
||||
const DoubleModel &model, const Ts... models)
|
||||
|
Loading…
Reference in New Issue
Block a user