Mantid
Loading...
Searching...
No Matches
MaxEnt.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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
10#include "MantidAlgorithms/DllConfig.h"
13#include "MantidKernel/Matrix.h"
14
15namespace Mantid {
16namespace Algorithms {
17
24class MANTID_ALGORITHMS_DLL MaxEnt : public API::Algorithm {
25public:
26 virtual ~MaxEnt() = default;
28 const std::string name() const override;
30 int version() const override;
31 const std::vector<std::string> seeAlso() const override {
32 return {"ExtractFFTSpectrum", "FFT", "FFTDerivative", "RealFFT", "SassenaFFT", "FFTSmooth"};
33 }
35 const std::string category() const override;
37 const std::string summary() const override;
38
39protected:
41 std::map<std::string, std::string> validateInputs() override;
42
43private:
45 void init() override;
47 void exec() override;
49 std::vector<double> toComplex(API::MatrixWorkspace_const_sptr &inWS, size_t spec, bool errors,
50 bool concatenatedSpectra);
51 // Calculates chi-square by solving the matrix equation A*x = b
52 double calculateChi(const QuadraticCoefficients &coeffs, double a, std::vector<double> &beta);
53 // Calculates the SVD of the input matrix A
54 std::vector<double> solveSVD(Kernel::DblMatrix &A, const Kernel::DblMatrix &B);
56 std::vector<double> move(const QuadraticCoefficients &coeffs, double ChiTargetOverN, double chiEps, size_t alphaIter);
58 std::vector<double> applyDistancePenalty(const std::vector<double> &beta, const QuadraticCoefficients &coeffs,
59 const std::vector<double> &image, double background, double distEps);
61 std::vector<double> updateImage(const std::vector<double> &image, const std::vector<double> &delta,
62 const std::vector<std::vector<double>> &dirs);
63
65 void populateDataWS(API::MatrixWorkspace_const_sptr &inWS, size_t spec, size_t nspec,
66 const std::vector<double> &result, bool concatenatedSpectra, bool complex,
69 void populateImageWS(API::MatrixWorkspace_const_sptr &inWS, size_t spec, size_t nspec,
70 const std::vector<double> &result, bool complex, API::MatrixWorkspace_sptr &outWS,
71 bool autoShift);
73 void validateBinEdges(const std::string &wsName, std::map<std::string, std::string> &messages);
74};
75
76} // namespace Algorithms
77} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
MaxEnt : Entropy maximization algorithm following the approach described in the article by J.
Definition: MaxEnt.h:24
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: MaxEnt.h:31
virtual ~MaxEnt()=default
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.