55 inline void setCoeff(
int ind,
double val);
60 inline double getCoeff(
int ind)
const;
65 double eval(
double x)
const;
85 if ((idx < 0) || (idx > order)){
86 std::string errstr =
"Poly1d::setCoeff - Trying to set coefficient " +
87 std::to_string(idx+1) +
" out of " + std::to_string(order+1);
88 throw std::out_of_range(errstr);
95 if ((idx < 0) || (idx > order)) {
96 std::string errstr =
"Poly1d::getCoeff - Trying to get coefficient " +
97 std::to_string(idx+1) +
" out of " + std::to_string(order+1);
98 throw std::out_of_range(errstr);
void printPoly() const
Print for debugging.
Definition: Poly1d.cpp:38
void setCoeff(int ind, double val)
Set coefficient by index.
Definition: Poly1d.h:84
double getCoeff(int ind) const
Get coefficient by index.
Definition: Poly1d.h:94
Poly1d & operator=(const Poly1d &)
Assignment operator.
Definition: Poly1d.h:75
double mean
Mean of the polynomial.
Definition: Poly1d.h:29
Poly1d(int ord, double mn, double nm)
Constructor.
Definition: Poly1d.h:40
Data structure for representing 1D polynomials.
Definition: Poly1d.h:23
double norm
Norm of the polynomial.
Definition: Poly1d.h:31
double eval(double x) const
Evaluate polynomial at x.
Definition: Poly1d.cpp:12
int order
Order of the polynomial.
Definition: Poly1d.h:27
std::vector< double > coeffs
Coefficients of the polynomial.
Definition: Poly1d.h:33
Poly1d(const Poly1d &p)
Copy constructor.
Definition: Poly1d.h:46
Poly1d()
Empty constructor.
Definition: Poly1d.h:43
Poly1d derivative() const
Return derivative of polynomial.
Definition: Poly1d.cpp:45