22 const std::vector<Real> & y,
28 mooseError(
"PolynomialFit does not allow empty input vectors");
34 else if (
_x.size() <= order)
35 mooseError(
"PolynomialFit requires an order less than the size of the input vector");
43 unsigned int num_rows =
_x.size();
44 unsigned int num_cols =
_order + 1;
45 _matrix.resize(num_rows * num_cols);
47 for (
unsigned int col = 0; col < num_cols; ++col)
48 for (
unsigned int row = 0; row < num_rows; ++row)
55 unsigned int size =
_coeffs.size();
59 for (
unsigned int i = 0; i < size; ++i)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
virtual void fillMatrix() override
Helper function that creates the matrix necessary for the least squares algorithm.
virtual Real sample(Real x) override
This function will take an independent variable input and will return the dependent variable based on...
unsigned int _num_coeff
The number of coefficients.
static int _file_number
File number.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Base class for linear least squares fit method.
std::vector< Real > _x
Independent variable.
bool _truncate_order
Flag to implement a truncated polynomial.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PolynomialFit(const std::vector< Real > &x, const std::vector< Real > &y, unsigned int order, bool truncate_order=false)
std::vector< Real > _coeffs
Vector of coefficients of the least squares fit.
std::vector< Real > _matrix
Basis functions evaluated at each independent variable (note: actually a vector)
unsigned int _order
Order of the polynomial.