BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ObjectiveMetricUtils.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Fitting/ObjectiveMetricUtils.h
6 //! @brief Defines ObjectiveMetric utilities and corresponding namespace.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_CORE_FITTING_OBJECTIVEMETRICUTILS_H
16 #define BORNAGAIN_CORE_FITTING_OBJECTIVEMETRICUTILS_H
17 
18 #include <functional>
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 class ObjectiveMetric;
24 
26 {
27 //! Returns L1 normalization function.
28 const std::function<double(double)> l1Norm();
29 //! Returns L2 normalization function.
30 const std::function<double(double)> l2Norm();
31 
32 //! Creates the specified metric with the default norm.
33 std::unique_ptr<ObjectiveMetric> createMetric(const std::string& metric);
34 
35 //! Creates the metric with the specified norm
36 std::unique_ptr<ObjectiveMetric> createMetric(std::string metric, std::string norm);
37 
38 //! Prints available metric options
39 std::string availableMetricOptions();
40 
41 //! Returns the names of the norms used by ObjectiveMetric.
42 std::vector<std::string> normNames();
43 
44 //! Returns the names of the objective metrics used.
45 std::vector<std::string> metricNames();
46 
47 //! Returns default norm name.
48 std::string defaultNormName();
49 
50 //! Returns default metric name.
51 std::string defaultMetricName();
52 } // namespace ObjectiveMetricUtils
53 
54 #endif // BORNAGAIN_CORE_FITTING_OBJECTIVEMETRICUTILS_H
Base class for metric implementations.
const std::function< double(double)> l2Norm()
Returns L2 normalization function.
std::string defaultMetricName()
Returns default metric name.
std::string defaultNormName()
Returns default norm name.
std::string availableMetricOptions()
Prints available metric options.
std::unique_ptr< ObjectiveMetric > createMetric(const std::string &metric)
Creates the specified metric with the default norm.
std::vector< std::string > metricNames()
Returns the names of the objective metrics used.
const std::function< double(double)> l1Norm()
Returns L1 normalization function.
std::vector< std::string > normNames()
Returns the names of the norms used by ObjectiveMetric.