Package edu.jas.application
Class WordResidue<C extends GcdRingElem<C>>
- java.lang.Object
-
- edu.jas.application.WordResidue<C>
-
- All Implemented Interfaces:
AbelianGroupElem<WordResidue<C>>,Element<WordResidue<C>>,GcdRingElem<WordResidue<C>>,MonoidElem<WordResidue<C>>,NoncomRingElem<WordResidue<C>>,QuotPair<GenWordPolynomial<C>>,RingElem<WordResidue<C>>,Value<GenWordPolynomial<C>>,java.io.Serializable,java.lang.Comparable<WordResidue<C>>
public class WordResidue<C extends GcdRingElem<C>> extends java.lang.Object implements GcdRingElem<WordResidue<C>>, NoncomRingElem<WordResidue<C>>, QuotPair<GenWordPolynomial<C>>, Value<GenWordPolynomial<C>>
WordResidue ring element based on GenWordPolynomial with GcdRingElem interface. Objects of this class are immutable.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intisunitFlag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.WordResidueRing<C>ringWordResidue class factory data structure.GenWordPolynomial<C>valValue part of the element data structure.
-
Constructor Summary
Constructors Constructor Description WordResidue(WordResidueRing<C> r)The constructor creates a WordResidue object from a ring factory.WordResidue(WordResidueRing<C> r, GenWordPolynomial<C> a)The constructor creates a WordResidue object from a ring factory and a polynomial.WordResidue(WordResidueRing<C> r, GenWordPolynomial<C> a, int u)The constructor creates a WordResidue object from a ring factory, a polynomial and an indicator if a is a unit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WordResidue<C>abs()WordResidue absolute value.intcompareTo(WordResidue<C> b)WordResidue comparison.WordResidue<C>copy()Clone this.GenWordPolynomial<C>denominator()Denominator.WordResidue<C>divide(WordResidue<C> S)WordResidue left division.WordResidue<C>[]egcd(WordResidue<C> b)Extended greatest common divisor.booleanequals(java.lang.Object b)Comparison with any other object.WordResidueRing<C>factory()Get the corresponding element factory.WordResidue<C>gcd(WordResidue<C> b)Greatest common divisor.inthashCode()Hash code for this residue.WordResidue<C>inverse()WordResidue inverse.booleanisConstant()Is WordResidue a constant.booleanisONE()Is WordResidue one.booleanisUnit()Is WordResidue unit.booleanisZERO()Is WordResidue zero.WordResidue<C>monic()WordResidue monic.WordResidue<C>multiply(C s)WordResidue<C>multiply(WordResidue<C> S)WordResidue multiplication.WordResidue<C>multiply(GenWordPolynomial<C> S)WordResidue multiplication.WordResidue<C>multiply(Word e)WordResidue multiplication.WordResidue<C>negate()WordResidue negate.GenWordPolynomial<C>numerator()Numerator.WordResidue<C>remainder(WordResidue<C> S)WordResidue remainder.WordResidue<C>rightDivide(WordResidue<C> S)WordResidue right division.WordResidue<C>rightRemainder(WordResidue<C> S)WordResidue right remainder.intsignum()WordResidue signum.WordResidue<C>subtract(WordResidue<C> S)WordResidue subtraction.WordResidue<C>sum(WordResidue<C> S)WordResidue summation.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoScriptFactory()Get a scripting compatible string representation of the factory.java.lang.StringtoString()Get the String representation as RingElem.WordResidue<C>[]twosidedDivide(WordResidue<C> S)WordResidue two-sided division.WordResidue<C>twosidedRemainder(WordResidue<C> S)WordResidue two-sided remainder.GenWordPolynomial<C>value()Value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, quotientRemainder
-
-
-
-
Field Detail
-
ring
public final WordResidueRing<C extends GcdRingElem<C>> ring
WordResidue class factory data structure.
-
val
public final GenWordPolynomial<C extends GcdRingElem<C>> val
Value part of the element data structure.
-
isunit
protected int isunit
Flag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.
-
-
Constructor Detail
-
WordResidue
public WordResidue(WordResidueRing<C> r)
The constructor creates a WordResidue object from a ring factory.- Parameters:
r- solvable residue ring factory.
-
WordResidue
public WordResidue(WordResidueRing<C> r, GenWordPolynomial<C> a)
The constructor creates a WordResidue object from a ring factory and a polynomial.- Parameters:
r- solvable residue ring factory.a- solvable polynomial.
-
WordResidue
public WordResidue(WordResidueRing<C> r, GenWordPolynomial<C> a, int u)
The constructor creates a WordResidue object from a ring factory, a polynomial and an indicator if a is a unit.- Parameters:
r- solvable residue ring factory.a- solvable polynomial.u- isunit indicator, -1, 0, 1.
-
-
Method Detail
-
factory
public WordResidueRing<C> factory()
Get the corresponding element factory.- Specified by:
factoryin interfaceElement<C extends GcdRingElem<C>>- Returns:
- factory for this Element.
- See Also:
Element.factory()
-
value
public GenWordPolynomial<C> value()
Value. Returns the value.- Specified by:
valuein interfaceValue<C extends GcdRingElem<C>>- See Also:
Value.value()
-
numerator
public GenWordPolynomial<C> numerator()
Numerator. Returns the value.- Specified by:
numeratorin interfaceQuotPair<C extends GcdRingElem<C>>- See Also:
QuotPair.numerator()
-
denominator
public GenWordPolynomial<C> denominator()
Denominator. Returns 1.- Specified by:
denominatorin interfaceQuotPair<C extends GcdRingElem<C>>- See Also:
QuotPair.denominator()
-
copy
public WordResidue<C> copy()
Clone this.- Specified by:
copyin interfaceElement<C extends GcdRingElem<C>>- Returns:
- Creates and returns a copy of this Element.
- See Also:
Object.clone()
-
isZERO
public boolean isZERO()
Is WordResidue zero.- Specified by:
isZEROin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- If this is 0 then true is returned, else false.
- See Also:
AbelianGroupElem.isZERO()
-
isONE
public boolean isONE()
Is WordResidue one.- Specified by:
isONEin interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- If this is 1 then true is returned, else false.
- See Also:
MonoidElem.isONE()
-
isUnit
public boolean isUnit()
Is WordResidue unit.- Specified by:
isUnitin interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
MonoidElem.isUnit()
-
isConstant
public boolean isConstant()
Is WordResidue a constant.- Specified by:
isConstantin interfaceQuotPair<C extends GcdRingElem<C>>- Specified by:
isConstantin interfaceValue<C extends GcdRingElem<C>>- Returns:
- true if this.val is a constant polynomial, else false.
-
toString
public java.lang.String toString()
Get the String representation as RingElem.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElement<C extends GcdRingElem<C>>- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<C extends GcdRingElem<C>>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
compareTo
public int compareTo(WordResidue<C> b)
WordResidue comparison.- Specified by:
compareToin interfacejava.lang.Comparable<C extends GcdRingElem<C>>- Specified by:
compareToin interfaceElement<C extends GcdRingElem<C>>- Parameters:
b- WordResidue.- Returns:
- sign(this-b), 0 means that this and b are equivalent in this residue class ring.
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.- Specified by:
equalsin interfaceElement<C extends GcdRingElem<C>>- Overrides:
equalsin classjava.lang.Object- Returns:
- true means that this and b are equivalent in this residue class ring.
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this residue.- Specified by:
hashCodein interfaceElement<C extends GcdRingElem<C>>- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashCode.
- See Also:
Object.hashCode()
-
abs
public WordResidue<C> abs()
WordResidue absolute value.- Specified by:
absin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- the absolute value of this.
- See Also:
AbelianGroupElem.abs()
-
sum
public WordResidue<C> sum(WordResidue<C> S)
WordResidue summation.- Specified by:
sumin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this+S.
-
negate
public WordResidue<C> negate()
WordResidue negate.- Specified by:
negatein interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
signum
public int signum()
WordResidue signum.- Specified by:
signumin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Returns:
- signum(this).
- See Also:
AbelianGroupElem.signum()
-
subtract
public WordResidue<C> subtract(WordResidue<C> S)
WordResidue subtraction.- Specified by:
subtractin interfaceAbelianGroupElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this-S.
-
divide
public WordResidue<C> divide(WordResidue<C> S)
WordResidue left division.- Specified by:
dividein interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- left, with left*S = this
-
twosidedDivide
public WordResidue<C>[] twosidedDivide(WordResidue<C> S)
WordResidue two-sided division.- Specified by:
twosidedDividein interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
twosidedDividein interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- [left, right] with left*S*right + remainder = this.
-
rightDivide
public WordResidue<C> rightDivide(WordResidue<C> S)
WordResidue right division.- Specified by:
rightDividein interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
rightDividein interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- right, with S * right = this
-
inverse
public WordResidue<C> inverse()
WordResidue inverse.- Specified by:
inversein interfaceMonoidElem<C extends GcdRingElem<C>>- Returns:
- S with S = 1/this if defined.
- See Also:
MonoidElem.inverse()
-
remainder
public WordResidue<C> remainder(WordResidue<C> S)
WordResidue remainder.- Specified by:
remainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this - (this/S) * S.
-
rightRemainder
public WordResidue<C> rightRemainder(WordResidue<C> S)
WordResidue right remainder.- Specified by:
rightRemainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
rightRemainderin interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- r = this - S * (S/right), where S * right = this.
-
twosidedRemainder
public WordResidue<C> twosidedRemainder(WordResidue<C> S)
WordResidue two-sided remainder.- Specified by:
twosidedRemainderin interfaceMonoidElem<C extends GcdRingElem<C>>- Specified by:
twosidedRemainderin interfaceNoncomRingElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- r = this - left*S*right.
-
multiply
public WordResidue<C> multiply(WordResidue<C> S)
WordResidue multiplication.- Specified by:
multiplyin interfaceMonoidElem<C extends GcdRingElem<C>>- Parameters:
S- WordResidue.- Returns:
- this*S.
-
multiply
public WordResidue<C> multiply(GenWordPolynomial<C> S)
WordResidue multiplication.- Parameters:
S- GenWordPolynomial.- Returns:
- this*S.
-
multiply
public WordResidue<C> multiply(C s)
-
multiply
public WordResidue<C> multiply(Word e)
WordResidue multiplication.- Parameters:
e- word.- Returns:
- this*e.
-
monic
public WordResidue<C> monic()
WordResidue monic.- Returns:
- this with monic value part.
-
gcd
public WordResidue<C> gcd(WordResidue<C> b)
Greatest common divisor.- Specified by:
gcdin interfaceRingElem<C extends GcdRingElem<C>>- Parameters:
b- other element.- Returns:
- gcd(this,b).
-
egcd
public WordResidue<C>[] egcd(WordResidue<C> b)
Extended greatest common divisor. Note: Not implemented, throws UnsupportedOperationException.- Specified by:
egcdin interfaceRingElem<C extends GcdRingElem<C>>- Parameters:
b- other element.- Returns:
- [ gcd(this,b), c1, c2 ] with c1*this + c2*b = gcd(this,b).
-
-