Package edu.jas.application
Class ColorPolynomial<C extends RingElem<C>>
- java.lang.Object
-
- edu.jas.application.ColorPolynomial<C>
-
- Type Parameters:
C- coefficient type
- All Implemented Interfaces:
java.io.Serializable
public class ColorPolynomial<C extends RingElem<C>> extends java.lang.Object implements java.io.Serializable
Colored Polynomials with green, red and white coefficients. Not implementing RingElem. Note: not general purpose, use only in comprehensive GB.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description GenPolynomial<GenPolynomial<C>>greenThe part with green (= zero) terms and coefficients.GenPolynomial<GenPolynomial<C>>redThe part with red (= non zero) terms and coefficients.GenPolynomial<GenPolynomial<C>>whiteThe part with white (= unknown color) terms and coefficients.
-
Constructor Summary
Constructors Constructor Description ColorPolynomial(GenPolynomial<GenPolynomial<C>> g, GenPolynomial<GenPolynomial<C>> r, GenPolynomial<GenPolynomial<C>> w)The constructor creates a colored polynomial from the colored parts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorPolynomial<C>abs()ColorPolynomial absolute value.booleancheckInvariant()Check ordering invariants.ColorPolynomial<C>divide(GenPolynomial<C> s)ColorPolynomial division by coefficient.booleanequals(java.lang.Object p)Is this polynomial equal to other.GenPolynomial<GenPolynomial<C>>getEssentialPolynomial()Get essential polynomial.java.util.List<GenPolynomial<C>>getGreenCoefficients()Get zero condition on coefficients.GenPolynomial<GenPolynomial<C>>getPolynomial()Get full polynomial.java.util.List<GenPolynomial<C>>getRedCoefficients()Get non zero condition on coefficients.inthashCode()Hash code for this colored polynomial.booleanisDetermined()Is this polynomial determined.booleanisONE()Is this polynomial ONE.booleanisZERO()Is this polynomial ZERO.ExpVectorleadingExpVector()Get leading exponent vector.java.util.Map.Entry<ExpVector,GenPolynomial<C>>leadingMonomial()Get leading monomial.intlength()Length of red and white parts.ColorPolynomial<C>multiply(GenPolynomial<C> s)ColorPolynomial multiplication by coefficient.ColorPolynomial<C>multiply(GenPolynomial<C> s, ExpVector e)ColorPolynomial multiplication by monomial.ColorPolynomial<C>subtract(ColorPolynomial<C> S)ColorPolynomial subtraction.ColorPolynomial<C>subtract(GenPolynomial<C> s, ExpVector e)ColorPolynomial subtract.ColorPolynomial<C>sum(ColorPolynomial<C> S)ColorPolynomial summation.ColorPolynomial<C>sum(GenPolynomial<C> s, ExpVector e)ColorPolynomial summation.java.lang.StringtoScript()Script representation of ColorPolynomial.java.lang.StringtoString()String representation of ColorPolynomial.
-
-
-
Field Detail
-
green
public final GenPolynomial<GenPolynomial<C extends RingElem<C>>> green
The part with green (= zero) terms and coefficients.
-
red
public final GenPolynomial<GenPolynomial<C extends RingElem<C>>> red
The part with red (= non zero) terms and coefficients.
-
white
public final GenPolynomial<GenPolynomial<C extends RingElem<C>>> white
The part with white (= unknown color) terms and coefficients.
-
-
Constructor Detail
-
ColorPolynomial
public ColorPolynomial(GenPolynomial<GenPolynomial<C>> g, GenPolynomial<GenPolynomial<C>> r, GenPolynomial<GenPolynomial<C>> w)
The constructor creates a colored polynomial from the colored parts.- Parameters:
g- green colored terms and coefficients.r- red colored terms and coefficients.w- white colored terms and coefficients.
-
-
Method Detail
-
toString
public java.lang.String toString()
String representation of ColorPolynomial.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Script representation of ColorPolynomial.- See Also:
Element.toScript()
-
isZERO
public boolean isZERO()
Is this polynomial ZERO.- Returns:
- true, if there are only green terms, else false.
-
isONE
public boolean isONE()
Is this polynomial ONE.- Returns:
- true, if the only non green term is 1, else false.
-
equals
public boolean equals(java.lang.Object p)
Is this polynomial equal to other.- Overrides:
equalsin classjava.lang.Object- Parameters:
p- other polynomial.- Returns:
- true, if this is equal to other, else false.
-
hashCode
public int hashCode()
Hash code for this colored polynomial.- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
isDetermined
public boolean isDetermined()
Is this polynomial determined.- Returns:
- true, if there are nonzero red terms or if this == 0, else false.
-
checkInvariant
public boolean checkInvariant()
Check ordering invariants. TT(green) > LT(red) and TT(red) > LT(white).- Returns:
- true, if all ordering invariants are met, else false.
-
getGreenCoefficients
public java.util.List<GenPolynomial<C>> getGreenCoefficients()
Get zero condition on coefficients.- Returns:
- green coefficients.
-
getRedCoefficients
public java.util.List<GenPolynomial<C>> getRedCoefficients()
Get non zero condition on coefficients.- Returns:
- red coefficients.
-
getPolynomial
public GenPolynomial<GenPolynomial<C>> getPolynomial()
Get full polynomial.- Returns:
- sum of all parts.
-
getEssentialPolynomial
public GenPolynomial<GenPolynomial<C>> getEssentialPolynomial()
Get essential polynomial.- Returns:
- sum of red and white parts.
-
length
public int length()
Length of red and white parts.- Returns:
- length of essential parts.
-
leadingExpVector
public ExpVector leadingExpVector()
Get leading exponent vector.- Returns:
- LT of red or white parts.
-
leadingMonomial
public java.util.Map.Entry<ExpVector,GenPolynomial<C>> leadingMonomial()
Get leading monomial.- Returns:
- LM of red or white parts.
-
abs
public ColorPolynomial<C> abs()
ColorPolynomial absolute value.- Returns:
- abs(this).
-
sum
public ColorPolynomial<C> sum(ColorPolynomial<C> S)
ColorPolynomial summation. Note: green coefficients stay green, all others become white.- Parameters:
S- ColorPolynomial.- Returns:
- this+S.
-
sum
public ColorPolynomial<C> sum(GenPolynomial<C> s, ExpVector e)
ColorPolynomial summation.- Parameters:
s- GenPolynomial.e- exponent vector.- Returns:
- this+(c e).
-
subtract
public ColorPolynomial<C> subtract(ColorPolynomial<C> S)
ColorPolynomial subtraction. Note: green coefficients stay green, all others become white.- Parameters:
S- ColorPolynomial.- Returns:
- this-S.
-
subtract
public ColorPolynomial<C> subtract(GenPolynomial<C> s, ExpVector e)
ColorPolynomial subtract.- Parameters:
s- GenPolynomial.e- exponent vector.- Returns:
- this-(c e).
-
multiply
public ColorPolynomial<C> multiply(GenPolynomial<C> s, ExpVector e)
ColorPolynomial multiplication by monomial.- Parameters:
s- Coefficient.e- Expvector.- Returns:
- this * (c t).
-
multiply
public ColorPolynomial<C> multiply(GenPolynomial<C> s)
ColorPolynomial multiplication by coefficient.- Parameters:
s- Coefficient.- Returns:
- this * (s).
-
divide
public ColorPolynomial<C> divide(GenPolynomial<C> s)
ColorPolynomial division by coefficient.- Parameters:
s- Coefficient.- Returns:
- this / (s).
-
-