1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Fit/Param/Parameters.h
//! @brief Defines class Parameters.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifndef BORNAGAIN_FIT_PARAM_PARAMETERS_H
#define BORNAGAIN_FIT_PARAM_PARAMETERS_H
#include "Base/Type/Field2D.h"
#include "Fit/Param/Parameter.h"
#include <vector>
namespace mumufit {
//! A collection of fit parameters.
class Parameters {
public:
using parameters_t = std::vector<Parameter>;
using const_iterator = parameters_t::const_iterator;
using iterator = parameters_t::iterator;
Parameters() = default;
void add(const Parameter& par);
const_iterator begin() const { return m_parameters.begin(); }
const_iterator end() const { return m_parameters.end(); }
iterator begin() { return m_parameters.begin(); }
iterator end() { return m_parameters.end(); }
size_t size() const { return m_parameters.size(); }
std::vector<double> values() const;
void setValues(const std::vector<double>& values);
std::vector<double> errors() const;
void setErrors(const std::vector<double>& errors);
const Parameter& operator[](const std::string& name) const;
const Parameter& operator[](size_t index) const;
double2d_t correlationMatrix() const { return m_corr_matrix; }
void setCorrelationMatrix(const double2d_t& matrix);
size_t freeParameterCount() const;
private:
bool exists(const std::string& parameter_name) const;
void check_array_size(const std::vector<double>& values) const;
size_t check_index(size_t index) const;
parameters_t m_parameters;
double2d_t m_corr_matrix; //!< correlation matrix
};
} // namespace mumufit
#endif // BORNAGAIN_FIT_PARAM_PARAMETERS_H
|