Package cc.redberry.rings.poly
Interface IPolynomial<Poly extends IPolynomial<Poly>>

 Type Parameters:
Poly
 the type of polynomial (self type)
 All Superinterfaces:
Comparable<Poly>
,Serializable
,Stringifiable<Poly>
 All Known Subinterfaces:
IUnivariatePolynomial<Poly>
 All Known Implementing Classes:
AMultivariatePolynomial
,MultivariatePolynomial
,MultivariatePolynomialZp64
,UnivariatePolynomial
,UnivariatePolynomialZ64
,UnivariatePolynomialZp64
public interface IPolynomial<Poly extends IPolynomial<Poly>> extends Comparable<Poly>, Stringifiable<Poly>, Serializable
Parent interface for all polynomials. All polynomial instances are mutable, so all structural operations except those where it is stated explicitly will in general modify the instance. All arithmetic operations (add(oth), multiply(oth), monic()
etc.) applies tothis
inplace and returnthis
reference ( so e.g.(poly == poly.add(other))
).Note: modifier operations are not synchronized.
 Since:
 1.0


Method Summary
Modifier and Type Method Description Poly
add(Poly oth)
Addsoth
tothis
.default Poly
add(Poly... oth)
Addsoth
tothis
.default void
assertSameCoefficientRingWith(Poly oth)
Checks whetheroth
andthis
have the same coefficient ring, if not exception will be throwndefault Poly
canonical()
Makes this poly monic if coefficient ring is field, otherwise makes this primitivePoly
ccAsPoly()
Returns the constant coefficient as a constant polyPoly
clone()
Deep copy of thisBigInteger
coefficientRingCardinality()
Returns cardinality of the coefficient ring of this polyBigInteger
coefficientRingCharacteristic()
Returns characteristic of the coefficient ring of this polyBigInteger
coefficientRingPerfectPowerBase()
Returnsbase
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finiteBigInteger
coefficientRingPerfectPowerExponent()
Returnsexponent
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finitedefault String
coefficientRingToString()
String representation of the coefficient ring of thisString
coefficientRingToString(IStringifier<Poly> stringifier)
String representation of the coefficient ring of thisPoly
contentAsPoly()
Returns the content of this (gcd of coefficients) as a constant polydefault Poly
copy()
Deep copy of this (alias forclone()
, required for scala)Poly[]
createArray(int length)
overcome Java generics...default Poly[]
createArray(Poly a)
overcome Java generics...default Poly[]
createArray(Poly a, Poly b)
overcome Java generics...default Poly[]
createArray(Poly a, Poly b, Poly c)
overcome Java generics...Poly[][]
createArray2d(int length)
overcome Java generics...Poly[][]
createArray2d(int length1, int length2)
overcome Java generics...default Poly
createConstant(long value)
Creates constant polynomial with specified valuePoly
createOne()
Returns the new instance of unit polynomial (with the same coefficient ring)Poly
createZero()
Returns the new instance of zero polynomial (with the same coefficient ring)Poly
decrement()
Subtracts 1 from thisint
degree()
Returns the degree of this polynomialPoly
divideByLC(Poly other)
Divides this polynomial by the leading coefficient ofother
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by theother.lc()
.Poly
increment()
Adds 1 to thisboolean
isConstant()
Returnstrue
if this polynomial has only constant termboolean
isLinearExactly()
Returns whether this polynomial is linear (i.e.boolean
isLinearOrConstant()
Returns whether this polynomial is linear (i.e.boolean
isMonic()
Returnstrue
if this polynomial is monicboolean
isMonomial()
Returnstrue
if this polynomial has only one monomial termboolean
isOne()
Returnstrue
if this is oneboolean
isOverField()
Returns whether the coefficient ring of this polynomial is a fieldboolean
isOverFiniteField()
Returns whether the coefficient ring of this polynomial is a finite fieldboolean
isOverPerfectPower()
Returns whether thecoefficientRingCardinality()
is a perfect powerboolean
isOverZ()
Returns whether the coefficient ring of this polynomial is Zboolean
isUnitCC()
Returns true if constant term is equal to oneboolean
isZero()
Returnstrue
if this is zeroboolean
isZeroCC()
Returns true if constant term is zeroPoly
lcAsPoly()
Returns the leading coefficient as a constant polyPoly
monic()
Setsthis
to its monic part (that isthis
divided by its leading coefficient), or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by thelc()
.default Poly
monicExact()
Setsthis
to its monic part (that isthis
divided by its leading coefficient), or throwsArithmeticException
if some of the elements can't be exactly divided by the l.c.Poly
monicWithLC(Poly other)
Setsthis
to its monic part multiplied by the leading coefficient ofother
;Poly
multiply(long factor)
Multiplies this byfactor
default Poly
multiply(Iterable<Poly> oth)
Multiplies this byoth
Poly
multiply(Poly oth)
Multiplies this byoth
default Poly
multiply(Poly... oth)
Multiplies this byoth
Poly
multiplyByBigInteger(BigInteger factor)
Multiplies this byfactor
Poly
multiplyByLC(Poly other)
Multiply this by the leading coefficient ofother
Poly
negate()
Negates this and returnsPoly
parsePoly(String string)
Deprecated.useCoder
to parse polynomialsPoly
primitivePart()
Reduces poly to its primitive part (primitive part will always have positive l.c.)Poly
primitivePartSameSign()
Reduces poly to its primitive part, so that primitive part will have the same signum as the initial polyboolean
sameCoefficientRingWith(Poly oth)
Returns whetheroth
andthis
have the same coefficient ringPoly
set(Poly oth)
Sets the content of this tooth
Poly
setCoefficientRingFrom(Poly poly)
Set the coefficient ring from specified polydefault Poly
setCoefficientRingFromOptional(Poly poly)
int
signumOfLC()
Gives signum of the leading coefficientint
size()
Returns the size of this polynomialPoly
square()
Squaresthis
Poly
subtract(Poly oth)
Subtractsoth
fromthis
.default Poly
subtract(Poly... oth)
Subtractsoth
fromthis
.default Poly
toPositiveLC()
If signum of leading coefficient is minus one, negate thisdefault String
toString(String... variables)
String representation of this polynomial with specified string variablesPoly
toZero()
Sets this to zero
Methods inherited from interface java.lang.Comparable
compareTo

Methods inherited from interface cc.redberry.rings.io.Stringifiable
toString




Method Detail

sameCoefficientRingWith
boolean sameCoefficientRingWith(Poly oth)
Returns whetheroth
andthis
have the same coefficient ring Parameters:
oth
 other polynomial Returns:
 whether this and oth are over the same coefficient ring

assertSameCoefficientRingWith
default void assertSameCoefficientRingWith(Poly oth)
Checks whetheroth
andthis
have the same coefficient ring, if not exception will be thrown Parameters:
oth
 other polynomial Throws:
IllegalArgumentException
 if this and oth have different coefficient ring

setCoefficientRingFrom
Poly setCoefficientRingFrom(Poly poly)
Set the coefficient ring from specified poly Parameters:
poly
 the polynomial Returns:
 a copy of this with the coefficient ring taken from
poly

degree
int degree()
Returns the degree of this polynomial Returns:
 the degree

size
int size()
Returns the size of this polynomial Returns:
 the size

isZero
boolean isZero()
Returnstrue
if this is zero Returns:
 whether
this
is zero

isOne
boolean isOne()
Returnstrue
if this is one Returns:
 whether
this
is one

isMonic
boolean isMonic()
Returnstrue
if this polynomial is monic Returns:
 whether
this
is monic

isUnitCC
boolean isUnitCC()
Returns true if constant term is equal to one Returns:
 whether constant term is 1

isZeroCC
boolean isZeroCC()
Returns true if constant term is zero Returns:
 whether constant term is zero

isConstant
boolean isConstant()
Returnstrue
if this polynomial has only constant term Returns:
 whether
this
is constant

isMonomial
boolean isMonomial()
Returnstrue
if this polynomial has only one monomial term Returns:
 whether
this
has only one monomial term

isOverField
boolean isOverField()
Returns whether the coefficient ring of this polynomial is a field Returns:
 whether the coefficient ring of this polynomial is a field

isOverZ
boolean isOverZ()
Returns whether the coefficient ring of this polynomial is Z Returns:
 whether the coefficient ring of this polynomial is Z

isOverFiniteField
boolean isOverFiniteField()
Returns whether the coefficient ring of this polynomial is a finite field Returns:
 whether the coefficient ring of this polynomial is a finite field

isLinearOrConstant
boolean isLinearOrConstant()
Returns whether this polynomial is linear (i.e. of the forma * X + b
)

isLinearExactly
boolean isLinearExactly()
Returns whether this polynomial is linear (i.e. of the forma * X + b
with nonzeroa
)

coefficientRingCardinality
BigInteger coefficientRingCardinality()
Returns cardinality of the coefficient ring of this poly Returns:
 cardinality of the coefficient ring

coefficientRingCharacteristic
BigInteger coefficientRingCharacteristic()
Returns characteristic of the coefficient ring of this poly Returns:
 characteristic of the coefficient ring

isOverPerfectPower
boolean isOverPerfectPower()
Returns whether thecoefficientRingCardinality()
is a perfect power Returns:
 whether the
coefficientRingCardinality()
is a perfect power

coefficientRingPerfectPowerBase
BigInteger coefficientRingPerfectPowerBase()
Returnsbase
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite Returns:
base
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite

coefficientRingPerfectPowerExponent
BigInteger coefficientRingPerfectPowerExponent()
Returnsexponent
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite Returns:
exponent
so thatcoefficientRingCardinality() == base^exponent
or null if cardinality is not finite

monic
Poly monic()
Setsthis
to its monic part (that isthis
divided by its leading coefficient), or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by thelc()
. NOTE: ifnull
is returned, the content ofthis
is destroyed. Returns:
 monic
this
ornull

monicExact
default Poly monicExact()
Setsthis
to its monic part (that isthis
divided by its leading coefficient), or throwsArithmeticException
if some of the elements can't be exactly divided by the l.c. Returns:
 monic
this
ornull
 Throws:
ArithmeticException
 if some of the elements can't be exactly divided by the l.c.

canonical
default Poly canonical()
Makes this poly monic if coefficient ring is field, otherwise makes this primitive

signumOfLC
int signumOfLC()
Gives signum of the leading coefficient Returns:
 signum of the leading coefficient

toPositiveLC
default Poly toPositiveLC()
If signum of leading coefficient is minus one, negate this

toZero
Poly toZero()
Sets this to zero Returns:
 this := zero

set
Poly set(Poly oth)
Sets the content of this tooth
 Parameters:
oth
 the polynomial Returns:
 this := oth

primitivePart
Poly primitivePart()
Reduces poly to its primitive part (primitive part will always have positive l.c.) Returns:
 primitive part (poly will be modified)

primitivePartSameSign
Poly primitivePartSameSign()
Reduces poly to its primitive part, so that primitive part will have the same signum as the initial poly Returns:
 primitive part (poly will be modified)

increment
Poly increment()
Adds 1 to this Returns:
this + 1

decrement
Poly decrement()
Subtracts 1 from this Returns:
this  1

createZero
Poly createZero()
Returns the new instance of zero polynomial (with the same coefficient ring) Returns:
 new instance of 0

createOne
Poly createOne()
Returns the new instance of unit polynomial (with the same coefficient ring) Returns:
 new instance of 1

createConstant
default Poly createConstant(long value)
Creates constant polynomial with specified value Parameters:
value
 the value Returns:
 constant polynomial

add
default Poly add(Poly... oth)
Addsoth
tothis
. Parameters:
oth
 the polynomials Returns:
this + oth

subtract
Poly subtract(Poly oth)
Subtractsoth
fromthis
. Parameters:
oth
 the polynomial Returns:
this  oth

subtract
default Poly subtract(Poly... oth)
Subtractsoth
fromthis
. Parameters:
oth
 the polynomial Returns:
this  oth

negate
Poly negate()
Negates this and returns Returns:
 this negated

multiply
Poly multiply(Poly oth)
Multiplies this byoth
 Parameters:
oth
 the polynomial Returns:
this * oth

multiply
default Poly multiply(Poly... oth)
Multiplies this byoth
 Parameters:
oth
 the polynomials Returns:
this * oth

multiply
default Poly multiply(Iterable<Poly> oth)
Multiplies this byoth
 Parameters:
oth
 the polynomials Returns:
this * oth

multiply
Poly multiply(long factor)
Multiplies this byfactor
 Parameters:
factor
 the factor Returns:
this * factor

multiplyByBigInteger
Poly multiplyByBigInteger(BigInteger factor)
Multiplies this byfactor
 Parameters:
factor
 the factor Returns:
this * factor

square
Poly square()
Squaresthis
 Returns:
this * this

contentAsPoly
Poly contentAsPoly()
Returns the content of this (gcd of coefficients) as a constant poly

lcAsPoly
Poly lcAsPoly()
Returns the leading coefficient as a constant poly

ccAsPoly
Poly ccAsPoly()
Returns the constant coefficient as a constant poly

divideByLC
Poly divideByLC(Poly other)
Divides this polynomial by the leading coefficient ofother
or returnsnull
(causing loss of internal data) if some of the elements can't be exactly divided by theother.lc()
. NOTE: ifnull
is returned, the content ofthis
is destroyed. Parameters:
other
 the polynomial Returns:
this
divided by theother.lc()
ornull
if exact division is not possible

monicWithLC
Poly monicWithLC(Poly other)
Setsthis
to its monic part multiplied by the leading coefficient ofother
; Parameters:
other
 other polynomial Returns:
 monic part multiplied by the leading coefficient of
other
or null if exact division by the reduced leading coefficient is not possible

multiplyByLC
Poly multiplyByLC(Poly other)
Multiply this by the leading coefficient ofother
 Parameters:
other
 polynomial Returns:
 this * lc(other)

clone
Poly clone()
Deep copy of this Returns:
 deep copy of this

copy
default Poly copy()
Deep copy of this (alias forclone()
, required for scala) Returns:
 deep copy of this

createArray
Poly[] createArray(int length)
overcome Java generics...

createArray2d
Poly[][] createArray2d(int length)
overcome Java generics...

createArray2d
Poly[][] createArray2d(int length1, int length2)
overcome Java generics...

coefficientRingToString
String coefficientRingToString(IStringifier<Poly> stringifier)
String representation of the coefficient ring of this

coefficientRingToString
default String coefficientRingToString()
String representation of the coefficient ring of this

toString
default String toString(String... variables)
String representation of this polynomial with specified string variables

parsePoly
@Deprecated Poly parsePoly(String string)
Deprecated.useCoder
to parse polynomials

