52 std::string
name()
const override {
return "CompositeFunction"; }
54 void setWorkspace(std::shared_ptr<const Workspace> ws)
override;
56 void setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace>
workspace,
size_t wi,
double startX,
57 double endX)
override;
58 void setStepSizeMethod(
const StepSizeMethod stepSizeMethod)
override;
66 void setParameter(
size_t,
const double &
value,
bool explicitlySet =
true)
override;
68 void setParameterDescription(
size_t,
const std::string &description)
override;
70 [[nodiscard]]
double getParameter(
size_t i)
const override;
72 [[nodiscard]]
double getParameter(
size_t i,
size_t j)
const;
74 void setParameter(
const std::string &name,
const double &
value,
bool explicitlySet =
true)
override;
76 void setParameterDescription(
const std::string &name,
const std::string &description)
override;
78 [[nodiscard]]
double getParameter(
const std::string &name)
const override;
80 bool hasParameter(
const std::string &name)
const override;
82 bool hasAttribute(
const std::string &name)
const override;
84 [[nodiscard]]
Attribute getAttribute(
const std::string &name)
const override;
88 void registerFunctionUsage(
bool internal)
override;
90 [[nodiscard]]
size_t nParams()
const override;
93 [[nodiscard]]
size_t nAttributes()
const override;
95 [[nodiscard]]
size_t nGlobalAttributes() const noexcept {
return IFunction::nAttributes(); }
97 [[nodiscard]]
size_t parameterIndex(
const std::string &name)
const override;
99 [[nodiscard]] std::string parameterName(
size_t i)
const override;
100 [[nodiscard]] std::string parameterName(
size_t i,
size_t j)
const;
102 [[nodiscard]] std::string attributeName(
size_t i)
const override;
104 [[nodiscard]] std::string parameterDescription(
size_t i)
const override;
106 [[nodiscard]]
bool isExplicitlySet(
size_t i)
const override;
108 [[nodiscard]]
double getError(
size_t i)
const override;
110 [[nodiscard]]
double getError(
size_t i,
size_t j)
const;
112 [[nodiscard]]
double getError(
const std::string &name)
const override;
114 void setError(
size_t i,
double err)
override;
116 void setError(
const std::string &name,
double err)
override;
119 [[nodiscard]]
double activeParameter(
size_t i)
const override;
122 void setActiveParameter(
size_t i,
double value)
override;
126 [[nodiscard]] std::string nameOfActive(
size_t i)
const override;
128 [[nodiscard]] std::string descriptionOfActive(
size_t i)
const override;
136 void applyTies()
override;
138 void clearTies()
override;
141 using IFunction::removeTie;
143 bool removeTie(
size_t i)
override;
145 [[nodiscard]]
ParameterTie *getTie(
size_t i)
const override;
148 [[nodiscard]]
IConstraint *getConstraint(
size_t i)
const override;
150 void setUpForFit()
override;
152 void removeConstraint(
const std::string &parName)
override;
154 [[nodiscard]]
size_t getNumberDomains()
const override;
156 [[nodiscard]] std::vector<std::shared_ptr<IFunction>> createEquivalentFunctions()
const override;
158 [[nodiscard]]
bool hasFunction(
const std::string &functionName)
const;
160 [[nodiscard]]
IFunction_sptr getFunction(std::size_t i)
const override;
162 [[nodiscard]] std::size_t
nFunctions()
const override {
return m_functions.size(); }
169 void removeFunction(
size_t i);
171 void replaceFunction(
size_t functionIndex,
const IFunction_sptr &f);
175 [[nodiscard]] std::size_t functionIndex(
const std::string &functionName)
const;
177 [[nodiscard]] std::size_t functionIndex(std::size_t i)
const;
178 [[nodiscard]] std::size_t attributeFunctionIndex(std::size_t i)
const;
180 [[nodiscard]]
size_t parameterLocalIndex(
size_t i,
bool recursive =
false)
const;
182 [[nodiscard]] std::string parameterLocalName(
size_t i,
bool recursive =
false)
const;
184 void checkFunction();
194 throw std::invalid_argument(
"Attribute " + attName +
" not found in function " + this->name());
199 throw std::invalid_argument(
"Attribute " + attName +
" not found in function " + this->name());
210 void setParameterStatus(
size_t i, ParameterStatus status)
override;
212 ParameterStatus getParameterStatus(
size_t i)
const override;
214 static std::pair<std::string, size_t> parseName(
const std::string &varName);
218 void init()
override;
220 void declareParameter(
const std::string &name,
double initValue = 0,
const std::string &description =
"")
override;
228 std::string writeToString(
const std::string &parentLocalAttributesStr =
"")
const override;
234 size_t getAttributeOffset(
size_t attributeIndex)
const;
256 void createDefaultGlobalAttributes();
double value
The value of the point.
IPeaksWorkspace_sptr workspace
Mantid::API::IFunction::Attribute Attribute
A composite function is a function containing other functions.
void updateActive(const double *in)
Update parameters after a fitting iteration.
virtual size_t nLocalAttributes() const
Returns the number of attributes associated with the function.
size_t m_nParams
Total number of parameters.
virtual std::vector< std::string > getLocalAttributeNames() const
Returns a list of attribute names.
size_t nGlobalAttributes() const noexcept
std::vector< size_t > m_attributeIndex
size_t paramOffset(size_t i) const
size_t m_nAttributes
Total number of attributes.
std::vector< size_t > m_paramOffsets
Individual function parameter offsets (function index in m_functions) e.g.
std::size_t nFunctions() const override
Number of functions.
void setLocalAttributeValue(size_t i, const std::string &attName, const T &value)
size_t m_iConstraintFunction
Function counter to be used in nextConstraint.
std::vector< std::string > m_globalAttributeNames
void setLocalAttributeValue(size_t i, const std::string &attName, const char *value)
virtual bool hasLocalAttribute(const std::string &) const
Check if attribute attName exists.
std::string name() const override
Returns the function's name.
std::vector< size_t > m_IFunction
Keeps the function index for each declared parameter (parameter declared index)
virtual Attribute getLocalAttribute(size_t i, const std::string &attName) const
Return a value of attribute attName.
std::vector< IFunction_sptr > m_functions
Pointers to the included functions.
virtual void setLocalAttribute(size_t i, const std::string &attName, const Attribute &)
Set a value to attribute attName.
Base class that represents the domain of a function.
A class to store values calculated by a function.
An interface to a constraint.
Attribute is a non-fitting parameter.
This is an interface to a fitting function - a semi-abstarct class.
Represents the Jacobian in IFitFunction::functionDeriv.
virtual double get(size_t iY, size_t iP)=0
Get the value to a Jacobian matrix element.
virtual void set(size_t iY, size_t iP, double value)=0
Set a value to a Jacobian matrix element.
A reference to a parameter in a function.
A Jacobian for individual functions.
size_t m_iY0
fitting data index offset in the overall Jacobian for a
void zero() override
Zero all matrix elements.
size_t m_iP0
particular function
double get(size_t iY, size_t iP) override
Overridden Jacobian::get(...).
PartialJacobian(Jacobian *J, size_t iY0, size_t iP0)
Constructor.
PartialJacobian(Jacobian *J, size_t iP0)
particular function
Jacobian * m_J
pointer to the overall Jacobian
void addNumberToColumn(const double &value, const size_t &iP) override
Add number to all iY (data) Jacobian elements for a given iP (parameter)
void set(size_t iY, size_t iP, double value) override
Overridden Jacobian::set(...).
Marks code as not implemented yet.
IValidator is the basic interface for all validators for properties.
std::shared_ptr< const CompositeFunction > CompositeFunction_const_sptr
shared pointer to the composite function base class (const version)
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
std::shared_ptr< CompositeFunction > CompositeFunction_sptr
shared pointer to the composite function base class
Helper class which provides the Collimation Length for SANS instruments.