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 int
isunit
Flag to remember if this residue element is a unit. -1 is unknown, 1 is unit, 0 not a unit.WordResidueRing<C>
ring
WordResidue class factory data structure.GenWordPolynomial<C>
val
Value 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.int
compareTo(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.boolean
equals(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.int
hashCode()
Hash code for this residue.WordResidue<C>
inverse()
WordResidue inverse.boolean
isConstant()
Is WordResidue a constant.boolean
isONE()
Is WordResidue one.boolean
isUnit()
Is WordResidue unit.boolean
isZERO()
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.int
signum()
WordResidue signum.WordResidue<C>
subtract(WordResidue<C> S)
WordResidue subtraction.WordResidue<C>
sum(WordResidue<C> S)
WordResidue summation.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toScriptFactory()
Get a scripting compatible string representation of the factory.java.lang.String
toString()
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:
factory
in 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:
value
in interfaceValue<C extends GcdRingElem<C>>
- See Also:
Value.value()
-
numerator
public GenWordPolynomial<C> numerator()
Numerator. Returns the value.- Specified by:
numerator
in interfaceQuotPair<C extends GcdRingElem<C>>
- See Also:
QuotPair.numerator()
-
denominator
public GenWordPolynomial<C> denominator()
Denominator. Returns 1.- Specified by:
denominator
in interfaceQuotPair<C extends GcdRingElem<C>>
- See Also:
QuotPair.denominator()
-
copy
public WordResidue<C> copy()
Clone this.- Specified by:
copy
in 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:
isZERO
in 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:
isONE
in 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:
isUnit
in 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:
isConstant
in interfaceQuotPair<C extends GcdRingElem<C>>
- Specified by:
isConstant
in 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:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScript
in 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:
toScriptFactory
in 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:
compareTo
in interfacejava.lang.Comparable<C extends GcdRingElem<C>>
- Specified by:
compareTo
in 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:
equals
in interfaceElement<C extends GcdRingElem<C>>
- Overrides:
equals
in 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:
hashCode
in interfaceElement<C extends GcdRingElem<C>>
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hashCode.
- See Also:
Object.hashCode()
-
abs
public WordResidue<C> abs()
WordResidue absolute value.- Specified by:
abs
in 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:
sum
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Parameters:
S
- WordResidue.- Returns:
- this+S.
-
negate
public WordResidue<C> negate()
WordResidue negate.- Specified by:
negate
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
signum
public int signum()
WordResidue signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Returns:
- signum(this).
- See Also:
AbelianGroupElem.signum()
-
subtract
public WordResidue<C> subtract(WordResidue<C> S)
WordResidue subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends GcdRingElem<C>>
- Parameters:
S
- WordResidue.- Returns:
- this-S.
-
divide
public WordResidue<C> divide(WordResidue<C> S)
WordResidue left division.- Specified by:
divide
in 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:
twosidedDivide
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Specified by:
twosidedDivide
in 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:
rightDivide
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Specified by:
rightDivide
in interfaceNoncomRingElem<C extends GcdRingElem<C>>
- Parameters:
S
- WordResidue.- Returns:
- right, with S * right = this
-
inverse
public WordResidue<C> inverse()
WordResidue inverse.- Specified by:
inverse
in 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:
remainder
in 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:
rightRemainder
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Specified by:
rightRemainder
in 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:
twosidedRemainder
in interfaceMonoidElem<C extends GcdRingElem<C>>
- Specified by:
twosidedRemainder
in 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:
multiply
in 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:
gcd
in 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:
egcd
in interfaceRingElem<C extends GcdRingElem<C>>
- Parameters:
b
- other element.- Returns:
- [ gcd(this,b), c1, c2 ] with c1*this + c2*b = gcd(this,b).
-
-