Abstract polynomial type.
- Available extensions
- AddPolynomialExtension
- ComparePolynomialExtension
- DifferentiatePolynomialExtension
- DivPolynomialExtension
- IntegratePolynomialExtension
- LerpPolynomialExtension
- MulPolynomialExtension
- NegPolynomialExtension
- PolynomialListExtension
- RootsPolynomialExtension
- ShiftPolynomialExtension
- SubPolynomialExtension
- UnmodifiablePolynomialExtension
Constructors
-
Polynomial.new(DataType<
T> dataType, {int desiredDegree = -1, PolynomialFormat? format}) -
Constructs a default vector of the desired
dataType
, and possibly a customformat
.factory -
Polynomial.fromCoefficients(DataType<
T> dataType, List<T> source, {PolynomialFormat? format}) -
Constructs a polynomial from a list of coefficients.
factory
-
Polynomial.fromList(DataType<
T> dataType, List<T> source, {PolynomialFormat? format}) -
Constructs a polynomial from a list of values.
factory
-
Polynomial.fromRoots(DataType<
T> dataType, List<T> roots, {PolynomialFormat? format}) -
Builds a polynomial from a list of roots.
factory
-
Polynomial.generate(DataType<
T> dataType, int degree, PolynomialGeneratorCallback<T> callback, {PolynomialFormat? format}) -
Generates a polynomial from calling a
callback
on every value. Ifformat
is specified the resulting polynomial is mutable, otherwise this is a read-only view.factory -
Polynomial.lagrange(DataType<
T> dataType, {required Vector<T> xs, required Vector<T> ys}) -
Builds a Lagrange Polynomial through the unique sample points
xs
andys
.factory
Properties
-
dataType
→ DataType<
T> -
Returns the data type of this polynomial.
no setter
- degree → int
-
Returns the degree this polynomial, that is the highest coefficient.
no setter
-
differentiate
→ Polynomial<
T> -
Available on Polynomial<
Returns a mutable view of the differentiate of this polynomial.T> , provided by the DifferentiatePolynomialExtension extensionno setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
integrate
→ Polynomial<
T> -
Available on Polynomial<
Returns a mutable view of the integrate of this polynomial.T> , provided by the IntegratePolynomialExtension extensionno setter -
iterable
→ List<
T> -
Returns a list iterable over the polynomial.
no setter
- lead → T
-
Returns the leading term of this polynomial.
no setter
-
roots
→ List<
Complex> -
Available on Polynomial<
Computes the complex roots of a polynomial.T> , provided by the RootsPolynomialExtension extensionno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shape
→ List<
int> -
Returns the shape of this polynomial.
no setter
-
storage
→ Set<
Storage> -
Returns the underlying storage containers of this object.
no setterinherited
-
unmodifiable
→ Polynomial<
T> -
Available on Polynomial<
Returns a unmodifiable view of this polynomial.T> , provided by the UnmodifiablePolynomialExtension extensionno setter
Methods
-
add(
Polynomial< T> other, {DataType<T> ? dataType, PolynomialFormat? format}) → Polynomial<T> -
Available on Polynomial<
AddsT> , provided by the AddPolynomialExtension extensionother
to this Polynomial. -
addEq(
Polynomial< T> other) → Polynomial<T> -
Available on Polynomial<
In-place addsT> , provided by the AddPolynomialExtension extensionother
to this Polynomial. -
call(
T value) → T -
Evaluates the polynomial at
value
. -
compare(
Polynomial< T> other, {bool equals(T a, T b)?}) → bool -
Available on Polynomial<
Compares this Polynomial and withT> , provided by the ComparePolynomialExtension extensionother
. -
copyInto(
Polynomial< T> target) → Polynomial<T> - Returns the target polynomial with all elements of this polynomial copied into it.
-
div(
Polynomial< T> other, {DataType<T> ? dataType, PolynomialFormat? format}) → PolynomialDivision<T> -
Available on Polynomial<
Divides this Polynomial byT> , provided by the DivPolynomialExtension extensionother
, returns the quotient and remainder such thatdividend = quotient * divisor + remainder
. -
evaluate(
T value) → T -
Evaluates the polynomial at
value
. -
forEach(
void callback(int exponent, T value)) → void - Iterates over each element of the polynomial from the largest exponent down to the smallest exponent. This way of iteration is more efficient on sparse data structure and skips over neutral elements.
-
format(
{bool limit = true, int leadingItems = 3, int trailingItems = 3, Printer< String> ? ellipsesPrinter, Printer<String> ? paddingPrinter, Printer<T> ? valuePrinter, String addition = ' + ', String ellipses = '\u2026', String multiplication = '', String power = '^', String variable = 'x', bool skipNulls = true, bool skipValues = true}) → String - Returns a human readable representation of the polynomial.
-
getUnchecked(
int exponent) → T -
Returns the coefficient at the provided
exponent
. The behavior is undefined ifexponent
is outside of bounds. -
lerp(
Polynomial< T> other, num t, {DataType<T> ? dataType, PolynomialFormat? format}) → Polynomial<T> -
Available on Polynomial<
Interpolates linearly between this Polynomial andT> , provided by the LerpPolynomialExtension extensionother
with a factor oft
. Ift
is equal to0
the result isthis
, ift
is equal to1
the result isother
. -
lerpEq(
Polynomial< T> other, num t) → Polynomial<T> -
Available on Polynomial<
In-place interpolates linearly between this Polynomial andT> , provided by the LerpPolynomialExtension extensionother
. -
mul(
Object other, {DataType< T> ? dataType, PolynomialFormat? format, bool? fftMultiply}) → Polynomial<T> -
Available on Polynomial<
Multiplies this Polynomial withT> , provided by the MulPolynomialExtension extensionother
. -
mulPolynomial(
Polynomial< T> other, {DataType<T> ? dataType, PolynomialFormat? format, bool? fftMultiply}) → Polynomial<T> -
Available on Polynomial<
Multiplies this Polynomial with a Polynomial.T> , provided by the MulPolynomialExtension extension -
mulScalar(
T other, {DataType< T> ? dataType, PolynomialFormat? format}) → Polynomial<T> -
Available on Polynomial<
Multiplies this Polynomial with a scalar.T> , provided by the MulPolynomialExtension extension -
mulScalarEq(
T other) → Polynomial< T> -
Available on Polynomial<
In-place multiplies this Polynomial with a scalar.T> , provided by the MulPolynomialExtension extension -
neg(
{DataType< T> ? dataType, PolynomialFormat? format}) → Polynomial<T> -
Available on Polynomial<
Negates this Polynomial.T> , provided by the NegPolynomialExtension extension -
negEq(
) → Polynomial< T> -
Available on Polynomial<
In-place negates this Polynomial.T> , provided by the NegPolynomialExtension extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setUnchecked(
int exponent, T value) → void -
Sets the coefficient at the provided
exponent
tovalue
. The behavior is undefined ifexponent
is outside of bounds. -
shift(
int offset) → Polynomial< T> -
Available on Polynomial<
Returns a mutable view of this polynomial shift byT> , provided by the ShiftPolynomialExtension extensionoffset
. -
sub(
Polynomial< T> other, {DataType<T> ? dataType, PolynomialFormat? format}) → Polynomial<T> -
Available on Polynomial<
SubtractsT> , provided by the SubPolynomialExtension extensionother
to this Polynomial. -
subEq(
Polynomial< T> other) → Polynomial<T> -
Available on Polynomial<
In-place subtractsT> , provided by the SubPolynomialExtension extensionother
to this Polynomial. -
toList(
{bool? growable}) → List< T> -
Available on Polynomial<
Returns a List of the coefficients of the underlying polynomial.T> , provided by the PolynomialListExtension extension -
toPolynomial(
{PolynomialFormat? format}) → Polynomial< T> - Creates a new Polynomial containing the same elements as this one.
-
toString(
) → String -
Returns the string representation of this polynomial.
override
Operators
-
operator %(
Polynomial< T> other) → Polynomial<T> -
Available on Polynomial<
Divides this Polynomial byT> , provided by the DivPolynomialExtension extensionother
, returns the remainder. -
operator *(
Object other) → Polynomial< T> -
Available on Polynomial<
Multiplies this Polynomial withT> , provided by the MulPolynomialExtension extensionother
. -
operator +(
Polynomial< T> other) → Polynomial<T> -
Available on Polynomial<
AddsT> , provided by the AddPolynomialExtension extensionother
to this Polynomial. -
operator -(
Polynomial< T> other) → Polynomial<T> -
Available on Polynomial<
SubtractsT> , provided by the SubPolynomialExtension extensionother
to this Polynomial. -
operator /(
Polynomial< T> other) → PolynomialDivision<T> -
Available on Polynomial<
Divides this Polynomial byT> , provided by the DivPolynomialExtension extensionother
, returns the quotient and remainder such thatdividend = quotient * divisor + remainder
. -
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int exponent) → T -
Returns the coefficient at the provided
exponent
. -
operator []=(
int exponent, T value) → void -
Sets the coefficient at the provided
exponent
tovalue
. -
operator unary-(
) → Polynomial< T> -
Available on Polynomial<
Negates this Polynomial.T> , provided by the NegPolynomialExtension extension -
operator ~/(
Polynomial< T> other) → Polynomial<T> -
Available on Polynomial<
Divides this Polynomial byT> , provided by the DivPolynomialExtension extensionother
, returns the quotient.