BornAgain  1.19.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 reflection and scattering
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_CORE_FITTING_OBJECTIVEMETRICUTILS_H
21 #define BORNAGAIN_CORE_FITTING_OBJECTIVEMETRICUTILS_H
22 
23 #include <functional>
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 class ObjectiveMetric;
29 
30 //! Utility functions related to class ObjectiveMetric.
31 
33 
34 //! Returns L1 normalization function.
35 const std::function<double(double)> l1Norm();
36 //! Returns L2 normalization function.
37 const std::function<double(double)> l2Norm();
38 
39 //! Creates the specified metric with the default norm.
40 std::unique_ptr<ObjectiveMetric> createMetric(const std::string& metric);
41 
42 //! Creates the metric with the specified norm
43 std::unique_ptr<ObjectiveMetric> createMetric(std::string metric, std::string norm);
44 
45 //! Prints available metric options
46 std::string availableMetricOptions();
47 
48 //! Returns the names of the norms used by ObjectiveMetric.
49 std::vector<std::string> normNames();
50 
51 //! Returns the names of the objective metrics used.
52 std::vector<std::string> metricNames();
53 
54 //! Returns default norm name.
55 std::string defaultNormName();
56 
57 //! Returns default metric name.
58 std::string defaultMetricName();
59 
60 } // namespace ObjectiveMetricUtils
61 
62 #endif // BORNAGAIN_CORE_FITTING_OBJECTIVEMETRICUTILS_H
63 #endif // USER_API
Base class for metric implementations.
Utility functions related to class ObjectiveMetric.
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.