Polynomial<T> class abstract mixin

Abstract polynomial type.

Available extensions

Constructors

Polynomial.new(DataType<T> dataType, {int desiredDegree = -1, PolynomialFormat? format})
Constructs a default vector of the desired dataType, and possibly a custom format.
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. If format 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 and ys.
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<T>, provided by the DifferentiatePolynomialExtension extension

Returns a mutable view of the differentiate of this polynomial.
no setter
hashCode int
The hash code for this object.
no setterinherited
integrate Polynomial<T>

Available on Polynomial<T>, provided by the IntegratePolynomialExtension extension

Returns a mutable view of the integrate of this polynomial.
no 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<T>, provided by the RootsPolynomialExtension extension

Computes the complex roots of a polynomial.
no 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<T>, provided by the UnmodifiablePolynomialExtension extension

Returns a unmodifiable view of this polynomial.
no setter

Methods

add(Polynomial<T> other, {DataType<T>? dataType, PolynomialFormat? format}) Polynomial<T>

Available on Polynomial<T>, provided by the AddPolynomialExtension extension

Adds other to this Polynomial.
addEq(Polynomial<T> other) Polynomial<T>

Available on Polynomial<T>, provided by the AddPolynomialExtension extension

In-place adds other 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<T>, provided by the ComparePolynomialExtension extension

Compares this Polynomial and with other.
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<T>, provided by the DivPolynomialExtension extension

Divides this Polynomial by other, returns the quotient and remainder such that dividend = 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 if exponent is outside of bounds.
lerp(Polynomial<T> other, num t, {DataType<T>? dataType, PolynomialFormat? format}) Polynomial<T>

Available on Polynomial<T>, provided by the LerpPolynomialExtension extension

Interpolates linearly between this Polynomial and other with a factor of t. If t is equal to 0 the result is this, if t is equal to 1 the result is other.
lerpEq(Polynomial<T> other, num t) Polynomial<T>

Available on Polynomial<T>, provided by the LerpPolynomialExtension extension

In-place interpolates linearly between this Polynomial and other.
mul(Object other, {DataType<T>? dataType, PolynomialFormat? format, bool? fftMultiply}) Polynomial<T>

Available on Polynomial<T>, provided by the MulPolynomialExtension extension

Multiplies this Polynomial with other.
mulPolynomial(Polynomial<T> other, {DataType<T>? dataType, PolynomialFormat? format, bool? fftMultiply}) Polynomial<T>

Available on Polynomial<T>, provided by the MulPolynomialExtension extension

Multiplies this Polynomial with a Polynomial.
mulScalar(T other, {DataType<T>? dataType, PolynomialFormat? format}) Polynomial<T>

Available on Polynomial<T>, provided by the MulPolynomialExtension extension

Multiplies this Polynomial with a scalar.
mulScalarEq(T other) Polynomial<T>

Available on Polynomial<T>, provided by the MulPolynomialExtension extension

In-place multiplies this Polynomial with a scalar.
neg({DataType<T>? dataType, PolynomialFormat? format}) Polynomial<T>

Available on Polynomial<T>, provided by the NegPolynomialExtension extension

Negates this Polynomial.
negEq() Polynomial<T>

Available on Polynomial<T>, provided by the NegPolynomialExtension extension

In-place negates this Polynomial.
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 to value. The behavior is undefined if exponent is outside of bounds.
shift(int offset) Polynomial<T>

Available on Polynomial<T>, provided by the ShiftPolynomialExtension extension

Returns a mutable view of this polynomial shift by offset.
sub(Polynomial<T> other, {DataType<T>? dataType, PolynomialFormat? format}) Polynomial<T>

Available on Polynomial<T>, provided by the SubPolynomialExtension extension

Subtracts other to this Polynomial.
subEq(Polynomial<T> other) Polynomial<T>

Available on Polynomial<T>, provided by the SubPolynomialExtension extension

In-place subtracts other to this Polynomial.
toList({bool? growable}) List<T>

Available on Polynomial<T>, provided by the PolynomialListExtension extension

Returns a List of the coefficients of the underlying polynomial.
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<T>, provided by the DivPolynomialExtension extension

Divides this Polynomial by other, returns the remainder.
operator *(Object other) Polynomial<T>

Available on Polynomial<T>, provided by the MulPolynomialExtension extension

Multiplies this Polynomial with other.
operator +(Polynomial<T> other) Polynomial<T>

Available on Polynomial<T>, provided by the AddPolynomialExtension extension

Adds other to this Polynomial.
operator -(Polynomial<T> other) Polynomial<T>

Available on Polynomial<T>, provided by the SubPolynomialExtension extension

Subtracts other to this Polynomial.
operator /(Polynomial<T> other) PolynomialDivision<T>

Available on Polynomial<T>, provided by the DivPolynomialExtension extension

Divides this Polynomial by other, returns the quotient and remainder such that dividend = 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 to value.
operator unary-() Polynomial<T>

Available on Polynomial<T>, provided by the NegPolynomialExtension extension

Negates this Polynomial.
operator ~/(Polynomial<T> other) Polynomial<T>

Available on Polynomial<T>, provided by the DivPolynomialExtension extension

Divides this Polynomial by other, returns the quotient.