Mantid
Loading...
Searching...
No Matches
LevenbergMarquardtMinimizer.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include "MantidAPI/IFunction.h"
15#include <gsl/gsl_multifit_nlin.h>
16
17namespace Mantid {
18namespace CurveFitting {
19namespace FuncMinimisers {
26class MANTID_CURVEFITTING_DLL LevenbergMarquardtMinimizer : public API::IFuncMinimizer {
27public:
31
34 std::string name() const override { return "Levenberg-Marquardt"; }
35
37 void initialize(API::ICostFunction_sptr costFunction, size_t maxIterations = 0) override;
39 bool iterate(size_t) override;
41 double costFunctionVal() override;
42
43private:
44 void calCovarianceMatrix(double epsrel, gsl_matrix *covar);
45 int hasConverged();
46
48 std::unique_ptr<GSL_FitData> m_data;
49
51 gsl_multifit_function_fdf gslContainer;
52
54 gsl_multifit_fdfsolver *m_gslSolver;
55
58
60 double m_absError;
61
63 double m_relError;
64};
65
66} // namespace FuncMinimisers
67} // namespace CurveFitting
68} // namespace Mantid
An interface for function minimizers.
Implementing Levenberg-Marquardt by wrapping the IFuncMinimizer interface around the GSL implementati...
gsl_multifit_fdfsolver * m_gslSolver
pointer to the GSL solver doing the work
gsl_multifit_function_fdf gslContainer
GSL minimizer container.
std::string name() const override
Overloading base class methods Name of the minimizer.
API::IFunction_sptr m_function
Stored to access IFunction interface in iterate()
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
std::shared_ptr< ICostFunction > ICostFunction_sptr
define a shared pointer to a cost function
Definition: ICostFunction.h:60
Helper class which provides the Collimation Length for SANS instruments.