Commit a1fabea6 authored by Laurent Belcour's avatar Laurent Belcour

Adding changes of parametrization in the core lib.

parent f62d7b68
......@@ -11,7 +11,8 @@ HEADERS = args.h \
function.h \
plugins_manager.h \
vertical_segment.h \
rational_function.h
rational_function.h \
params.h
SOURCES = plugins_manager.cpp \
vertical_segment.cpp \
......
......@@ -7,7 +7,9 @@
#include "common.h"
#include "args.h"
/*!
#include "params.h"
/*! \brief A data object. Allows to load data from files.
* \ingroup core
*/
class data
......@@ -42,3 +44,54 @@ class data
} ;
Q_DECLARE_INTERFACE(data, "Fitter.Data")
/*! \brief Change the parametrization of data to fit the parametrization of the
* function to be fitted.
*
* \ingroup core
* \internal
*/
class data_params : public data
{
public:
// Load data from a file
virtual void load(const std::string& filename)
{
_d->load(filename);
}
virtual void load(const std::string& filename, const arguments& args)
{
_d->load(filename, args);
}
// Acces to data
virtual vec get(int i) const
{
return _d->get(i);
}
virtual vec operator[](int i) const
{
return (*_d)[i];
}
// Get data size, e.g. the number of samples to fit
virtual int size() const
{
return _d->size();
}
// Get min and max input space values
virtual vec min() const
{
return _d->min();
}
virtual vec max() const
{
return _d->max();
}
protected:
// data object to interface
data* _d;
};
#pragma once
#include "data.h"
/*! \brief a static class allowing to change from one parametrization
* to another.
* \ingroup core
*
* \details
* Any \typedef function object or \typedef data object should have
* an associated parametrization.
*/
class params
{
//! \brief list of all supported parametrization. An unsupported
//! parametrization will go under the name <em>unknown</em>.
enum type
{
unknown
};
//! \brief static function for input type convertion.
static vec convert(const vec& invec, params::type intype, params::type outtype)
{
return invec;
}
};
......@@ -72,4 +72,3 @@ class rational_function : public QObject, public function
std::vector<double> a ;
std::vector<double> b ;
} ;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment