Mantid
|
A composite function is a function containing other functions. More...
#include <CompositeFunction.h>
Public Member Functions | |
double | activeParameter (size_t i) const override |
Value of i-th active parameter. More... | |
virtual size_t | addFunction (IFunction_sptr f) |
Add a function at the back of the internal function list. More... | |
void | applyTies () override |
Apply the ties. More... | |
std::size_t | attributeFunctionIndex (std::size_t i) const |
Get the index of the function to which parameter i belongs. More... | |
std::string | attributeName (size_t i) const override |
Returns the name of attribute i. More... | |
void | checkFunction () |
Check the function. More... | |
void | clear () |
Remove all member functions. More... | |
void | clearTies () override |
Remove all ties. More... | |
CompositeFunction () | |
Default constructor. More... | |
std::vector< std::shared_ptr< IFunction > > | createEquivalentFunctions () const override |
Split this function (if needed) into a list of independent functions. More... | |
std::string | descriptionOfActive (size_t i) const override |
Returns the name of active parameter i. More... | |
void | function (const FunctionDomain &domain, FunctionValues &values) const override |
Function you want to fit to. More... | |
void | functionDeriv (const FunctionDomain &domain, Jacobian &jacobian) override |
Derivatives of function with respect to active parameters. More... | |
std::size_t | functionIndex (const std::string &functionName) const |
Get the first function index with a matching function name. More... | |
std::size_t | functionIndex (std::size_t i) const |
Get the function index. More... | |
Attribute | getAttribute (const std::string &name) const override |
Return a value of attribute attName. More... | |
IConstraint * | getConstraint (size_t i) const override |
Get constraint of i-th parameter. More... | |
IFunction_sptr | getContainingFunction (const ParameterReference &ref) const |
Get the containing function. More... | |
double | getError (const std::string &name) const override |
Get the fitting error for a parameter by name. More... | |
double | getError (size_t i) const override |
Get the fitting error for a parameter. More... | |
double | getError (size_t i, size_t j) const |
Get the fitting error for i-th function's j-th parameter. More... | |
IFunction_sptr | getFunction (std::size_t i) const override |
Returns the pointer to i-th function. More... | |
virtual Attribute | getLocalAttribute (size_t i, const std::string &attName) const |
Return a value of attribute attName. More... | |
virtual std::vector< std::string > | getLocalAttributeNames () const |
Returns a list of attribute names. More... | |
size_t | getNumberDomains () const override |
Get number of domains required by this function. More... | |
double | getParameter (const std::string &name) const override |
Get parameter by name. More... | |
double | getParameter (size_t i) const override |
Get i-th parameter. More... | |
double | getParameter (size_t i, size_t j) const |
Get parameter from i-th function, j-th local parameter index. More... | |
size_t | getParameterIndex (const ParameterReference &ref) const override |
Return parameter index from a parameter reference. More... | |
ParameterStatus | getParameterStatus (size_t i) const override |
Get status of parameter. More... | |
ParameterTie * | getTie (size_t i) const override |
Get the tie of i-th parameter. More... | |
bool | hasAttribute (const std::string &name) const override |
Check if a function has an attribute with this name. More... | |
bool | hasFunction (const std::string &functionName) const |
Returns true if the composite has at least one of this function. More... | |
virtual bool | hasLocalAttribute (const std::string &) const |
Check if attribute attName exists. More... | |
bool | hasParameter (const std::string &name) const override |
Check if function has a parameter with this name. More... | |
bool | isExplicitlySet (size_t i) const override |
Checks if a parameter has been set explicitly. More... | |
std::string | name () const override |
Returns the function's name. More... | |
std::string | nameOfActive (size_t i) const override |
Returns the name of active parameter i. More... | |
size_t | nAttributes () const override |
Returns the number of attributes associated with the function. More... | |
std::size_t | nFunctions () const override |
Number of functions. More... | |
size_t | nGlobalAttributes () const noexcept |
virtual size_t | nLocalAttributes () const |
Returns the number of attributes associated with the function. More... | |
size_t | nParams () const override |
Total number of parameters. More... | |
std::string | parameterDescription (size_t i) const override |
Returns the description of parameter i. More... | |
size_t | parameterIndex (const std::string &name) const override |
Returns the index of parameter name. More... | |
size_t | parameterLocalIndex (size_t i, bool recursive=false) const |
Returns the index of parameter i as it declared in its function. More... | |
std::string | parameterLocalName (size_t i, bool recursive=false) const |
Returns the name of parameter i as it declared in its function. More... | |
std::string | parameterName (size_t i) const override |
Returns the name of parameter i. More... | |
std::string | parameterName (size_t i, size_t j) const |
Returns the name of i-th function's j-th parameter. More... | |
void | registerFunctionUsage (bool internal) override |
Registers the usage of the function with the UsageService. More... | |
void | removeConstraint (const std::string &parName) override |
Remove a constraint. More... | |
void | removeFunction (size_t i) |
Remove a function. More... | |
virtual void | removeTie (const std::string &parName) |
Removes the tie off a parameter. More... | |
virtual bool | removeTie (size_t i) |
Removes i-th parameter's tie. More... | |
bool | removeTie (size_t i) override |
Removes i-th parameter's tie. More... | |
void | replaceFunction (size_t functionIndex, const IFunction_sptr &f) |
Replace a function. More... | |
void | replaceFunctionPtr (const IFunction_sptr &f_old, const IFunction_sptr &f_new) |
Replace a function. More... | |
void | setActiveParameter (size_t i, double value) override |
Set new value of i-th active parameter. More... | |
void | setAttribute (const std::string &name, const API::IFunction::Attribute &value) override |
Set a value of a named attribute. More... | |
void | setError (const std::string &name, double err) override |
Set the fitting error for a parameter by name. More... | |
void | setError (size_t i, double err) override |
Set the fitting error for a parameter. More... | |
virtual void | setLocalAttribute (size_t i, const std::string &attName, const Attribute &) |
Set a value to attribute attName. More... | |
void | setLocalAttributeValue (size_t i, const std::string &attName, const char *value) |
template<typename T > | |
void | setLocalAttributeValue (size_t i, const std::string &attName, const T &value) |
void | setMatrixWorkspace (std::shared_ptr< const API::MatrixWorkspace > workspace, size_t wi, double startX, double endX) override |
Set matrix workspace. More... | |
void | setParameter (const std::string &name, const double &value, bool explicitlySet=true) override |
Set parameter by name. More... | |
void | setParameter (size_t, const double &value, bool explicitlySet=true) override |
Set i-th parameter. More... | |
void | setParameterDescription (const std::string &name, const std::string &description) override |
Set description of parameter by name. More... | |
void | setParameterDescription (size_t, const std::string &description) override |
Set i-th parameter description. More... | |
void | setParameterStatus (size_t i, ParameterStatus status) override |
Change status of parameter. More... | |
void | setStepSizeMethod (const StepSizeMethod stepSizeMethod) override |
Sets the function to use when calculating the step size. More... | |
void | setUpForFit () override |
Prepare function for a fit. More... | |
void | setWorkspace (std::shared_ptr< const Workspace > ws) override |
Sets the workspace for each member function. More... | |
void | updateActive (const double *in) |
Update parameters after a fitting iteration. More... | |
Public Member Functions inherited from Mantid::API::IFunction | |
std::string | asString () const |
Writes itself into a string. More... | |
bool | cancellationRequestReceived () const |
Returns true if a progress reporter is set & evalaution has been requested to stop. More... | |
virtual const std::vector< std::string > | categories () const |
Function to return all of the categories that contain this algorithm. More... | |
virtual const std::string | category () const |
The categories the Fit function belong to. More... | |
virtual const std::string | categorySeparator () const |
Function to return the sperator token for the category string. More... | |
virtual std::shared_ptr< IFunction > | clone () const |
Virtual copy constructor. More... | |
virtual int64_t | estimateNoProgressCalls () const |
Returns an estimate of the number of progress reports a single evaluation of the function will have. More... | |
virtual void | function (const FunctionDomain &domain, FunctionValues &values) const =0 |
Evaluates the function for all arguments in the domain. More... | |
virtual void | functionDeriv (const FunctionDomain &domain, Jacobian &jacobian) |
Derivatives of function with respect to active parameters. More... | |
IFunction () | |
Constructor. More... | |
IFunction (const IFunction &)=delete | |
No copying. More... | |
virtual void | initialize () |
Iinialize the function. More... | |
virtual void | iterationFinished () |
Called at the end of an iteration. More... | |
virtual void | iterationStarting () |
Called at the start of each iteration. More... | |
virtual std::string | name () const =0 |
Returns the function's name. More... | |
IFunction & | operator= (const IFunction &)=delete |
No copying. More... | |
virtual void | registerFunctionUsage (bool internal) |
Registers the usage of the algorithm with the UsageService. More... | |
void | reportProgress (const std::string &msg="") const |
Reports progress with an optional message. More... | |
virtual void | setMatrixWorkspace (std::shared_ptr< const API::MatrixWorkspace > workspace, size_t wi, double startX, double endX) |
Set matrix workspace. More... | |
void | setProgressReporter (std::shared_ptr< Kernel::ProgressBase > reporter) |
Attach a progress reporter. More... | |
virtual void | setWorkspace (std::shared_ptr< const Workspace > ws) |
Set the workspace. More... | |
virtual | ~IFunction () |
Virtual destructor. More... | |
bool | isFixed (size_t i) const |
Check if a parameter i is fixed. More... | |
bool | isFixedByDefault (size_t i) const |
Check if a parameter i is fixed by default (not by user). More... | |
void | fix (size_t i, bool isDefault=false) |
Removes a parameter i from the list of active. More... | |
void | unfix (size_t i) |
Restores a declared parameter i to the active status. More... | |
void | fixParameter (const std::string &name, bool isDefault=false) |
Fix a parameter. More... | |
void | unfixParameter (const std::string &name) |
Free a parameter. More... | |
void | fixAll (bool isDefault=false) |
Fix all parameters. More... | |
void | unfixAll () |
Free all parameters. More... | |
void | unfixAllDefault () |
Free all parameters fixed by default. More... | |
void | fixAllActive (bool isDefault=false) |
Fix all active parameters. More... | |
std::vector< std::string > | getParameterNames () const |
Return a vector with all parameter names. More... | |
bool | isActive (size_t i) const |
Check if an active parameter i is actually active. More... | |
virtual void | tie (const std::string &parName, const std::string &expr, bool isDefault=false) |
Tie a parameter to other parameters (or a constant) More... | |
virtual void | addTies (const std::string &ties, bool isDefault=false) |
Add several ties. More... | |
virtual bool | ignoreTie (const ParameterTie &) const |
Ignore a tie. More... | |
void | sortTies () |
Put all ties in order in which they will be applied correctly. More... | |
std::string | writeTies () const |
Write a parameter tie to a string. More... | |
virtual void | addConstraints (const std::string &str, bool isDefault=false) |
Add a list of conatraints from a string. More... | |
virtual void | addConstraint (std::unique_ptr< IConstraint > ic) |
Add a constraint to function. More... | |
virtual void | setConstraintPenaltyFactor (const std::string &parName, const double &c) |
Set a constraint penalty. More... | |
std::string | writeConstraints () const |
Write a parameter constraint to a string. More... | |
virtual void | clearConstraints () |
Remove all constraints. More... | |
virtual std::vector< std::string > | getAttributeNames () const |
Returns a list of attribute names. More... | |
template<typename T > | |
void | setAttributeValue (const std::string &attName, const T &value) |
Set an attribute value. More... | |
void | setAttributeValue (const std::string &attName, const char *value) |
Overload for const char* values. More... | |
void | setAttributeValue (const std::string &attName, const std::string &value) |
Set string attribute by value. More... | |
virtual std::shared_ptr< IFunction > | getFunction (size_t i) const |
Returns the pointer to i-th child function. More... | |
virtual size_t | getValuesSize (const FunctionDomain &domain) const |
Get number of values for a given domain. More... | |
void | calNumericalDeriv (const FunctionDomain &domain, Jacobian &jacobian) |
Calculate numerical derivatives. More... | |
double | calculateStepSize (const double parameterValue) const |
Calculate step size for the given parameter value. More... | |
void | setCovarianceMatrix (const std::shared_ptr< Kernel::Matrix< double > > &covar) |
Set the covariance matrix. More... | |
std::shared_ptr< const Kernel::Matrix< double > > | getCovarianceMatrix () const |
Get the covariance matrix. More... | |
void | setReducedChiSquared (double chi2) |
Set the reduced chi^2. More... | |
double | getReducedChiSquared () const |
Get the reduced chi^2. More... | |
void | setParallel (bool on) |
Set the parallel hint. More... | |
bool | isParallel () const |
Get the parallel hint. More... | |
void | setHandler (std::unique_ptr< FunctionHandler > handler) |
Set a function handler. More... | |
FunctionHandler * | getHandler () const |
Return the handler. More... | |
Static Public Member Functions | |
static std::pair< std::string, size_t > | parseName (const std::string &varName) |
Extract function index and parameter name from a variable name. More... | |
Protected Member Functions | |
void | declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue) |
Declare a single attribute. More... | |
void | declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue, const Kernel::IValidator &validator) |
Declare a single attribute, with a validator. More... | |
void | declareParameter (const std::string &name, double initValue=0, const std::string &description="") override |
Declare a new parameter. More... | |
void | init () override |
Function initialization. Declare function parameters in this method. More... | |
size_t | paramOffset (size_t i) const |
std::string | writeToString (const std::string &parentLocalAttributesStr="") const override |
Writes itself into a string. More... | |
Protected Member Functions inherited from Mantid::API::IFunction | |
double | convertValue (double value, Kernel::Unit_sptr &outUnit, const std::shared_ptr< const MatrixWorkspace > &ws, size_t wsIndex) const |
Convert a value from one unit (inUnit) to unit defined in workspace (ws) More... | |
void | convertValue (std::vector< double > &values, Kernel::Unit_sptr &outUnit, const std::shared_ptr< const MatrixWorkspace > &ws, size_t wsIndex) const |
Convert values from unit defined in workspace (ws) to outUnit. More... | |
virtual void | declareAttributes () |
Override to declare function attributes. More... | |
virtual void | declareParameters () |
Override to declare function parameters. More... | |
void | declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue) |
Declare a single attribute. More... | |
void | declareAttribute (const std::string &name, const API::IFunction::Attribute &defaultValue, const Kernel::IValidator &validator) |
Declare a single attribute with validator. More... | |
void | checkAttributeName (const std::string &name) |
Check Attribute to declare does not already exist. More... | |
void | storeAttributeValue (const std::string &name, const API::IFunction::Attribute &value) |
Store an attribute's value. More... | |
void | storeReadOnlyAttribute (const std::string &name, const API::IFunction::Attribute &value) const |
A read-only ("mutable") attribute can be stored in a const method. More... | |
virtual void | addTie (std::unique_ptr< ParameterTie > tie) |
Add a new tie. Derived classes must provide storage for ties. More... | |
bool | hasOrderedTies () const |
void | applyOrderedTies () |
Private Member Functions | |
void | createDefaultGlobalAttributes () |
size_t | getAttributeOffset (size_t attributeIndex) const |
Private Attributes | |
std::vector< size_t > | m_attributeIndex |
std::vector< IFunction_sptr > | m_functions |
Pointers to the included functions. More... | |
std::vector< std::string > | m_globalAttributeNames |
size_t | m_iConstraintFunction |
Function counter to be used in nextConstraint. More... | |
std::vector< size_t > | m_IFunction |
Keeps the function index for each declared parameter (parameter declared index) More... | |
size_t | m_nAttributes |
Total number of attributes. More... | |
size_t | m_nParams |
Total number of parameters. More... | |
std::vector< size_t > | m_paramOffsets |
Individual function parameter offsets (function index in m_functions) e.g. More... | |
Additional Inherited Members | |
Public Types inherited from Mantid::API::IFunction | |
enum | ParameterStatus { Active , Fixed , FixedByDefault , Tied } |
Describe parameter status in relation to fitting: Active: Fit varies such parameter directly. More... | |
enum class | StepSizeMethod { DEFAULT , SQRT_EPSILON } |
Describes the method in which the step size will be calculated: DEFAULT: Uses the traditional Mantid method of calculating the step size. More... | |
Protected Attributes inherited from Mantid::API::IFunction | |
bool | m_isParallel |
Flag to hint that the function is being used in parallel computations. More... | |
std::unique_ptr< FunctionHandler > | m_handler |
Pointer to a function handler. More... | |
std::shared_ptr< Kernel::ProgressBase > | m_progReporter |
Pointer to the progress handler. More... | |
A composite function is a function containing other functions.
It combines values calculated by the member function using an operation. The default operation is summation (+). Composite functions do not have their own parameters, they use parameters of the member functions. Functions are added to a composite functions with addFunction method and can be retrieved with getFinction(i) method. Function indices are defined by the order they are added. Parameter names are formed from the member function's index and its parameter name: f[index].[name]. For example, name "f0.Sigma" would be given to the "Sigma" parameter of a Gaussian added first to the composite function. If a member function is a composite function itself the same principle applies: 'f[index].' is prepended to a name, e.g. "f0.f1.Sigma".
The default implementation expects its member to use the same type of FunctionDomain. The domain passed to the function(...) method is used to evaluate all member functions.
Definition at line 44 of file CompositeFunction.h.
Mantid::API::CompositeFunction::CompositeFunction | ( | ) |
Default constructor.
Definition at line 66 of file CompositeFunction.cpp.
Referenced by createEquivalentFunctions(), and Mantid::API::MultiDomainFunction::createEquivalentFunctions().
|
overridevirtual |
Value of i-th active parameter.
Override this method to make fitted parameters different from the declared
Reimplemented from Mantid::API::IFunction.
Definition at line 456 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
|
virtual |
Add a function at the back of the internal function list.
Add a function.
f | :: A pointer to the added function |
Reimplemented in Mantid::CurveFitting::Functions::Convolution, and Mantid::API::ImmutableCompositeFunction.
Definition at line 532 of file CompositeFunction.cpp.
References m_attributeIndex, m_functions, m_IFunction, m_nAttributes, m_nParams, m_paramOffsets, and nGlobalAttributes().
Referenced by Mantid::CurveFitting::Functions::Convolution::addFunction(), Mantid::CurveFitting::Functions::CrystalFieldControl::buildControls(), Mantid::CurveFitting::Functions::CrystalFieldControl::buildPhysPropControls(), Mantid::CurveFitting::Functions::CrystalFieldUtils::buildSpectrumFunction(), checkFunction(), export_CompositeFunction(), export_MultiDomainFunction(), and Mantid::CurveFitting::Functions::CrystalFieldUtils::updateSpectrumFunction().
|
overridevirtual |
Apply the ties.
Reimplemented from Mantid::API::IFunction.
Definition at line 774 of file CompositeFunction.cpp.
References Mantid::API::IFunction::applyOrderedTies(), Mantid::API::IFunction::applyTies(), getFunction(), Mantid::API::IFunction::hasOrderedTies(), and nFunctions().
Referenced by Mantid::CurveFitting::Functions::DiffRotDiscreteCircle::init(), Mantid::CurveFitting::Functions::DiffSphere::init(), and Mantid::CurveFitting::Functions::IsoRotDiff::init().
size_t Mantid::API::CompositeFunction::attributeFunctionIndex | ( | std::size_t | i | ) | const |
Get the index of the function to which parameter i belongs.
i | :: The parameter index |
Definition at line 703 of file CompositeFunction.cpp.
References m_attributeIndex, nAttributes(), and std::to_string().
Referenced by attributeName().
|
overridevirtual |
Returns the name of attribute i.
Returns the name of the ith attribute.
index | :: The index of the attribute |
Reimplemented from Mantid::API::IFunction.
Definition at line 386 of file CompositeFunction.cpp.
References attributeFunctionIndex(), Mantid::API::IFunction::attributeName(), functionIndex(), getAttributeOffset(), index, m_functions, and nGlobalAttributes().
Referenced by getAttribute(), hasAttribute(), and setAttribute().
void Mantid::API::CompositeFunction::checkFunction | ( | ) |
Check the function.
Makes sure that the function is consistent.
Definition at line 498 of file CompositeFunction.cpp.
References addFunction(), m_attributeIndex, m_functions, m_IFunction, m_nAttributes, m_nParams, m_paramOffsets, and nGlobalAttributes().
Referenced by Mantid::CurveFitting::Functions::Convolution::addFunction(), and Mantid::CurveFitting::Functions::CrystalFieldFunction::createEquivalentFunctions().
void Mantid::API::CompositeFunction::clear | ( | ) |
Remove all member functions.
Definition at line 519 of file CompositeFunction.cpp.
References m_attributeIndex, m_functions, m_IFunction, m_nAttributes, m_nParams, m_paramOffsets, and nGlobalAttributes().
|
overridevirtual |
Remove all ties.
Clear the ties.
Reimplemented from Mantid::API::IFunction.
Definition at line 788 of file CompositeFunction.cpp.
References Mantid::API::IFunction::clearTies(), getFunction(), and nFunctions().
|
private |
Definition at line 70 of file CompositeFunction.cpp.
References declareAttribute(), m_globalAttributeNames, and m_nAttributes.
|
overridevirtual |
Split this function (if needed) into a list of independent functions.
The number of functions must be the number of domains this function is working on (== getNumberDomains()). The result of evaluation of the created functions on their domains must be the same as if this function was evaluated on the composition of those domains.
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 981 of file CompositeFunction.cpp.
References Mantid::API::IFunction::asString(), CompositeFunction(), createEquivalentFunctions(), getFunction(), getNumberDomains(), Mantid::Kernel::SingletonHolder< T >::Instance(), and nFunctions().
Referenced by createEquivalentFunctions().
|
protected |
Declare a single attribute.
Declares a single (global) attribute on the composite function.
name | :: The name of the attribute |
defaultValue | :: A default value |
Definition at line 839 of file CompositeFunction.cpp.
References Mantid::API::IFunction::declareAttribute(), m_globalAttributeNames, and name().
Referenced by Mantid::CurveFitting::Functions::CrystalFieldControl::buildControls(), createDefaultGlobalAttributes(), Mantid::CurveFitting::Functions::CrystalFieldControl::CrystalFieldControl(), Mantid::CurveFitting::Functions::DiffRotDiscreteCircle::declareAttribute(), and Mantid::CurveFitting::Functions::DiffSphere::declareAttribute().
|
protected |
Declare a single attribute, with a validator.
Declares a single (global) attribute on the composite function, with a validator.
name | :: The name of the attribute |
defaultValue | :: A default value |
validator | :: validator to restrict attribute values |
Definition at line 850 of file CompositeFunction.cpp.
References Mantid::API::IFunction::declareAttribute(), m_globalAttributeNames, and name().
|
overrideprotectedvirtual |
Declare a new parameter.
To used in the implementation's constructor.
name | :: The parameter name. |
initValue | :: The initial value for the parameter |
description | :: Parameter documentation |
Implements Mantid::API::IFunction.
Definition at line 828 of file CompositeFunction.cpp.
References name().
|
overridevirtual |
Returns the name of active parameter i.
Returns the description of active parameter i.
Reimplemented from Mantid::API::IFunction.
Definition at line 477 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
|
overridevirtual |
Function you want to fit to.
domain | :: An instance of FunctionDomain with the function arguments. |
values | :: A FunctionValues instance for storing the calculated values. |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::CurveFitting::Functions::Convolution, Mantid::CurveFitting::Functions::ProductFunction, and Mantid::API::MultiDomainFunction.
Definition at line 191 of file CompositeFunction.cpp.
References m_functions, nFunctions(), tmp, and Mantid::API::FunctionValues::zeroCalculated().
Referenced by functionIndex(), hasFunction(), nAttributes(), and setStepSizeMethod().
|
overridevirtual |
Derivatives of function with respect to active parameters.
domain | :: Function domain to get the arguments from. |
jacobian | :: A Jacobian to store the derivatives. |
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::CurveFitting::Functions::Convolution, Mantid::CurveFitting::Functions::ProductFunction, and Mantid::API::MultiDomainFunction.
Definition at line 205 of file CompositeFunction.cpp.
References Mantid::API::IFunction::calNumericalDeriv(), getAttribute(), getFunction(), nFunctions(), and paramOffset().
std::size_t Mantid::API::CompositeFunction::functionIndex | ( | const std::string & | functionName | ) | const |
Get the first function index with a matching function name.
Gets the index of the first function with a matching function string.
functionName | :: The name of the function to search for. |
Definition at line 675 of file CompositeFunction.cpp.
References function(), and m_functions.
Referenced by activeParameter(), attributeName(), descriptionOfActive(), getAttributeOffset(), getConstraint(), getError(), getParameter(), getParameterStatus(), getTie(), isExplicitlySet(), Mantid::API::ParameterReference::isParameterOf(), nameOfActive(), parameterDescription(), parameterLocalIndex(), parameterLocalName(), parameterName(), removeConstraint(), removeFunction(), removeTie(), replaceFunction(), Mantid::API::ParameterReference::reset(), setActiveParameter(), setError(), setParameter(), setParameterDescription(), and setParameterStatus().
size_t Mantid::API::CompositeFunction::functionIndex | ( | std::size_t | i | ) | const |
Get the function index.
Get the index of the function to which parameter i belongs.
i | :: The parameter index |
Definition at line 691 of file CompositeFunction.cpp.
References m_IFunction, nParams(), and std::to_string().
|
overridevirtual |
Return a value of attribute attName.
name | :: Returns the named attribute |
Reimplemented from Mantid::API::IFunction.
Definition at line 319 of file CompositeFunction.cpp.
References attributeName(), Mantid::API::IFunction::getAttribute(), index, m_functions, m_globalAttributeNames, name(), and parseName().
Referenced by Mantid::CurveFitting::Functions::Convolution::addFunction(), Mantid::CurveFitting::Functions::CrystalFieldControl::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldControl::cacheAttributes(), functionDeriv(), Mantid::API::MultiDomainFunction::functionDeriv(), Mantid::CurveFitting::Functions::CrystalFieldControl::parseStringListAttribute(), setUpForFit(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteSingleSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteSingleSpectrum(), and writeToString().
|
private |
Definition at line 1005 of file CompositeFunction.cpp.
References functionIndex(), and m_attributeIndex.
Referenced by attributeName().
|
overridevirtual |
Get constraint of i-th parameter.
Get constraint.
i | :: the index |
Reimplemented from Mantid::API::IFunction.
Definition at line 892 of file CompositeFunction.cpp.
References functionIndex(), Mantid::API::IFunction::getConstraint(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::getConstraint().
IFunction_sptr Mantid::API::CompositeFunction::getContainingFunction | ( | const ParameterReference & | ref | ) | const |
Get the containing function.
Returns the shared pointer to the function containing a parameter.
ref | :: The reference |
Definition at line 950 of file CompositeFunction.cpp.
References getFunction(), and nFunctions().
|
overridevirtual |
Get the fitting error for a parameter by name.
name | :: The name of the parameter. |
Implements Mantid::API::IFunction.
Definition at line 429 of file CompositeFunction.cpp.
References getFunction(), index, name(), parameterName(), and parseName().
|
overridevirtual |
Get the fitting error for a parameter.
i | :: The index of a parameter |
Implements Mantid::API::IFunction.
Definition at line 412 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::getError().
double Mantid::API::CompositeFunction::getError | ( | size_t | i, |
size_t | j | ||
) | const |
Get the fitting error for i-th function's j-th parameter.
Get the fitting error for the i-th function's j-th parameter.
i | :: The index of the i-th function |
j | :: The index of the i-th function's j-th parameter |
Definition at line 422 of file CompositeFunction.cpp.
References m_functions.
|
override |
Returns the pointer to i-th function.
i | :: The index of the function |
Definition at line 661 of file CompositeFunction.cpp.
References m_functions, nFunctions(), and std::to_string().
Referenced by Mantid::CurveFitting::Functions::Convolution::addFunction(), applyTies(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildAttributeNames(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildMultiSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSingleSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldControl::cacheAttributes(), Mantid::CurveFitting::Functions::ComptonScatteringCountRate::cacheFunctions(), Mantid::CurveFitting::Functions::CrystalFieldControl::checkConsistent(), clearTies(), createEquivalentFunctions(), Mantid::API::MultiDomainFunction::createEquivalentFunctions(), Mantid::CurveFitting::Functions::CrystalFieldFunction::createEquivalentFunctions(), export_CompositeFunction(), export_MultiDomainFunction(), Mantid::API::MultiDomainFunction::function(), functionDeriv(), Mantid::API::MultiDomainFunction::functionDeriv(), Mantid::CurveFitting::Functions::Convolution::functionDirectMode(), Mantid::CurveFitting::Functions::Convolution::functionFFTMode(), Mantid::CurveFitting::Functions::CrystalFieldFunction::getAttributeReference(), getContainingFunction(), getError(), getNumberDomains(), getParameter(), getParameterIndex(), Mantid::CurveFitting::Functions::Convolution::innerFunctionsAre1D(), Mantid::API::MultiDomainFunction::iterationFinished(), Mantid::API::MultiDomainFunction::iterationStarting(), Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsMultiSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsSingleSiteMultiSpectrum(), parameterIndex(), Mantid::CurveFitting::Functions::Convolution::refreshResolution(), registerFunctionUsage(), removeConstraint(), removeFunction(), replaceFunction(), Mantid::CurveFitting::Functions::Convolution::setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldControl::setAttribute(), setError(), setParameter(), setParameterDescription(), setUpForFit(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateMultiSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSingleSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::updateSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldUtils::updateSpectrumFunction(), and writeToString().
|
inlinevirtual |
Return a value of attribute attName.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 192 of file CompositeFunction.h.
Referenced by writeToString().
|
inlinevirtual |
Returns a list of attribute names.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 190 of file CompositeFunction.h.
Referenced by writeToString().
|
overridevirtual |
Get number of domains required by this function.
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 961 of file CompositeFunction.cpp.
References getFunction(), getNumberDomains(), n, and nFunctions().
Referenced by createEquivalentFunctions(), and getNumberDomains().
|
overridevirtual |
Get parameter by name.
Parameters by name.
name | :: The name of the parameter. |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 310 of file CompositeFunction.cpp.
References getFunction(), index, name(), parameterName(), and parseName().
|
overridevirtual |
Get i-th parameter.
Get the i-th parameter.
i | :: The parameter index |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 240 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by export_CompositeFunction(), Mantid::API::ImmutableCompositeFunction::getParameter(), and Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameter().
double Mantid::API::CompositeFunction::getParameter | ( | size_t | i, |
size_t | j | ||
) | const |
Get parameter from i-th function, j-th local parameter index.
Get the j-th parameter from the i-th function.
i | :: The function index |
j | :: The i-th function's j-th parameter |
Definition at line 250 of file CompositeFunction.cpp.
References m_functions.
|
overridevirtual |
Return parameter index from a parameter reference.
Returns the index of parameter if the ref points to one of the member function.
ref | :: A reference to a parameter |
Implements Mantid::API::IFunction.
Definition at line 931 of file CompositeFunction.cpp.
References getFunction(), Mantid::API::ParameterReference::getLocalFunction(), Mantid::API::ParameterReference::getLocalIndex(), m_paramOffsets, nFunctions(), and nParams().
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameterIndex().
|
overridevirtual |
Get status of parameter.
Implements Mantid::API::IFunction.
Definition at line 491 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::getParameterStatus().
|
overridevirtual |
Get the tie of i-th parameter.
i | :: The parameter index |
Reimplemented from Mantid::API::IFunction.
Definition at line 813 of file CompositeFunction.cpp.
References functionIndex(), Mantid::API::IFunction::getTie(), m_functions, m_paramOffsets, and Mantid::API::IFunction::tie().
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::getTie(), removeFunction(), and setUpForFit().
|
overridevirtual |
Check if a function has an attribute with this name.
Check if function has a attribute with a particular name.
name | :: A name of a attribute. |
Reimplemented from Mantid::API::IFunction.
Definition at line 271 of file CompositeFunction.cpp.
References attributeName(), index, m_functions, m_globalAttributeNames, name(), and parseName().
bool Mantid::API::CompositeFunction::hasFunction | ( | const std::string & | functionName | ) | const |
Returns true if the composite has at least one of this function.
functionName | :: The function name to search for. |
Definition at line 651 of file CompositeFunction.cpp.
References function(), and m_functions.
|
inlinevirtual |
Check if attribute attName exists.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 202 of file CompositeFunction.h.
|
overridevirtual |
Check if function has a parameter with this name.
Check if function has a parameter with a particular name.
name | :: A name of a parameter. |
Implements Mantid::API::IFunction.
Definition at line 257 of file CompositeFunction.cpp.
References index, m_functions, name(), parameterName(), and parseName().
|
overrideprotectedvirtual |
Function initialization. Declare function parameters in this method.
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::CurveFitting::Functions::Convolution, Mantid::CurveFitting::Functions::DiffRotDiscreteCircle, Mantid::CurveFitting::Functions::DiffSphere, Mantid::CurveFitting::Functions::IsoRotDiff, and Mantid::CurveFitting::Functions::ProductFunction.
Definition at line 77 of file CompositeFunction.cpp.
|
overridevirtual |
Checks if a parameter has been set explicitly.
Checks if a constraint has been explicitly set.
i | :: The parameter index |
Implements Mantid::API::IFunction.
Definition at line 920 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::isExplicitlySet().
|
inlineoverridevirtual |
Returns the function's name.
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction, Mantid::API::MultiDomainFunction, Mantid::CurveFitting::Functions::ComptonScatteringCountRate, Mantid::CurveFitting::Functions::Convolution, Mantid::CurveFitting::Functions::DiffRotDiscreteCircle, Mantid::CurveFitting::Functions::DiffSphere, Mantid::CurveFitting::Functions::IsoRotDiff, and Mantid::CurveFitting::Functions::ProductFunction.
Definition at line 52 of file CompositeFunction.h.
Referenced by declareAttribute(), declareParameter(), getAttribute(), getError(), getParameter(), hasAttribute(), hasParameter(), parameterIndex(), setAttribute(), Mantid::CurveFitting::Functions::CrystalFieldControl::setAttribute(), setError(), setParameter(), setParameterDescription(), and writeToString().
|
overridevirtual |
Returns the name of active parameter i.
Reimplemented from Mantid::API::IFunction.
Definition at line 469 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
|
overridevirtual |
Returns the number of attributes associated with the function.
Reimplemented from Mantid::API::IFunction.
Definition at line 348 of file CompositeFunction.cpp.
References function(), m_functions, and nGlobalAttributes().
Referenced by attributeFunctionIndex().
|
inlineoverridevirtual |
Number of functions.
Reimplemented from Mantid::API::IFunction.
Definition at line 162 of file CompositeFunction.h.
Referenced by Mantid::CurveFitting::Functions::Convolution::addFunction(), applyTies(), Mantid::CurveFitting::Functions::CrystalFieldFunction::buildAttributeNames(), Mantid::CurveFitting::Functions::ComptonScatteringCountRate::cacheFunctions(), Mantid::CurveFitting::Functions::CrystalFieldControl::checkConsistent(), clearTies(), createEquivalentFunctions(), Mantid::API::MultiDomainFunction::createEquivalentFunctions(), export_CompositeFunction(), export_MultiDomainFunction(), Mantid::CurveFitting::Functions::Convolution::function(), function(), Mantid::API::MultiDomainFunction::function(), functionDeriv(), Mantid::API::MultiDomainFunction::functionDeriv(), Mantid::CurveFitting::Functions::Convolution::functionFFTMode(), Mantid::CurveFitting::Functions::CrystalFieldFunction::getAttributeReference(), getContainingFunction(), getFunction(), Mantid::API::MultiDomainFunction::getLocalAttribute(), getNumberDomains(), getParameterIndex(), Mantid::CurveFitting::Functions::Convolution::innerFunctionsAre1D(), Mantid::API::MultiDomainFunction::iterationFinished(), Mantid::API::MultiDomainFunction::iterationStarting(), Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsMultiSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::makeMapsSingleSiteMultiSpectrum(), Mantid::CurveFitting::Functions::CrystalFieldFunction::nSpectra(), registerFunctionUsage(), removeFunction(), replaceFunction(), Mantid::CurveFitting::Functions::Convolution::setAttribute(), Mantid::API::MultiDomainFunction::setLocalAttribute(), setMatrixWorkspace(), setUpForFit(), Mantid::CurveFitting::Functions::CrystalFieldUtils::updateSpectrumFunction(), and writeToString().
|
inlinenoexcept |
Definition at line 95 of file CompositeFunction.h.
Referenced by addFunction(), attributeName(), checkFunction(), clear(), nAttributes(), and writeToString().
|
inlinevirtual |
Returns the number of attributes associated with the function.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 188 of file CompositeFunction.h.
|
overridevirtual |
Total number of parameters.
Implements Mantid::API::IFunction.
Definition at line 345 of file CompositeFunction.cpp.
References m_nParams.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::buildSourceFunction(), functionIndex(), getParameterIndex(), removeFunction(), and setUpForFit().
|
overridevirtual |
Returns the description of parameter i.
Returns the description of parameter.
i | :: The index |
Implements Mantid::API::IFunction.
Definition at line 401 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::parameterDescription().
|
overridevirtual |
Returns the index of parameter name.
name | :: The name of a parameter |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 358 of file CompositeFunction.cpp.
References getFunction(), index, m_paramOffsets, name(), parameterName(), and parseName().
Referenced by Mantid::API::ImmutableCompositeFunction::parameterIndex(), removeConstraint(), and Mantid::API::ImmutableCompositeFunction::setAlias().
size_t Mantid::API::CompositeFunction::parameterLocalIndex | ( | size_t | i, |
bool | recursive = false |
||
) | const |
Returns the index of parameter i as it declared in its function.
i | :: The parameter index |
recursive | :: If true call parameterLocalName recursively until a non-composite function is reached. |
Definition at line 740 of file CompositeFunction.cpp.
References functionIndex(), m_functions, m_paramOffsets, and parameterLocalIndex().
Referenced by parameterLocalIndex().
std::string Mantid::API::CompositeFunction::parameterLocalName | ( | size_t | i, |
bool | recursive = false |
||
) | const |
Returns the name of parameter i as it declared in its function.
i | :: The parameter index |
recursive | :: If true call parameterLocalName recursively until a non-composite function is reached. |
Definition at line 758 of file CompositeFunction.cpp.
References functionIndex(), m_functions, m_paramOffsets, and parameterLocalName().
Referenced by parameterLocalName(), and removeConstraint().
|
overridevirtual |
Returns the name of parameter i.
Returns the name of parameter.
i | :: The index |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 366 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by getError(), getParameter(), hasParameter(), parameterIndex(), Mantid::API::ImmutableCompositeFunction::parameterName(), setError(), setParameter(), and setParameterDescription().
std::string Mantid::API::CompositeFunction::parameterName | ( | size_t | i, |
size_t | j | ||
) | const |
Returns the name of i-th function's j-th parameter.
i | :: The function index |
j | :: The local index of the parameter relative to the function index |
Definition at line 377 of file CompositeFunction.cpp.
References m_functions.
|
inlineprotected |
Definition at line 230 of file CompositeFunction.h.
Referenced by Mantid::CurveFitting::Functions::ComptonScatteringCountRate::cacheFunctions(), functionDeriv(), and Mantid::API::MultiDomainFunction::functionDeriv().
|
static |
Extract function index and parameter name from a variable name.
varName | :: The variable name which may contain function index ( [f<index.>]name ) |
Definition at line 716 of file CompositeFunction.cpp.
References index.
Referenced by getAttribute(), getError(), getParameter(), hasAttribute(), hasParameter(), parameterIndex(), setAttribute(), setError(), setParameter(), and setParameterDescription().
|
overridevirtual |
Registers the usage of the function with the UsageService.
Reimplemented from Mantid::API::IFunction.
Definition at line 859 of file CompositeFunction.cpp.
References getFunction(), and nFunctions().
|
overridevirtual |
Remove a constraint.
parName | :: The name of a parameter which constraint to remove. |
Reimplemented from Mantid::API::IFunction.
Definition at line 904 of file CompositeFunction.cpp.
References functionIndex(), Mantid::API::IFunction::getConstraint(), getFunction(), parameterIndex(), parameterLocalName(), and Mantid::API::IFunction::removeConstraint().
void Mantid::API::CompositeFunction::removeFunction | ( | size_t | i | ) |
Remove a function.
i | :: The index of the function to remove |
Definition at line 551 of file CompositeFunction.cpp.
References functionIndex(), getFunction(), getTie(), m_attributeIndex, m_functions, m_IFunction, m_nAttributes, m_nParams, m_paramOffsets, nFunctions(), nParams(), removeTie(), Mantid::API::IFunction::tie(), and std::to_string().
Referenced by Mantid::CurveFitting::Functions::Convolution::addFunction(), and export_CompositeFunction().
|
virtual |
Removes the tie off a parameter.
The parameter becomes active This method can be used when constructing and editing the IFunction in a GUI
parName | :: The name of the parameter which ties will be removed. |
Reimplemented from Mantid::API::IFunction.
Definition at line 550 of file IFunction.cpp.
|
virtual |
Removes i-th parameter's tie.
Removes i-th parameter's tie if it is tied or does nothing.
i | :: The index of the tied parameter. |
Reimplemented from Mantid::API::IFunction.
Definition at line 554 of file IFunction.cpp.
|
overridevirtual |
Removes i-th parameter's tie.
Removes i-th parameter's tie if it is tied or does nothing.
i | :: The index of the tied parameter. |
Reimplemented from Mantid::API::IFunction.
Definition at line 799 of file CompositeFunction.cpp.
References functionIndex(), m_functions, m_paramOffsets, and Mantid::API::IFunction::removeTie().
Referenced by removeFunction().
void Mantid::API::CompositeFunction::replaceFunction | ( | size_t | functionIndex, |
const IFunction_sptr & | f | ||
) |
Replace a function.
Replace a function with a new one.
The old function is deleted.
functionIndex | :: The index of the function to replace |
f | :: A pointer to the new function |
Definition at line 616 of file CompositeFunction.cpp.
References functionIndex(), getFunction(), m_attributeIndex, m_functions, m_IFunction, m_nAttributes, m_nParams, m_paramOffsets, nFunctions(), and std::to_string().
Referenced by export_CompositeFunction(), and replaceFunctionPtr().
void Mantid::API::CompositeFunction::replaceFunctionPtr | ( | const IFunction_sptr & | f_old, |
const IFunction_sptr & | f_new | ||
) |
Replace a function.
Replace a function with a new one.
The old function is deleted. The new function must have already its workspace set.
f_old | :: The pointer to the function to replace. If it's not a member of this composite function nothing happens |
f_new | :: A pointer to the new function |
Definition at line 604 of file CompositeFunction.cpp.
References m_functions, and replaceFunction().
|
overridevirtual |
Set new value of i-th active parameter.
Override this method to make fitted parameters different from the declared
Reimplemented from Mantid::API::IFunction.
Definition at line 463 of file CompositeFunction.cpp.
References functionIndex(), m_functions, m_paramOffsets, and value.
|
overridevirtual |
Set a value of a named attribute.
name | :: The name of the attribute |
value | :: The value of the attribute |
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::CurveFitting::Functions::Convolution, Mantid::CurveFitting::Functions::DiffRotDiscreteCircle, Mantid::CurveFitting::Functions::DiffSphere, Mantid::CurveFitting::Functions::IsoRotDiff, Mantid::CurveFitting::Functions::CrystalFieldControl, and Mantid::CurveFitting::Functions::ComptonScatteringCountRate.
Definition at line 336 of file CompositeFunction.cpp.
References attributeName(), index, m_functions, m_globalAttributeNames, name(), parseName(), Mantid::API::IFunction::setAttribute(), and value.
Referenced by Mantid::CurveFitting::Functions::Convolution::setAttribute(), Mantid::CurveFitting::Functions::DiffRotDiscreteCircle::setAttribute(), Mantid::CurveFitting::Functions::DiffSphere::setAttribute(), and Mantid::CurveFitting::Functions::ComptonScatteringCountRate::setAttribute().
|
overridevirtual |
Set the fitting error for a parameter by name.
Sets the fitting error to a parameter by name.
name | :: The name of the parameter. |
err | :: The error value to set |
Implements Mantid::API::IFunction.
Definition at line 449 of file CompositeFunction.cpp.
References getFunction(), index, name(), parameterName(), and parseName().
|
overridevirtual |
Set the fitting error for a parameter.
i | :: The index of a parameter |
err | :: The error value to set |
Implements Mantid::API::IFunction.
Definition at line 439 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::CrystalFieldFunction::setError().
|
inlinevirtual |
Set a value to attribute attName.
Reimplemented in Mantid::API::MultiDomainFunction.
Definition at line 197 of file CompositeFunction.h.
|
inline |
Definition at line 206 of file CompositeFunction.h.
References value.
|
inline |
Definition at line 203 of file CompositeFunction.h.
References value.
|
overridevirtual |
Set matrix workspace.
workspace | :: A workspace to fit to. |
wi | :: An index of a spectrum to fit to. |
startX | :: A start of the fitting region. |
endX | :: An end of the fitting region. |
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::CurveFitting::Functions::ComptonScatteringCountRate.
Definition at line 171 of file CompositeFunction.cpp.
References m_functions, nFunctions(), and workspace.
Referenced by Mantid::CurveFitting::Functions::ComptonScatteringCountRate::setMatrixWorkspace().
|
overridevirtual |
Set parameter by name.
Sets a new value to a parameter by name.
name | :: The name of the parameter. |
value | :: The new value |
explicitlySet | :: A boolean flagging the parameter as explicitly set (by user) |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 290 of file CompositeFunction.cpp.
References getFunction(), index, name(), parameterName(), parseName(), and value.
|
overridevirtual |
Set i-th parameter.
Sets a new value to the i-th parameter.
i | :: The parameter index |
value | :: The new value |
explicitlySet | :: A boolean falgging the parameter as explicitly set (by user) |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 222 of file CompositeFunction.cpp.
References functionIndex(), m_functions, m_paramOffsets, and value.
Referenced by export_CompositeFunction(), Mantid::CurveFitting::Functions::ComptonScatteringCountRate::setFixedParameterValues(), Mantid::API::ImmutableCompositeFunction::setParameter(), and Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameter().
|
overridevirtual |
Set description of parameter by name.
Sets a new description to a parameter by name.
name | :: The name of the parameter. |
description | :: The new description |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 300 of file CompositeFunction.cpp.
References getFunction(), index, name(), parameterName(), and parseName().
|
overridevirtual |
Set i-th parameter description.
Sets a new description to the i-th parameter.
i | :: The parameter index |
description | :: The new description |
Implements Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 231 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::API::ImmutableCompositeFunction::setParameterDescription(), and Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameterDescription().
|
overridevirtual |
Change status of parameter.
Implements Mantid::API::IFunction.
Definition at line 485 of file CompositeFunction.cpp.
References functionIndex(), m_functions, and m_paramOffsets.
Referenced by Mantid::CurveFitting::Functions::ComptonScatteringCountRate::cacheBackground(), Mantid::CurveFitting::Functions::ComptonScatteringCountRate::cacheComptonProfile(), and Mantid::CurveFitting::Functions::CrystalFieldFunction::setParameterStatus().
|
overridevirtual |
Sets the function to use when calculating the step size.
stepSizeMethod | :: An enum indicating which method to use when calculating the step size. |
Reimplemented from Mantid::API::IFunction.
Definition at line 181 of file CompositeFunction.cpp.
References function(), and m_functions.
|
overridevirtual |
Prepare function for a fit.
Prepare the function for a fit.
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::CurveFitting::Functions::Convolution.
Definition at line 868 of file CompositeFunction.cpp.
References Mantid::API::g_log, getAttribute(), getFunction(), getTie(), nFunctions(), nParams(), Mantid::API::IFunction::setUpForFit(), Mantid::API::IFunction::tie(), and Mantid::Kernel::Logger::warning().
|
overridevirtual |
Sets the workspace for each member function.
ws | A pointer to the workspace being fitted |
Reimplemented from Mantid::API::IFunction.
Definition at line 157 of file CompositeFunction.cpp.
References m_functions.
void Mantid::API::CompositeFunction::updateActive | ( | const double * | in | ) |
Update parameters after a fitting iteration.
|
overrideprotectedvirtual |
Writes itself into a string.
Functions derived from CompositeFunction may need to override this method with something like this: std::string NewFunction::writeToString()const { ostr << "composite=" << this->name() << ';'; // write NewFunction's own attributes and parameters ostr << CompositeFunction::asString(); // write NewFunction's own ties and constraints // ostr << ";constraints=(" << ... <<")"; }
parentLocalAttributesStr | :: A preformatted string with parent's local attributes. Can be passed in by a CompositeFunction (eg MultiDomainFunction). |
Reimplemented from Mantid::API::IFunction.
Reimplemented in Mantid::API::ImmutableCompositeFunction.
Definition at line 95 of file CompositeFunction.cpp.
References getAttribute(), getFunction(), getLocalAttribute(), getLocalAttributeNames(), m_globalAttributeNames, name(), nFunctions(), nGlobalAttributes(), Mantid::API::IFunction::Attribute::value(), Mantid::API::IFunction::writeConstraints(), and Mantid::API::IFunction::writeTies().
|
private |
Definition at line 248 of file CompositeFunction.h.
Referenced by addFunction(), attributeFunctionIndex(), checkFunction(), clear(), getAttributeOffset(), removeFunction(), and replaceFunction().
|
private |
Pointers to the included functions.
Definition at line 236 of file CompositeFunction.h.
Referenced by activeParameter(), addFunction(), attributeName(), checkFunction(), clear(), descriptionOfActive(), function(), functionIndex(), getAttribute(), getConstraint(), getError(), getFunction(), getParameter(), getParameterStatus(), getTie(), hasAttribute(), hasFunction(), hasParameter(), isExplicitlySet(), nameOfActive(), nAttributes(), parameterDescription(), parameterLocalIndex(), parameterLocalName(), parameterName(), removeFunction(), removeTie(), replaceFunction(), replaceFunctionPtr(), setActiveParameter(), setAttribute(), setError(), setMatrixWorkspace(), setParameter(), setParameterDescription(), setParameterStatus(), setStepSizeMethod(), and setWorkspace().
|
private |
Definition at line 257 of file CompositeFunction.h.
Referenced by createDefaultGlobalAttributes(), declareAttribute(), getAttribute(), hasAttribute(), setAttribute(), and writeToString().
|
mutableprivate |
Function counter to be used in nextConstraint.
Definition at line 254 of file CompositeFunction.h.
|
private |
Keeps the function index for each declared parameter (parameter declared index)
Definition at line 243 of file CompositeFunction.h.
Referenced by addFunction(), checkFunction(), clear(), functionIndex(), removeFunction(), and replaceFunction().
|
private |
Total number of attributes.
Definition at line 252 of file CompositeFunction.h.
Referenced by addFunction(), checkFunction(), clear(), createDefaultGlobalAttributes(), removeFunction(), and replaceFunction().
|
private |
Total number of parameters.
Definition at line 250 of file CompositeFunction.h.
Referenced by addFunction(), checkFunction(), clear(), nParams(), removeFunction(), and replaceFunction().
|
private |
Individual function parameter offsets (function index in m_functions) e.g.
m_functions[i]->parameter(m_paramOffsets[i]+1) gives second declared parameter of i-th function
Definition at line 240 of file CompositeFunction.h.
Referenced by activeParameter(), addFunction(), checkFunction(), clear(), descriptionOfActive(), getConstraint(), getError(), getParameter(), getParameterIndex(), getParameterStatus(), getTie(), isExplicitlySet(), nameOfActive(), parameterDescription(), parameterIndex(), parameterLocalIndex(), parameterLocalName(), parameterName(), removeFunction(), removeTie(), replaceFunction(), setActiveParameter(), setError(), setParameter(), setParameterDescription(), and setParameterStatus().