|
Mantid
|
Ties fitting parameters. More...
#include <ParameterTie.h>
Public Member Functions | |
| virtual std::string | asString (const IFunction *fun=nullptr) const |
| Return the string that can be used to recreate this tie. More... | |
| virtual double | eval (bool setParameterValue=true) |
| Evaluate the expression. More... | |
| bool | findParametersOf (const IFunction *fun) const |
| Check if the tie has any references to certain parameters. More... | |
| std::vector< ParameterReference > | getRHSParameters () const |
| Get a list of parameters on the right-hand side of the equation. More... | |
| bool | isConstant () const |
| Check if the tie is a constant. More... | |
| ParameterTie (IFunction *funct, const std::string &parName, const std::string &expr="", bool isDefault=false) | |
| Constructor. More... | |
| virtual void | set (const std::string &expr) |
| Set the tie expression. More... | |
| ~ParameterTie () override | |
| Destructor. More... | |
Public Member Functions inherited from Mantid::API::ParameterReference | |
| IFunction * | getLocalFunction () const |
| Return pointer to the local function. More... | |
| std::size_t | getLocalIndex () const |
| Return parameter index in the local function. More... | |
| double | getParameter () const |
| Get the value of the parameter. More... | |
| bool | isDefault () const |
| Returns the default value flag. More... | |
| bool | isParameterOf (const IFunction *fun) const |
| Find out if this refers to a parameter of a function: direct or via composite function member. More... | |
| IFunction * | ownerFunction () const |
| std::size_t | parameterIndex () const |
| Return parameter index in the owning function. More... | |
| std::string | parameterName () const |
| Return parameter name in the owning function. More... | |
| ParameterReference () | |
| Default constructor. More... | |
| ParameterReference (IFunction *fun, std::size_t index, bool isDefault=false) | |
| Constructor. More... | |
| void | setParameter (const double &value, bool isExplicitlySet=true) |
| Set the parameter. More... | |
| virtual | ~ParameterReference ()=default |
Protected Attributes | |
| std::string | m_expression |
| Keep the template for the input string passed to this->set(...) In the template CompositeFunction prefixes are replaced with placeholders. More... | |
| IFunction * | m_function1 |
| Keep the function that was passed to the constructor. More... | |
| std::unique_ptr< mu::Parser > | m_parser |
| math parser More... | |
| std::map< double *, ParameterReference > | m_varMap |
| Store for parameters used in the tie. More... | |
Static Private Member Functions | |
| static double * | AddVariable (const char *varName, void *palg) |
| MuParser callback function. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::API::ParameterReference | |
| void | reset (IFunction *fun, std::size_t index, bool isDefault=false) |
| Reset the reference. More... | |
Ties fitting parameters.
A tie is a formula that is used to calculate the value of a function parameter based on the values of other parameters. A tied parameter is not considered independent and doesn't take part in fitting. Its value is always calculated with its tie's formula.
Definition at line 35 of file ParameterTie.h.
| Mantid::API::ParameterTie::ParameterTie | ( | IFunction * | funct, |
| const std::string & | parName, | ||
| const std::string & | expr = "", |
||
| bool | isDefault = false |
||
| ) |
Constructor.
| funct | :: A pointer to the function which parameter will be tied |
| parName | :: The name of the parameter to be tied |
| expr | :: A mathematical expression for the tie |
| isDefault | :: Flag to mark as default the value of an object associated with this reference: a tie or a constraint. |
Definition at line 23 of file ParameterTie.cpp.
References AddVariable(), m_parser, and set().
|
override |
|
staticprivate |
MuParser callback function.
Static callback function used by MuParser to initialize variables implicitly.
| varName | :: The name of a new variable |
| palg | :: Pointer to this ParameterTie |
Definition at line 47 of file ParameterTie.cpp.
References m_function1, m_varMap, and Mantid::API::IFunction::parameterIndex().
Referenced by ParameterTie().
|
virtual |
Return the string that can be used to recreate this tie.
All parameters in the tie must be parameters of fun.
| fun | :: Function that can re-create the tie from the output string. |
Definition at line 125 of file ParameterTie.cpp.
References Mantid::API::ParameterReference::getLocalFunction(), Mantid::API::IFunction::getParameterIndex(), m_expression, m_function1, m_varMap, and Mantid::API::IFunction::parameterName().
Referenced by MantidQt::MantidWidgets::PropertyHandler::initTies(), MantidQt::MantidWidgets::PropertyHandler::renameChildren(), and Mantid::API::IFunction::sortTies().
|
virtual |
Evaluate the expression.
Definition at line 103 of file ParameterTie.cpp.
References m_parser, m_varMap, and Mantid::API::ParameterReference::setParameter().
Referenced by Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::tieApplication().
| bool Mantid::API::ParameterTie::findParametersOf | ( | const IFunction * | fun | ) | const |
Check if the tie has any references to certain parameters.
This method checks if any of the parameters of a function is used in the tie.
| fun | :: A function |
Definition at line 171 of file ParameterTie.cpp.
References Mantid::API::ParameterReference::getLocalFunction(), and m_varMap.
| std::vector< ParameterReference > Mantid::API::ParameterTie::getRHSParameters | ( | ) | const |
Get a list of parameters on the right-hand side of the equation.
Definition at line 186 of file ParameterTie.cpp.
References m_varMap.
| bool Mantid::API::ParameterTie::isConstant | ( | ) | const |
Check if the tie is a constant.
Definition at line 182 of file ParameterTie.cpp.
References m_varMap.
|
virtual |
Set the tie expression.
Set tie expression.
| expr | :: A math expression |
Definition at line 62 of file ParameterTie.cpp.
References Mantid::API::IFunction::getParameterIndex(), m_expression, m_function1, m_parser, m_varMap, Mantid::API::IFunction::parameterName(), and std::to_string().
Referenced by ParameterTie(), and MantidQt::MantidWidgets::FitPropertyBrowser::stringChanged().
|
protected |
Keep the template for the input string passed to this->set(...) In the template CompositeFunction prefixes are replaced with placeholders.
Definition at line 64 of file ParameterTie.h.
Referenced by asString(), and set().
|
protected |
Keep the function that was passed to the constructor.
Definition at line 61 of file ParameterTie.h.
Referenced by AddVariable(), asString(), and set().
|
protected |
math parser
Definition at line 56 of file ParameterTie.h.
Referenced by eval(), ParameterTie(), and set().
|
protected |
Store for parameters used in the tie.
The map's key is address used by the mu::Parser
Definition at line 59 of file ParameterTie.h.
Referenced by AddVariable(), asString(), eval(), findParametersOf(), getRHSParameters(), isConstant(), set(), and ~ParameterTie().