|
MADNESS 0.10.1
|
Array for storing coefficients of a polynomial of three variables with specified degree. More...
#include <polynomial.h>
Public Member Functions | |
| PolynomialCoeffs ()=delete | |
| PolynomialCoeffs (const double constant, const double x, const double y, const double z) | |
| Create a linear function with the specified coefficients. | |
| PolynomialCoeffs (const unsigned N) | |
| Create a polynomial of degree N. | |
| unsigned | get_degree () const |
| Get the degree of the polynomial. | |
| double | operator() (const std::array< double, 3 > &pt) const |
| Evaluate the polynomial at the specified point. | |
| PolynomialCoeffs | operator* (const double c) const |
| Multiply a polynomial by a constant value. | |
| PolynomialCoeffs | operator* (const PolynomialCoeffs &rhs) const |
| Multiply two polynomials together. | |
| PolynomialCoeffs & | operator*= (const double c) |
| Scale the polynomial by a constant. | |
| PolynomialCoeffs | operator+ (const PolynomialCoeffs &rhs) const |
| Add two polynomials together. | |
| PolynomialCoeffs & | operator+= (const PolynomialCoeffs &rhs) |
| Adds another polynomial to this one. | |
| double & | operator[] (const std::array< unsigned, 3 > &pows) |
| Access the coefficient for the specified term. | |
| double | operator[] (const std::array< unsigned, 3 > &pows) const |
| Access the coefficient for the specified term. | |
| PolynomialCoeffs | pow (const unsigned j) const |
| Expands a linear polynomial raised to a power. | |
Static Protected Member Functions | |
| static unsigned | polyIndex (const std::array< unsigned, 3 > &pows) |
| Gets the array index for the coefficient of a particular term. | |
Protected Attributes | |
| std::vector< double > | coeffs |
| Array storing the coefficients. | |
| unsigned | degree |
| The degree of the polynomial. | |
Array for storing coefficients of a polynomial of three variables with specified degree.
The general polynomial of three variables is written as
![\[ \sum_{i,j,k} c_{i,j,k} x^i y^j z^k, \]](form_322.png)
where 



|
delete |
|
inline |
Create a linear function with the specified coefficients.
| [in] | constant | The constant term. |
| [in] | x | The coefficient on x. |
| [in] | y | The coefficient on y. |
| [in] | z | The coefficient on z. |
References coeffs, constant(), and polyIndex().
|
inline |
|
inline |
Get the degree of the polynomial.
References degree.
Referenced by slymer::PrimitiveGaussian::PrimitiveGaussian().
| double slymer::PolynomialCoeffs::operator() | ( | const std::array< double, 3 > & | pt | ) | const |
Evaluate the polynomial at the specified point.
| [in] | pt | The point at which the polynomial is evaluated. |
References coeffs, degree, k, polyIndex(), and pow().
| PolynomialCoeffs slymer::PolynomialCoeffs::operator* | ( | const double | c | ) | const |
| PolynomialCoeffs slymer::PolynomialCoeffs::operator* | ( | const PolynomialCoeffs & | rhs | ) | const |
Multiply two polynomials together.
*this is one of the polynomials.
| [in] | rhs | The other polynomial. |
References degree, and operator[]().
| PolynomialCoeffs & slymer::PolynomialCoeffs::operator*= | ( | const double | c | ) |
| PolynomialCoeffs slymer::PolynomialCoeffs::operator+ | ( | const PolynomialCoeffs & | rhs | ) | const |
| PolynomialCoeffs & slymer::PolynomialCoeffs::operator+= | ( | const PolynomialCoeffs & | rhs | ) |
|
inline |
Access the coefficient for the specified term.
| [in] | pows | The powers of x, y, and z for this term. |
References coeffs, and polyIndex().
Referenced by operator*().
|
inline |
Access the coefficient for the specified term.
| [in] | pows | The powers of x, y, and z for this term. |
References coeffs, and polyIndex().
|
inlinestaticprotected |
Gets the array index for the coefficient of a particular term.
Terms of degree 0 are stored before those of degree 1, etc.
Within a particular degree, think of the problem in the combinatorial "stars and bars" idea: there are n stars and two bars dividing them into three parts. (Each part corresponds to the number of x, y, or z factors.) The first array element will be bars in the 0 and 1 positions, then 0 and 2, ..., 0 and n+1, then 1 and 2, etc.
| [in] | pows | The powers of x, y, and z for this term. |
Referenced by PolynomialCoeffs(), operator()(), operator[](), and operator[]().
| PolynomialCoeffs slymer::PolynomialCoeffs::pow | ( | const unsigned | j | ) | const |
Expands a linear polynomial raised to a power.
Essentially expands the polynomial
![\[ (coeffs[0] + coeffs[1]*x + coeffs[2]*y + coeffs[3]*z)^j \]](form_339.png)
into a new PolynomialCoeffs object. That is, output[{{p,q,r}}] is the coefficient on the 
This function requires multinomial coefficients, which involve factorials. We assume that the arguments to the factorials will not be large and hard-code small values. An error will be thrown if the maximum value is exceeded.
| std::runtime_error | if the polynomial does not have degree 1. |
| [in] | j | The exponent of the expansion. |
Referenced by operator()(), and pow().
|
protected |
Array storing the coefficients.
For a given degree n, there are 

Referenced by PolynomialCoeffs(), PolynomialCoeffs(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator[](), and operator[]().
|
protected |
The degree of the polynomial.
Referenced by get_degree(), operator()(), operator*(), operator+(), operator+=(), and pow().