15using namespace CurveFitting;
17using namespace Kernel;
27 declareParameter(
"A0", 1.0,
"Coefficient for constant term");
28 declareParameter(
"A1", 1.0,
"Coefficient for linear term");
29 declareParameter(
"Height", 1.0,
"Height");
30 declareParameter(
"Lifetime", 1.0,
"Lifetime");
45 for (
size_t i = 0; i < nData; i++) {
46 double x = xValues[i];
47 double expComponent = Height * std::exp(-
x / Lifetime);
48 double linearComponent = (A1 *
x) + A0;
50 out->
set(i, 0, A1 *
x * expComponent);
51 out->
set(i, 1, (
x + A0) * expComponent);
52 out->
set(i, 2, linearComponent * expComponent / Height);
53 out->
set(i, 3, linearComponent * expComponent *
x / (Lifetime * Lifetime));
69 for (
size_t i = 0; i < nData; ++i) {
70 out[i] = ((A1 * xValues[i]) + A0) * Height * std::exp(-xValues[i] / Lifetime);
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
Represents the Jacobian in IFitFunction::functionDeriv.
virtual void set(size_t iY, size_t iP, double value)=0
Set a value to a Jacobian matrix element.
double getParameter(size_t i) const override
Get i-th parameter.
ProductLinearExp : Function that evauates the product of an exponential and linear function.
void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override
Calculate the 1D function derivatives.
void function1D(double *out, const double *xValues, const size_t nData) const override
Evaluate the 1D function.