Mantid
Loading...
Searching...
No Matches
CostFuncLeastSquares.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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//----------------------------------------------------------------------
15
16namespace Mantid {
17namespace CurveFitting {
18namespace CostFunctions {
24class MANTID_CURVEFITTING_DLL CostFuncLeastSquares : public CostFuncFitting {
25public:
28
30 std::string name() const override { return "Least squares"; }
31
33 std::string shortName() const override { return "Chi-sq"; };
34
35protected:
36 void calActiveCovarianceMatrix(EigenMatrix &covar, double epsrel = 1e-8) override;
37
38 void addVal(API::FunctionDomain_sptr domain, API::FunctionValues_sptr values) const override;
39 void addValDerivHessian(API::IFunction_sptr function, API::FunctionDomain_sptr domain,
40 API::FunctionValues_sptr values, bool evalDeriv = true,
41 bool evalHessian = true) const override;
42
44 virtual std::vector<double> getFitWeights(API::FunctionValues_sptr values) const;
45
46 double m_factor;
47};
48
49} // namespace CostFunctions
50} // namespace CurveFitting
51} // namespace Mantid
A semi-abstract class for a cost function for fitting functions.
std::string name() const override
Get name of minimizer.
std::string shortName() const override
Get short name of minimizer - useful for say labels in guis.
A wrapper around Eigen::Matrix.
Definition: EigenMatrix.h:33
std::shared_ptr< FunctionValues > FunctionValues_sptr
typedef for a shared pointer
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
std::shared_ptr< FunctionDomain > FunctionDomain_sptr
typedef for a shared pointer
Helper class which provides the Collimation Length for SANS instruments.