12using namespace CurveFitting;
21 for (
int i = 0; i < m_n; ++i) {
23 declareParameter(parName);
32 std::vector<double> B(
m_n, 0.0);
33 for (
int i = 0; i <
m_n; ++i)
37 for (
size_t i = 0; i < nData; ++i) {
38 double tof = xValues[i];
44 for (
int j = 0; j <
m_n; ++j) {
51 for (
size_t j = 1; j <
m_n; ++j) {
65 for (
size_t i = 0; i < nData; i++) {
66 double tof = xValues[i];
71 out->
set(i, 0, pow_x);
73 for (
int j = 1; j <
m_n; ++j) {
76 out->
set(i, j, pow_x);
96 }
else if (attName ==
"Bkpos")
99 throw std::invalid_argument(
"Polynomial: Unknown attribute " + attName);
110 if (attName ==
"n") {
112 int attint = att.
asInt();
114 throw std::invalid_argument(
"Polynomial:FullprofPolynomial order cannot be negative.");
115 }
else if (attint != 6 && attint != 12) {
116 throw std::runtime_error(
"FullprofPolynomial's order must be either 6 or 12. ");
117 }
else if (attint !=
m_n) {
122 for (
int i = 0; i <
m_n; ++i) {
127 }
else if (attName ==
"Bkpos") {
140 else if (attName ==
"Bkpos")
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
Attribute is a non-fitting parameter.
int asInt() const
Returns int value if attribute is a int, throws exception otherwise.
double asDouble() const
Returns double value if attribute is a double, throws exception otherwise.
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.
void clearAllParameters()
Nonvirtual member which removes all declared parameters.
void declareParameter(const std::string &name, double initValue=0, const std::string &description="") override
Declare a new parameter.
double getParameter(size_t i) const override
Get i-th parameter.
FullprofPolynomial : Polynomial background defined in Fullprof.
void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override
Function to calculate derivative analytically.
void setAttribute(const std::string &attName, const Attribute &) override
Set a value to attribute attName.
void function1D(double *out, const double *xValues, const size_t nData) const override
Function to calcualteFullprofPolynomial.
bool hasAttribute(const std::string &attName) const override
Check if attribute attName exists.
std::vector< std::string > getAttributeNames() const override
Returns a list of attribute names.
double m_bkpos
Background origin position.
Attribute getAttribute(const std::string &attName) const override
Return a value of attribute attName.
std::string to_string(const wide_integer< Bits, Signed > &n)