trait Polynomial[C] extends AnyRef
- Alphabetic
- By Inheritance
- Polynomial
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def *(rhs: Polynomial[C])(implicit ring: Semiring[C], eq: Eq[C]): Polynomial[C]
- abstract def *:(k: C)(implicit ring: Semiring[C], eq: Eq[C]): Polynomial[C]
- abstract def +(rhs: Polynomial[C])(implicit ring: Semiring[C], eq: Eq[C]): Polynomial[C]
- abstract def /%(rhs: Polynomial[C])(implicit field: Field[C], eq: Eq[C]): (Polynomial[C], Polynomial[C])
-
abstract
def
apply(x: C)(implicit r: Semiring[C]): C
Evaluate the polynomial at
x. -
abstract
def
coeffsArray(implicit ring: Semiring[C]): Array[C]
Returns the coefficients in little-endian order.
Returns the coefficients in little-endian order. So, the i-th element is coeffsArray(i) * (x ** i).
- implicit abstract def ct: ClassTag[C]
-
abstract
def
degree: Int
Returns the degree of this polynomial.
- abstract def derivative(implicit ring: Ring[C], eq: Eq[C]): Polynomial[C]
-
abstract
def
foreach[U](f: (Int, C) ⇒ U): Unit
Traverses each term in this polynomial, in order of degree, lowest to highest (eg.
Traverses each term in this polynomial, in order of degree, lowest to highest (eg. constant term would be first) and calls
fwith the degree of term and its coefficient. This may skip zero terms, or it may not. - abstract def integral(implicit field: Field[C], eq: Eq[C]): Polynomial[C]
-
abstract
def
isZero: Boolean
Returns
trueif this polynomial isring.zero. -
abstract
def
maxOrderTermCoeff(implicit ring: Semiring[C]): C
Returns the coefficient of max term of this polynomial.
-
abstract
def
nth(n: Int)(implicit ring: Semiring[C]): C
Returns the coefficient of the n-th degree term.
-
abstract
def
reductum(implicit e: Eq[C], ring: Semiring[C], ct: ClassTag[C]): Polynomial[C]
Returns a polynomial with the max term removed.
-
abstract
def
termsIterator: Iterator[Term[C]]
Return an iterator of non-zero terms.
Return an iterator of non-zero terms.
This method is used to implement equals and hashCode.
NOTE: This method uses a (_ == 0) test to prune zero values. This makes sense in a context where Semiring[C] and Eq[C] are unavailable, but not other places.
-
abstract
def
toDense(implicit ring: Semiring[C], eq: Eq[C]): PolyDense[C]
Returns a polynmial that has a dense representation.
-
abstract
def
toSparse(implicit ring: Semiring[C], eq: Eq[C]): PolySparse[C]
Returns a polynomial that has a sparse representation.
- abstract def unary_-()(implicit ring: Rng[C]): Polynomial[C]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def %(rhs: Polynomial[C])(implicit field: Field[C], eq: Eq[C]): Polynomial[C]
- def **(k: Int)(implicit ring: Rig[C], eq: Eq[C]): Polynomial[C]
- def -(rhs: Polynomial[C])(implicit ring: Rng[C], eq: Eq[C]): Polynomial[C]
- def /~(rhs: Polynomial[C])(implicit field: Field[C], eq: Eq[C]): Polynomial[C]
- def :*(k: C)(implicit ring: Semiring[C], eq: Eq[C]): Polynomial[C]
- def :/(k: C)(implicit field: Field[C], eq: Eq[C]): Polynomial[C]
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compose(y: Polynomial[C])(implicit ring: Rig[C], eq: Eq[C]): Polynomial[C]
Compose this polynomial with another.
-
def
data(implicit ring: Semiring[C], eq: Eq[C]): Map[Int, C]
Returns a map from exponent to coefficient of this polynomial.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(that: Any): Boolean
- Definition Classes
- Polynomial → AnyRef → Any
- def evalWith[A](x: A)(f: (C) ⇒ A)(implicit arg0: Semiring[A], arg1: Eq[A], arg2: ClassTag[A], ring: Semiring[C], eq: Eq[C]): A
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flip(implicit ring: Rng[C], eq: Eq[C]): Polynomial[C]
This will flip/mirror the polynomial about the y-axis.
This will flip/mirror the polynomial about the y-axis. It is equivalent to
poly.compose(-Polynomial.x), but will likely be faster to calculate. -
def
foreachNonZero[U](f: (Int, C) ⇒ U)(implicit ring: Semiring[C], eq: Eq[C]): Unit
Traverses each non-zero term in this polynomial, in order of degree, lowest to highest (eg.
Traverses each non-zero term in this polynomial, in order of degree, lowest to highest (eg. constant term would be first) and calls
fwith the degree of term and its coefficient. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- Polynomial → AnyRef → Any
-
def
isConstant: Boolean
Returns
trueiff this polynomial is constant. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[D](f: (C) ⇒ D)(implicit arg0: Semiring[D], arg1: Eq[D], arg2: ClassTag[D], ring: Semiring[C], eq: Eq[C]): Polynomial[D]
- def mapTerms[D](f: (Term[C]) ⇒ Term[D])(implicit arg0: Semiring[D], arg1: Eq[D], arg2: ClassTag[D], ring: Semiring[C], eq: Eq[C]): Polynomial[D]
-
def
maxTerm(implicit ring: Semiring[C]): Term[C]
Returns the term of the highest degree in this polynomial.
-
def
minTerm(implicit ring: Semiring[C], eq: Eq[C]): Term[C]
Returns the non-zero term of the minimum degree in this polynomial, unless it is zero.
Returns the non-zero term of the minimum degree in this polynomial, unless it is zero. If this polynomial is zero, then this returns a zero term.
-
def
monic(implicit f: Field[C], eq: Eq[C]): Polynomial[C]
Returns this polynomial as a monic polynomial, where the leading coefficient (ie.
Returns this polynomial as a monic polynomial, where the leading coefficient (ie.
maxOrderTermCoeff) is 1. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- def pow(k: Int)(implicit ring: Rig[C], eq: Eq[C]): Polynomial[C]
-
def
reciprocal(implicit ring: Semiring[C], eq: Eq[C]): Polynomial[C]
Returns the reciprocal of this polynomial.
Returns the reciprocal of this polynomial. Essentially, if this polynomial is
pwith degreen, then returns a polynomialq(x) = x^n*p(1/x).- See also
http://en.wikipedia.org/wiki/Reciprocal_polynomial
-
def
removeZeroRoots(implicit ring: Semiring[C], eq: Eq[C]): Polynomial[C]
Removes all zero roots from this polynomial.
-
def
roots(implicit finder: RootFinder[C]): Roots[C]
Returns the real roots of this polynomial.
Returns the real roots of this polynomial.
Depending on
C, thefinderargument may need to be passed "explicitly" via an implicit conversion. This is because some types (egBigDecimal,Rational, etc) require an error bound, and so provide implicit conversions toRootFinders from the error type. For instance,BigDecimalrequires either a scale or MathContext. So, we'd call this method withpoly.roots(MathContext.DECIMAL128), which would return aRoots[BigDecimalwhose roots are approximated to the precision specified inDECIMAL128and rounded appropriately.On the other hand, a type like
Doubledoesn't require an error bound and so can be called without specifying theRootFinder.- finder
a root finder to extract roots with
- returns
the real roots of this polynomial
-
def
shift(h: C)(implicit ring: Ring[C], eq: Eq[C]): Polynomial[C]
Shift this polynomial along the x-axis by
h, so thatthis(x + h) == this.shift(h).apply(x).Shift this polynomial along the x-axis by
h, so thatthis(x + h) == this.shift(h).apply(x). This is equivalent to callingthis.compose(Polynomial.x + h), but is likely to compute the shifted polynomial much faster. -
def
signVariations(implicit ring: Semiring[C], eq: Eq[C], signed: Signed[C]): Int
Returns the number of sign variations in the coefficients of this polynomial.
Returns the number of sign variations in the coefficients of this polynomial. Given 2 consecutive terms (ignoring 0 terms), a sign variation is indicated when the terms have differing signs.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
terms(implicit ring: Semiring[C], eq: Eq[C]): List[Term[C]]
Returns a list of non-zero terms.
-
def
toString(): String
- Definition Classes
- Polynomial → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )