A class representing a polynomial. More...
#include <juce_Polynomial.h>
Public Member Functions | |
Polynomial () | |
Creates a new polynomial which will always evaluate to zero. More... | |
Polynomial (const FloatingType *coefficients, int numCoefficients) | |
Creates a new polynomial with given coefficients. More... | |
Polynomial (const Polynomial &)=default | |
Creates a copy of another polynomial. More... | |
Polynomial (Polynomial &&)=default | |
Creates a copy of another polynomial. More... | |
template<typename... Values> | |
Polynomial (Values... items) | |
Creates a new polynomial with coefficients by a C++11 initializer list. More... | |
int | getOrder () noexcept |
Returns the order of the polynomial. More... | |
Polynomial< FloatingType > | getProductWith (const Polynomial< FloatingType > &other) const |
computes the product of two polynomials and return the result More... | |
Polynomial< FloatingType > | getSumWith (const Polynomial< FloatingType > &other) const |
Returns the sum of this polynomial with another. More... | |
FloatingType | operator() (FloatingType x) const noexcept |
Evaluates the value of the polynomial at a single point x. More... | |
Polynomial & | operator= (const Polynomial &)=default |
Creates a copy of another polynomial. More... | |
Polynomial & | operator= (Polynomial &&)=default |
Creates a copy of another polynomial. More... | |
FloatingType | operator[] (int index) const noexcept |
Returns a single coefficient of the receiver for reading. More... | |
FloatingType & | operator[] (int index) noexcept |
Returns a single coefficient of the receiver for modifying. More... | |
Polynomial< FloatingType > | withGain (double gain) const |
Returns the polynomial with all its coefficients multiplied with a gain factor. More... | |
Private Attributes | |
Array< FloatingType > | coeffs |
A class representing a polynomial.
@tags{DSP}
|
inline |
Creates a new polynomial which will always evaluate to zero.
References juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add(), and juce::dsp::Polynomial< FloatingType >::coeffs.
|
inline |
Creates a new polynomial with given coefficients.
numCoefficients | The number of coefficients stored in coefficients. This is also the order of the returned polynomial. |
coefficients | The coefficients which will be used by the newly created polynomial. The Polynomial class will keep a private copy of the coefficients. |
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::isEmpty(), and jassert.
|
default |
Creates a copy of another polynomial.
|
default |
Creates a copy of another polynomial.
|
inline |
Creates a new polynomial with coefficients by a C++11 initializer list.
This function can be used in the following way: Polynomial<float> p ({0.5f, -0.3f, 0.2f});
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::isEmpty(), and jassert.
|
inlinenoexcept |
Returns the order of the polynomial.
References juce::dsp::Polynomial< FloatingType >::coeffs, and juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size().
|
inline |
computes the product of two polynomials and return the result
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::gl::j, juce::jmax(), juce::gl::result, juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size(), and juce::gl::value.
|
inline |
Returns the sum of this polynomial with another.
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::dsp::Polynomial< FloatingType >::getSumWith(), juce::gl::result, and juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size().
Referenced by juce::dsp::Polynomial< FloatingType >::getSumWith().
|
inlinenoexcept |
Evaluates the value of the polynomial at a single point x.
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getUnchecked(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::size(), juce::gl::x, and juce::gl::y.
|
default |
Creates a copy of another polynomial.
|
default |
Creates a copy of another polynomial.
|
inlinenoexcept |
Returns a single coefficient of the receiver for reading.
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getUnchecked(), and juce::gl::index.
|
inlinenoexcept |
Returns a single coefficient of the receiver for modifying.
References juce::dsp::Polynomial< FloatingType >::coeffs, juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference(), and juce::gl::index.
|
inline |
Returns the polynomial with all its coefficients multiplied with a gain factor.
References juce::gl::c, and juce::gl::result.
|
private |
Referenced by juce::dsp::Polynomial< FloatingType >::getOrder(), juce::dsp::Polynomial< FloatingType >::getProductWith(), juce::dsp::Polynomial< FloatingType >::getSumWith(), juce::dsp::Polynomial< FloatingType >::operator()(), juce::dsp::Polynomial< FloatingType >::operator[](), and juce::dsp::Polynomial< FloatingType >::Polynomial().