Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::API::CompositeFunction Class Reference

A composite function is a function containing other functions. More...

#include <CompositeFunction.h>

Inheritance diagram for Mantid::API::CompositeFunction:
Mantid::API::IFunction Mantid::API::ImmutableCompositeFunction Mantid::API::MultiDomainFunction Mantid::CurveFitting::Functions::ComptonScatteringCountRate Mantid::CurveFitting::Functions::Convolution Mantid::CurveFitting::Functions::CrystalFieldControl Mantid::CurveFitting::Functions::ProductFunction Mantid::CurveFitting::Functions::DiffRotDiscreteCircle Mantid::CurveFitting::Functions::DiffSphere Mantid::CurveFitting::Functions::IsoRotDiff

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...
 
IConstraintgetConstraint (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...
 
ParameterTiegetTie (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< IFunctionclone () 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...
 
IFunctionoperator= (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< IFunctiongetFunction (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...
 
FunctionHandlergetHandler () 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_sptrm_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< FunctionHandlerm_handler
 Pointer to a function handler. More...
 
std::shared_ptr< Kernel::ProgressBasem_progReporter
 Pointer to the progress handler. More...
 

Detailed Description

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.

Author
Roman Tolchenov, Tessella Support Services plc
Date
20/10/2009

Definition at line 44 of file CompositeFunction.h.

Constructor & Destructor Documentation

◆ CompositeFunction()

Mantid::API::CompositeFunction::CompositeFunction ( )

Default constructor.

Definition at line 66 of file CompositeFunction.cpp.

Referenced by createEquivalentFunctions(), and Mantid::API::MultiDomainFunction::createEquivalentFunctions().

Member Function Documentation

◆ activeParameter()

double Mantid::API::CompositeFunction::activeParameter ( size_t  i) const
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.

◆ addFunction()

size_t Mantid::API::CompositeFunction::addFunction ( IFunction_sptr  f)
virtual

◆ applyTies()

void Mantid::API::CompositeFunction::applyTies ( )
overridevirtual

◆ attributeFunctionIndex()

size_t Mantid::API::CompositeFunction::attributeFunctionIndex ( std::size_t  i) const

Get the index of the function to which parameter i belongs.

Parameters
i:: The parameter index
Returns
function index of the requested parameter

Definition at line 703 of file CompositeFunction.cpp.

References m_attributeIndex, nAttributes(), and std::to_string().

Referenced by attributeName().

◆ attributeName()

std::string Mantid::API::CompositeFunction::attributeName ( size_t  index) const
overridevirtual

Returns the name of attribute i.

Returns the name of the ith attribute.

Parameters
index:: The index of the attribute
Returns
The name 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().

◆ checkFunction()

void Mantid::API::CompositeFunction::checkFunction ( )

◆ clear()

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().

◆ clearTies()

void Mantid::API::CompositeFunction::clearTies ( )
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().

◆ createDefaultGlobalAttributes()

void Mantid::API::CompositeFunction::createDefaultGlobalAttributes ( )
private

Definition at line 70 of file CompositeFunction.cpp.

References declareAttribute(), m_globalAttributeNames, and m_nAttributes.

◆ createEquivalentFunctions()

std::vector< IFunction_sptr > Mantid::API::CompositeFunction::createEquivalentFunctions ( ) const
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().

◆ declareAttribute() [1/2]

void Mantid::API::CompositeFunction::declareAttribute ( const std::string &  name,
const API::IFunction::Attribute defaultValue 
)
protected

◆ declareAttribute() [2/2]

void Mantid::API::CompositeFunction::declareAttribute ( const std::string &  name,
const API::IFunction::Attribute defaultValue,
const Kernel::IValidator validator 
)
protected

Declare a single attribute, with a validator.

Declares a single (global) attribute on the composite function, with a validator.

Parameters
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().

◆ declareParameter()

void Mantid::API::CompositeFunction::declareParameter ( const std::string &  name,
double  initValue = 0,
const std::string &  description = "" 
)
overrideprotectedvirtual

Declare a new parameter.

To used in the implementation's constructor.

Parameters
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().

◆ descriptionOfActive()

std::string Mantid::API::CompositeFunction::descriptionOfActive ( size_t  i) const
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.

◆ function()

void Mantid::API::CompositeFunction::function ( const FunctionDomain domain,
FunctionValues values 
) const
overridevirtual

Function you want to fit to.

Parameters
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().

◆ functionDeriv()

void Mantid::API::CompositeFunction::functionDeriv ( const FunctionDomain domain,
Jacobian jacobian 
)
overridevirtual

Derivatives of function with respect to active parameters.

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().

◆ functionIndex() [1/2]

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.

Parameters
functionName:: The name of the function to search for.
Returns
function index of the first function with a matching function string.

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().

◆ functionIndex() [2/2]

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.

Parameters
i:: The parameter index
Returns
function index of the requested parameter

Definition at line 691 of file CompositeFunction.cpp.

References m_IFunction, nParams(), and std::to_string().

◆ getAttribute()

API::IFunction::Attribute Mantid::API::CompositeFunction::getAttribute ( const std::string &  name) const
overridevirtual

◆ getAttributeOffset()

size_t Mantid::API::CompositeFunction::getAttributeOffset ( size_t  attributeIndex) const
private

Definition at line 1005 of file CompositeFunction.cpp.

References functionIndex(), and m_attributeIndex.

Referenced by attributeName().

◆ getConstraint()

IConstraint * Mantid::API::CompositeFunction::getConstraint ( size_t  i) const
overridevirtual

Get constraint of i-th parameter.

Get constraint.

Parameters
i:: the index
Returns
A pointer to the constraint

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().

◆ getContainingFunction()

IFunction_sptr Mantid::API::CompositeFunction::getContainingFunction ( const ParameterReference ref) const

Get the containing function.

Returns the shared pointer to the function containing a parameter.

Parameters
ref:: The reference
Returns
A function containing parameter pointed to by ref

Definition at line 950 of file CompositeFunction.cpp.

References getFunction(), and nFunctions().

◆ getError() [1/3]

double Mantid::API::CompositeFunction::getError ( const std::string &  name) const
overridevirtual

Get the fitting error for a parameter by name.

Parameters
name:: The name of the parameter.
Returns
value of the requested named parameter

Implements Mantid::API::IFunction.

Definition at line 429 of file CompositeFunction.cpp.

References getFunction(), index, name(), parameterName(), and parseName().

◆ getError() [2/3]

double Mantid::API::CompositeFunction::getError ( size_t  i) const
overridevirtual

Get the fitting error for a parameter.

Parameters
i:: The index of a parameter
Returns
:: the error

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().

◆ getError() [3/3]

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.

Parameters
i:: The index of the i-th function
j:: The index of the i-th function's j-th parameter
Returns
:: the error

Definition at line 422 of file CompositeFunction.cpp.

References m_functions.

◆ getFunction()

IFunction_sptr Mantid::API::CompositeFunction::getFunction ( std::size_t  i) const
override

Returns the pointer to i-th function.

Parameters
i:: The index of the function
Returns
function at the requested index

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().

◆ getLocalAttribute()

virtual Attribute Mantid::API::CompositeFunction::getLocalAttribute ( size_t  i,
const std::string &  attName 
) const
inlinevirtual

Return a value of attribute attName.

Reimplemented in Mantid::API::MultiDomainFunction.

Definition at line 192 of file CompositeFunction.h.

Referenced by writeToString().

◆ getLocalAttributeNames()

virtual std::vector< std::string > Mantid::API::CompositeFunction::getLocalAttributeNames ( ) const
inlinevirtual

Returns a list of attribute names.

Reimplemented in Mantid::API::MultiDomainFunction.

Definition at line 190 of file CompositeFunction.h.

Referenced by writeToString().

◆ getNumberDomains()

size_t Mantid::API::CompositeFunction::getNumberDomains ( ) const
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().

◆ getParameter() [1/3]

double Mantid::API::CompositeFunction::getParameter ( const std::string &  name) const
overridevirtual

Get parameter by name.

Parameters by name.

Parameters
name:: The name of the parameter.
Returns
value of the requested named 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().

◆ getParameter() [2/3]

double Mantid::API::CompositeFunction::getParameter ( size_t  i) const
overridevirtual

Get i-th parameter.

Get the i-th parameter.

Parameters
i:: The parameter index
Returns
value of the requested parameter

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().

◆ getParameter() [3/3]

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.

Parameters
i:: The function index
j:: The i-th function's j-th parameter
Returns
value of the requested parameter

Definition at line 250 of file CompositeFunction.cpp.

References m_functions.

◆ getParameterIndex()

size_t Mantid::API::CompositeFunction::getParameterIndex ( const ParameterReference ref) const
overridevirtual

Return parameter index from a parameter reference.

Returns the index of parameter if the ref points to one of the member function.

Parameters
ref:: A reference to a parameter
Returns
Parameter index or number of nParams() if parameter not found

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().

◆ getParameterStatus()

IFunction::ParameterStatus Mantid::API::CompositeFunction::getParameterStatus ( size_t  i) const
overridevirtual

◆ getTie()

ParameterTie * Mantid::API::CompositeFunction::getTie ( size_t  i) const
overridevirtual

Get the tie of i-th parameter.

Parameters
i:: The parameter index
Returns
A pointer to the tie.

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().

◆ hasAttribute()

bool Mantid::API::CompositeFunction::hasAttribute ( const std::string &  name) const
overridevirtual

Check if a function has an attribute with this name.

Check if function has a attribute with a particular name.

Parameters
name:: A name of a attribute.
Returns
True if the parameter exists.

Reimplemented from Mantid::API::IFunction.

Definition at line 271 of file CompositeFunction.cpp.

References attributeName(), index, m_functions, m_globalAttributeNames, name(), and parseName().

◆ hasFunction()

bool Mantid::API::CompositeFunction::hasFunction ( const std::string &  functionName) const

Returns true if the composite has at least one of this function.

Parameters
functionName:: The function name to search for.
Returns
true if the composite function has at least one of a function with a matching name.

Definition at line 651 of file CompositeFunction.cpp.

References function(), and m_functions.

◆ hasLocalAttribute()

virtual bool Mantid::API::CompositeFunction::hasLocalAttribute ( const std::string &  ) const
inlinevirtual

Check if attribute attName exists.

Reimplemented in Mantid::API::MultiDomainFunction.

Definition at line 202 of file CompositeFunction.h.

◆ hasParameter()

bool Mantid::API::CompositeFunction::hasParameter ( const std::string &  name) const
overridevirtual

Check if function has a parameter with this name.

Check if function has a parameter with a particular name.

Parameters
name:: A name of a parameter.
Returns
True if the parameter exists.

Implements Mantid::API::IFunction.

Definition at line 257 of file CompositeFunction.cpp.

References index, m_functions, name(), parameterName(), and parseName().

◆ init()

void Mantid::API::CompositeFunction::init ( )
overrideprotectedvirtual

◆ isExplicitlySet()

bool Mantid::API::CompositeFunction::isExplicitlySet ( size_t  i) const
overridevirtual

Checks if a parameter has been set explicitly.

Checks if a constraint has been explicitly set.

Parameters
i:: The parameter index
Returns
true if the function is explicitly set

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().

◆ name()

std::string Mantid::API::CompositeFunction::name ( ) const
inlineoverridevirtual

◆ nameOfActive()

std::string Mantid::API::CompositeFunction::nameOfActive ( size_t  i) const
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.

◆ nAttributes()

size_t Mantid::API::CompositeFunction::nAttributes ( ) const
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().

◆ nFunctions()

std::size_t Mantid::API::CompositeFunction::nFunctions ( ) const
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().

◆ nGlobalAttributes()

size_t Mantid::API::CompositeFunction::nGlobalAttributes ( ) const
inlinenoexcept

◆ nLocalAttributes()

virtual size_t Mantid::API::CompositeFunction::nLocalAttributes ( ) const
inlinevirtual

Returns the number of attributes associated with the function.

Reimplemented in Mantid::API::MultiDomainFunction.

Definition at line 188 of file CompositeFunction.h.

◆ nParams()

size_t Mantid::API::CompositeFunction::nParams ( ) const
overridevirtual

◆ parameterDescription()

std::string Mantid::API::CompositeFunction::parameterDescription ( size_t  i) const
overridevirtual

Returns the description of parameter i.

Returns the description of parameter.

Parameters
i:: The index
Returns
The description of the parameter

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().

◆ parameterIndex()

size_t Mantid::API::CompositeFunction::parameterIndex ( const std::string &  name) const
overridevirtual

Returns the index of parameter name.

Parameters
name:: The name of a parameter
Returns
index of the requested named 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().

◆ parameterLocalIndex()

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.

Parameters
i:: The parameter index
recursive:: If true call parameterLocalName recursively until a non-composite function is reached.
Returns
The local index of the parameter

Definition at line 740 of file CompositeFunction.cpp.

References functionIndex(), m_functions, m_paramOffsets, and parameterLocalIndex().

Referenced by parameterLocalIndex().

◆ parameterLocalName()

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.

Parameters
i:: The parameter index
recursive:: If true call parameterLocalName recursively until a non-composite function is reached.
Returns
The pure parameter name (without the function identifier f#.)

Definition at line 758 of file CompositeFunction.cpp.

References functionIndex(), m_functions, m_paramOffsets, and parameterLocalName().

Referenced by parameterLocalName(), and removeConstraint().

◆ parameterName() [1/2]

std::string Mantid::API::CompositeFunction::parameterName ( size_t  i) const
overridevirtual

Returns the name of parameter i.

Returns the name of parameter.

Parameters
i:: The index
Returns
The name of the parameter

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().

◆ parameterName() [2/2]

std::string Mantid::API::CompositeFunction::parameterName ( size_t  i,
size_t  j 
) const

Returns the name of i-th function's j-th parameter.

Parameters
i:: The function index
j:: The local index of the parameter relative to the function index
Returns
The name of the parameter

Definition at line 377 of file CompositeFunction.cpp.

References m_functions.

◆ paramOffset()

size_t Mantid::API::CompositeFunction::paramOffset ( size_t  i) const
inlineprotected

◆ parseName()

std::pair< std::string, size_t > Mantid::API::CompositeFunction::parseName ( const std::string &  varName)
static

Extract function index and parameter name from a variable name.

Parameters
varName:: The variable name which may contain function index ( [f<index.>]name )
Returns
pair containing the unprefixed variable name and functionIndex

Definition at line 716 of file CompositeFunction.cpp.

References index.

Referenced by getAttribute(), getError(), getParameter(), hasAttribute(), hasParameter(), parameterIndex(), setAttribute(), setError(), setParameter(), and setParameterDescription().

◆ registerFunctionUsage()

void Mantid::API::CompositeFunction::registerFunctionUsage ( bool  internal)
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().

◆ removeConstraint()

void Mantid::API::CompositeFunction::removeConstraint ( const std::string &  parName)
overridevirtual

Remove a constraint.

Parameters
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().

◆ removeFunction()

void Mantid::API::CompositeFunction::removeFunction ( size_t  i)

◆ removeTie() [1/3]

void Mantid::API::IFunction::removeTie ( const std::string &  parName)
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

Parameters
parName:: The name of the parameter which ties will be removed.

Reimplemented from Mantid::API::IFunction.

Definition at line 550 of file IFunction.cpp.

◆ removeTie() [2/3]

bool Mantid::API::IFunction::removeTie ( size_t  i)
virtual

Removes i-th parameter's tie.

Removes i-th parameter's tie if it is tied or does nothing.

Parameters
i:: The index of the tied parameter.
Returns
True if successfull

Reimplemented from Mantid::API::IFunction.

Definition at line 554 of file IFunction.cpp.

◆ removeTie() [3/3]

bool Mantid::API::CompositeFunction::removeTie ( size_t  i)
overridevirtual

Removes i-th parameter's tie.

Removes i-th parameter's tie if it is tied or does nothing.

Parameters
i:: The index of the tied parameter.
Returns
True if successful

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().

◆ replaceFunction()

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.

Parameters
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().

◆ 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.

Parameters
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().

◆ setActiveParameter()

void Mantid::API::CompositeFunction::setActiveParameter ( size_t  i,
double  value 
)
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.

◆ setAttribute()

void Mantid::API::CompositeFunction::setAttribute ( const std::string &  name,
const API::IFunction::Attribute value 
)
overridevirtual

◆ setError() [1/2]

void Mantid::API::CompositeFunction::setError ( const std::string &  name,
double  err 
)
overridevirtual

Set the fitting error for a parameter by name.

Sets the fitting error to a parameter by name.

Parameters
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().

◆ setError() [2/2]

void Mantid::API::CompositeFunction::setError ( size_t  i,
double  err 
)
overridevirtual

Set the fitting error for a parameter.

Parameters
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().

◆ setLocalAttribute()

virtual void Mantid::API::CompositeFunction::setLocalAttribute ( size_t  i,
const std::string &  attName,
const Attribute  
)
inlinevirtual

Set a value to attribute attName.

Reimplemented in Mantid::API::MultiDomainFunction.

Definition at line 197 of file CompositeFunction.h.

◆ setLocalAttributeValue() [1/2]

void Mantid::API::CompositeFunction::setLocalAttributeValue ( size_t  i,
const std::string &  attName,
const char *  value 
)
inline

Definition at line 206 of file CompositeFunction.h.

References value.

◆ setLocalAttributeValue() [2/2]

template<typename T >
void Mantid::API::CompositeFunction::setLocalAttributeValue ( size_t  i,
const std::string &  attName,
const T &  value 
)
inline

Definition at line 203 of file CompositeFunction.h.

References value.

◆ setMatrixWorkspace()

void Mantid::API::CompositeFunction::setMatrixWorkspace ( std::shared_ptr< const API::MatrixWorkspace workspace,
size_t  wi,
double  startX,
double  endX 
)
overridevirtual

Set matrix workspace.

Parameters
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().

◆ setParameter() [1/2]

void Mantid::API::CompositeFunction::setParameter ( const std::string &  name,
const double &  value,
bool  explicitlySet = true 
)
overridevirtual

Set parameter by name.

Sets a new value to a parameter by name.

Parameters
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.

◆ setParameter() [2/2]

void Mantid::API::CompositeFunction::setParameter ( size_t  i,
const double &  value,
bool  explicitlySet = true 
)
overridevirtual

Set i-th parameter.

Sets a new value to the i-th parameter.

Parameters
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().

◆ setParameterDescription() [1/2]

void Mantid::API::CompositeFunction::setParameterDescription ( const std::string &  name,
const std::string &  description 
)
overridevirtual

Set description of parameter by name.

Sets a new description to a parameter by name.

Parameters
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().

◆ setParameterDescription() [2/2]

void Mantid::API::CompositeFunction::setParameterDescription ( size_t  i,
const std::string &  description 
)
overridevirtual

Set i-th parameter description.

Sets a new description to the i-th parameter.

Parameters
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().

◆ setParameterStatus()

void Mantid::API::CompositeFunction::setParameterStatus ( size_t  i,
IFunction::ParameterStatus  status 
)
overridevirtual

◆ setStepSizeMethod()

void Mantid::API::CompositeFunction::setStepSizeMethod ( const StepSizeMethod  stepSizeMethod)
overridevirtual

Sets the function to use when calculating the step size.

Parameters
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.

◆ setUpForFit()

void Mantid::API::CompositeFunction::setUpForFit ( )
overridevirtual

◆ setWorkspace()

void Mantid::API::CompositeFunction::setWorkspace ( std::shared_ptr< const Workspace ws)
overridevirtual

Sets the workspace for each member function.

Parameters
wsA pointer to the workspace being fitted

Reimplemented from Mantid::API::IFunction.

Definition at line 157 of file CompositeFunction.cpp.

References m_functions.

◆ updateActive()

void Mantid::API::CompositeFunction::updateActive ( const double *  in)

Update parameters after a fitting iteration.

◆ writeToString()

std::string Mantid::API::CompositeFunction::writeToString ( const std::string &  parentLocalAttributesStr = "") const
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=(" << ... <<")"; }

Parameters
parentLocalAttributesStr:: A preformatted string with parent's local attributes. Can be passed in by a CompositeFunction (eg MultiDomainFunction).
Returns
the string representation of the composite function

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().

Member Data Documentation

◆ m_attributeIndex

std::vector<size_t> Mantid::API::CompositeFunction::m_attributeIndex
private

◆ m_functions

std::vector<IFunction_sptr> Mantid::API::CompositeFunction::m_functions
private

◆ m_globalAttributeNames

std::vector<std::string> Mantid::API::CompositeFunction::m_globalAttributeNames
private

◆ m_iConstraintFunction

size_t Mantid::API::CompositeFunction::m_iConstraintFunction
mutableprivate

Function counter to be used in nextConstraint.

Definition at line 254 of file CompositeFunction.h.

◆ m_IFunction

std::vector<size_t> Mantid::API::CompositeFunction::m_IFunction
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().

◆ m_nAttributes

size_t Mantid::API::CompositeFunction::m_nAttributes
private

Total number of attributes.

Definition at line 252 of file CompositeFunction.h.

Referenced by addFunction(), checkFunction(), clear(), createDefaultGlobalAttributes(), removeFunction(), and replaceFunction().

◆ m_nParams

size_t Mantid::API::CompositeFunction::m_nParams
private

Total number of parameters.

Definition at line 250 of file CompositeFunction.h.

Referenced by addFunction(), checkFunction(), clear(), nParams(), removeFunction(), and replaceFunction().

◆ m_paramOffsets

std::vector<size_t> Mantid::API::CompositeFunction::m_paramOffsets
private

The documentation for this class was generated from the following files: