15#ifndef __Basis_polynomial_h__
16#define __Basis_polynomial_h__
64 static inline unsigned polyIndex(
const std::array<unsigned, 3> &pows) {
65 const unsigned n = pows[0] + pows[1] + pows[2];
70 unsigned ret = (n+1)*pows[0] - (pows[0]-1)*pows[0] / 2;
77 ret += n*(n+1)*(n+2)/6;
119 for(
double &coeff :
coeffs)
139 double operator[] (
const std::array<unsigned, 3> &pows)
const {
152 double operator() (
const std::array<double, 3> &pt)
const;
Array for storing coefficients of a polynomial of three variables with specified degree.
Definition polynomial.h:35
PolynomialCoeffs()=delete
double operator()(const std::array< double, 3 > &pt) const
Evaluate the polynomial at the specified point.
Definition polynomial.cc:18
PolynomialCoeffs(const double constant, const double x, const double y, const double z)
Create a linear function with the specified coefficients.
Definition polynomial.h:102
PolynomialCoeffs & operator*=(const double c)
Scale the polynomial by a constant.
Definition polynomial.cc:90
PolynomialCoeffs operator*(const double c) const
Multiply a polynomial by a constant value.
Definition polynomial.cc:81
PolynomialCoeffs pow(const unsigned j) const
Expands a linear polynomial raised to a power.
Definition polynomial.cc:119
double & operator[](const std::array< unsigned, 3 > &pows)
Access the coefficient for the specified term.
Definition polynomial.h:129
static unsigned polyIndex(const std::array< unsigned, 3 > &pows)
Gets the array index for the coefficient of a particular term.
Definition polynomial.h:64
unsigned get_degree() const
Get the degree of the polynomial.
Definition polynomial.h:88
PolynomialCoeffs operator+(const PolynomialCoeffs &rhs) const
Add two polynomials together.
Definition polynomial.cc:30
std::vector< double > coeffs
Array storing the coefficients.
Definition polynomial.h:48
PolynomialCoeffs & operator+=(const PolynomialCoeffs &rhs)
Adds another polynomial to this one.
Definition polynomial.cc:58
unsigned degree
The degree of the polynomial.
Definition polynomial.h:39
PolynomialCoeffs(const unsigned N)
Create a polynomial of degree N.
Definition polynomial.h:116
GaussianFunction operator*(const double lhs, const GaussianFunction &rhs)
Multiply a GaussianFunction by a scalar.
Definition gaussian.h:372
static const double c
Definition relops.cc:10
#define N
Definition testconv.cc:37
double constant(const coordT &x)
Definition testper.cc:46