Mantid
Loading...
Searching...
No Matches
CostFuncPoisson.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2019 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
12
13namespace Mantid {
14namespace CurveFitting {
15namespace CostFunctions {
16
17namespace PoissonLossLM {
18double MANTID_CURVEFITTING_DLL calculatePoissonLossLM(double observedCounts, double predicted);
19double MANTID_CURVEFITTING_DLL calculateJacobianScaleFactor(double observedCounts, double predicted);
20template <typename T> int sgn(T val) { return (T(0) < val) - (val < T(0)); }
21} // namespace PoissonLossLM
22
26class MANTID_CURVEFITTING_DLL CostFuncPoisson : public CostFuncFitting {
27public:
30 virtual std::string name() const override { return "Poisson"; }
32 virtual std::string shortName() const override { return "Poisson"; };
33
34 void addVal(API::FunctionDomain_sptr domain, API::FunctionValues_sptr values) const override;
35 void addValDerivHessian(API::IFunction_sptr function, API::FunctionDomain_sptr domain,
36 API::FunctionValues_sptr values, bool evalDeriv = true,
37 bool evalHessian = true) const override;
38
39private:
41 void calculateDerivative(API::IFunction &function, const API::FunctionDomain &domain,
42 API::FunctionValues &values) const;
44 void calculateHessian(API::IFunction &function, const API::FunctionDomain &domain,
45 const API::FunctionValues &values) const;
46};
47
48} // namespace CostFunctions
49} // namespace CurveFitting
50} // namespace Mantid
Base class that represents the domain of a function.
A class to store values calculated by a function.
This is an interface to a fitting function - a semi-abstarct class.
Definition IFunction.h:166
A semi-abstract class for a cost function for fitting functions.
CostFuncPoisson : Implements a cost function for fitting applications using a Poisson measure.
virtual std::string name() const override
Get name of minimizer.
virtual std::string shortName() const override
Get short name of minimizer - useful for say labels in guis.
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:748
std::shared_ptr< FunctionDomain > FunctionDomain_sptr
typedef for a shared pointer
double MANTID_CURVEFITTING_DLL calculateJacobianScaleFactor(double observedCounts, double predicted)
double MANTID_CURVEFITTING_DLL calculatePoissonLossLM(double observedCounts, double predicted)
Helper class which provides the Collimation Length for SANS instruments.